From 54cdb69cb05f49f264e913b0c7ff56e3f47a19e1 Mon Sep 17 00:00:00 2001 From: Lucio Maranta Date: Wed, 9 May 2018 08:45:47 +0200 Subject: [PATCH 1/5] Fix families API --- .../Controllers/WebApi/ToolTableController.cs | 47 ++++++++++++------- 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/Step/Controllers/WebApi/ToolTableController.cs b/Step/Controllers/WebApi/ToolTableController.cs index a3ac3788..2e956088 100644 --- a/Step/Controllers/WebApi/ToolTableController.cs +++ b/Step/Controllers/WebApi/ToolTableController.cs @@ -147,12 +147,39 @@ namespace Step.Controllers.WebApi } [Route("family"), HttpPost] - public IHttpActionResult AddFamily([FromBody] dynamic body) + public IHttpActionResult AddFamily([FromBody] DTOFamilyModel family) { + if (String.IsNullOrEmpty(family.Name)) + return BadRequest(); + using (NcHandler ncHandler = new NcHandler()) { ncHandler.Connect(); - CmsError libraryError = ncHandler.AddFamily(body.name.ToString(), out FamilyModel family); + CmsError libraryError = ncHandler.AddFamily(family.Name, out FamilyModel newFamily); + if (libraryError.IsError()) + if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) + return BadRequest(libraryError.message); + + return Ok(newFamily); + } + } + + public struct DTOFamilyModel + { + public string Name; + } + + [Route("family/{oldName}"), HttpPut] + public IHttpActionResult PutFamily(string oldName, [FromBody]DTOFamilyModel family) + { + if (String.IsNullOrEmpty(family.Name)) + return BadRequest(); + + using (NcHandler ncHandler = new NcHandler()) + { + ncHandler.Connect(); + + CmsError libraryError = ncHandler.UpdateFamilyName(oldName, family.Name); if (libraryError.IsError()) if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); @@ -161,22 +188,6 @@ namespace Step.Controllers.WebApi } } - [Route("family/{oldName}"), HttpPut] - public IHttpActionResult PutFamily(string oldName, [FromBody]dynamic body) - { - using (NcHandler ncHandler = new NcHandler()) - { - ncHandler.Connect(); - - CmsError libraryError = ncHandler.UpdateFamilyName(oldName, body.name.ToString()); - if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) - return BadRequest(libraryError.message); - - return Ok(); - } - } - [Route("family/{name}"), HttpDelete] public IHttpActionResult DeleteFamily(string name) { From 7d23e417b77523d843daa1bb6a8bcc0c802aa98e Mon Sep 17 00:00:00 2001 From: Nicola Carminati Date: Wed, 9 May 2018 10:50:38 +0200 Subject: [PATCH 2/5] Added feature: select-axis buttons if heads < 3 --- Step/wwwroot/assets/styles/base/buttons.less | 12 ++++ Step/wwwroot/assets/styles/base/head.less | 4 ++ .../assets/styles/base/plc-softkeys.less | 26 +++++++++ Step/wwwroot/assets/styles/style.css | 39 +++++++++++++ .../wwwroot/src/components/under-the-hood.vue | 10 ++++ Step/wwwroot/src/modules/axes-softkeys.vue | 57 +++++++++++++++++++ Step/wwwroot/src/modules/mheads.vue | 7 +-- .../src/modules/under-the-hood/jog-menu.vue | 11 +++- 8 files changed, 159 insertions(+), 7 deletions(-) create mode 100644 Step/wwwroot/src/modules/axes-softkeys.vue diff --git a/Step/wwwroot/assets/styles/base/buttons.less b/Step/wwwroot/assets/styles/base/buttons.less index b83d5d65..ee50ec2e 100644 --- a/Step/wwwroot/assets/styles/base/buttons.less +++ b/Step/wwwroot/assets/styles/base/buttons.less @@ -135,6 +135,10 @@ button.square { margin: 0 8px; padding: 0 4px; display: flex; + &.collapsed{ + margin: 0; + padding: 0; + } } .btn-group { @@ -168,12 +172,20 @@ button.soft { font-size: 14px; border-radius: 2px; + &.icon{ display: flex; padding: 1px 12px; align-items: center; } + &.axes{ + width: 54px; + font-size: 1.8em; + display: block; + font-weight: 600; + } + img { width: 18px; image-rendering: -webkit-optimize-contrast; diff --git a/Step/wwwroot/assets/styles/base/head.less b/Step/wwwroot/assets/styles/base/head.less index 13768b30..a5bf0773 100644 --- a/Step/wwwroot/assets/styles/base/head.less +++ b/Step/wwwroot/assets/styles/base/head.less @@ -370,7 +370,11 @@ flex-flow: row wrap; width: 512px; height: 230px; + overflow-x: hidden; } +.mini{ + width: 262px; + } .heads-container-lt4 { right: -12px; diff --git a/Step/wwwroot/assets/styles/base/plc-softkeys.less b/Step/wwwroot/assets/styles/base/plc-softkeys.less index 4a30d79d..3acc9e25 100644 --- a/Step/wwwroot/assets/styles/base/plc-softkeys.less +++ b/Step/wwwroot/assets/styles/base/plc-softkeys.less @@ -404,6 +404,32 @@ } } +#axes-softkeys-container { + position: absolute; + top: 0; + left: 322px; + width: 258px; + height: 223px; + margin: -4px; + display: flex; + flex-flow: row wrap; + overflow: hidden; + .empty-space { + display: block; + width: 54px; + height: 48px; + margin: 4px; + background-color: #4e585e; + border-radius: 2px; + } + div { + width: 100%; + height: 100%; + display: flex; + flex-wrap: wrap; + } +} + .jog-menu, .auto-menu { // width: 100%; diff --git a/Step/wwwroot/assets/styles/style.css b/Step/wwwroot/assets/styles/style.css index 2bf7aa12..d4413a2f 100644 --- a/Step/wwwroot/assets/styles/style.css +++ b/Step/wwwroot/assets/styles/style.css @@ -394,6 +394,10 @@ button.square:hover { padding: 0 4px; display: flex; } +.btn-spacer.collapsed { + margin: 0; + padding: 0; +} .btn-group { margin: 0 8px; padding: 0; @@ -429,6 +433,12 @@ button.soft.icon { padding: 1px 12px; align-items: center; } +button.soft.axes { + width: 54px; + font-size: 1.8em; + display: block; + font-weight: 600; +} button.soft img { width: 18px; image-rendering: -webkit-optimize-contrast; @@ -1864,6 +1874,31 @@ footer .container button.big:before { display: flex; flex-wrap: wrap; } +#axes-softkeys-container { + position: absolute; + top: 0; + left: 322px; + width: 258px; + height: 223px; + margin: -4px; + display: flex; + flex-flow: row wrap; + overflow: hidden; +} +#axes-softkeys-container .empty-space { + display: block; + width: 54px; + height: 48px; + margin: 4px; + background-color: #4e585e; + border-radius: 2px; +} +#axes-softkeys-container div { + width: 100%; + height: 100%; + display: flex; + flex-wrap: wrap; +} .jog-menu, .auto-menu { background-color: #4e585e; @@ -2544,6 +2579,10 @@ footer .container button.big:before { flex-flow: row wrap; width: 512px; height: 230px; + overflow-x: hidden; +} +.mini { + width: 262px; } .heads-container-lt4 { right: -12px; diff --git a/Step/wwwroot/src/components/under-the-hood.vue b/Step/wwwroot/src/components/under-the-hood.vue index f1f337f5..dc40ebe4 100644 --- a/Step/wwwroot/src/components/under-the-hood.vue +++ b/Step/wwwroot/src/components/under-the-hood.vue @@ -15,6 +15,7 @@
+ @@ -26,6 +27,7 @@ import { appModelActions } from "src/store"; import plcSoftKeys from "src/modules/plc-softkeys.vue"; import ncSoftKeys from "src/modules/nc-softkeys.vue"; +import axesSoftKeys from "src/modules/axes-softkeys.vue"; import mheads from "src/modules/mheads.vue"; import jogMenu from "src/modules/under-the-hood/jog-menu.vue"; import autoMenu from "src/modules/under-the-hood/auto-menu.vue"; @@ -36,6 +38,7 @@ export default { components: { plcSoftKeys, ncSoftKeys, + axesSoftKeys, mheads, jogMenu, autoMenu, @@ -57,6 +60,13 @@ export default { let mdi = this.$store.getters.getNcSoftKeyStatus(2); let edit = this.$store.getters.getNcSoftKeyStatus(3); return this.isCnReady() && ((auto && auto.value) || (mdi && mdi.value) || (edit && edit.value)); + }, + showAxisBtn: function(){ + let headsnum = this.$store.state.machineInfo.heads.length + if(headsnum <= 2) + return true + else + return false; } }, methods: { diff --git a/Step/wwwroot/src/modules/axes-softkeys.vue b/Step/wwwroot/src/modules/axes-softkeys.vue new file mode 100644 index 00000000..8a6c31c0 --- /dev/null +++ b/Step/wwwroot/src/modules/axes-softkeys.vue @@ -0,0 +1,57 @@ + + diff --git a/Step/wwwroot/src/modules/mheads.vue b/Step/wwwroot/src/modules/mheads.vue index 25707379..1ce3786f 100644 --- a/Step/wwwroot/src/modules/mheads.vue +++ b/Step/wwwroot/src/modules/mheads.vue @@ -1,5 +1,5 @@