diff --git a/Client/Browser_Tools/BrowserJSObject.cs b/Client/Browser_Tools/BrowserJSObject.cs index 7d5a7237..a7922f9f 100644 --- a/Client/Browser_Tools/BrowserJSObject.cs +++ b/Client/Browser_Tools/BrowserJSObject.cs @@ -38,12 +38,12 @@ namespace Active_Client.Browser_Tools private static readonly string[] _validExtensions = {".json", ".rcp", ".tpl" }; //private static readonly string[] _validExtensions = { "", ".txt", ".cnc", ".cn", ".cno", ".ini", ".mpf", ".spf", ".tap", ".anc", ".iso" }; - private static readonly string[] _validImages = { ".jpg", ".jpeg", ".png" }; + private static readonly string[] _validImages = { ".jpg", ".jpeg", ".png", ".svg" }; private static string jobPath = ""; private static Dictionary _editorOpened = new Dictionary(); private static EditorVar _currentEditorObject = new EditorVar(); public static string RECENT_FOLDER_KEY = "RECENT"; - private const string THERMO_RECIPE_PATH = @"C:\CMS\Recipes"; + private const string THERMO_RECIPE_PATH = @"C:\CMS\Recipe"; public static FileSystemWatcher watcher = null; public static DateTime _lastTimeFileWatcherEventRaised = DateTime.Now; @@ -80,6 +80,11 @@ namespace Active_Client.Browser_Tools AddFunction("getFileList").Execute += getFileList; AddFunction("getProgramInfo").Execute += getProgramInfo; AddFunction("editProgram").Execute += editProgram; + AddFunction("deleteFile").Execute += deleteFile; + AddFunction("deleteFolder").Execute += deleteFolder; + AddFunction("createFolder").Execute += createFolder; + + AddFunction("uploadAndActivateProgram").Execute += uploadAndActivateProgram; AddFunction("uploadAndAddToQueue").Execute += uploadAndAddToQueue; @@ -360,6 +365,7 @@ namespace Active_Client.Browser_Tools List drivelist = new List(); // USB & HD Drives + /* foreach (var drive in DriveInfo.GetDrives()) { if (drive.IsReady) @@ -376,7 +382,7 @@ namespace Active_Client.Browser_Tools } } } - + // Desktop folder drivelist.Add(new Drive() { @@ -384,6 +390,7 @@ namespace Active_Client.Browser_Tools Path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\", Type = "SPFO" }); + */ if (Directory.Exists(THERMO_RECIPE_PATH)) { @@ -394,7 +401,7 @@ namespace Active_Client.Browser_Tools Type = "SPFO" }); } - + /* try { // Network Folders @@ -416,7 +423,7 @@ namespace Active_Client.Browser_Tools catch (Exception ex) { - } + }*/ e.SetReturnValue(JsonConvert.SerializeObject(drivelist)); } @@ -485,6 +492,85 @@ namespace Active_Client.Browser_Tools e.SetReturnValue(JsonConvert.SerializeObject(filelist)); } + public void deleteFile(object sender, CfrV8HandlerExecuteEventArgs e) + { + if (e.Arguments.Count() == 0) + { + e.SetReturnValue(JsonConvert.SerializeObject(new ErrorContainer("error_arguments_not_ok"))); + return; + } + + // Get path + string p = e.Arguments[0].StringValue; + FileAttributes attr = File.GetAttributes(p); + if (!File.Exists(p) || attr.HasFlag(FileAttributes.Directory)) + { + e.SetReturnValue(JsonConvert.SerializeObject(new ErrorContainer("file_not_found"))); + return; + } + if (attr.HasFlag(FileAttributes.ReadOnly)) + { + e.SetReturnValue(JsonConvert.SerializeObject(new ErrorContainer("file_not_editable"))); + return; + } + try + { + File.Delete(p); + } + catch(Exception ex) + { + e.SetReturnValue(JsonConvert.SerializeObject(new ErrorContainer("cannot_delete_file"))); + } + } + + public void deleteFolder(object sender, CfrV8HandlerExecuteEventArgs e) + { + if (e.Arguments.Count() == 0) + { + e.SetReturnValue(JsonConvert.SerializeObject(new ErrorContainer("error_arguments_not_ok"))); + return; + } + + // Get path + string p = e.Arguments[0].StringValue; + FileAttributes attr = File.GetAttributes(p); + if (!Directory.Exists(p) || !attr.HasFlag(FileAttributes.Directory)) + { + e.SetReturnValue(JsonConvert.SerializeObject(new ErrorContainer("directory_not_found"))); + return; + } + if (attr.HasFlag(FileAttributes.ReadOnly)) + { + e.SetReturnValue(JsonConvert.SerializeObject(new ErrorContainer("directory_not_editable"))); + return; + } + try + { + Directory.Delete(p,true); + } + catch (Exception ex) + { + e.SetReturnValue(JsonConvert.SerializeObject(new ErrorContainer("cannot_delete_directory"))); + } + } + + public void createFolder(object sender, CfrV8HandlerExecuteEventArgs e) + { + if (e.Arguments.Count() == 0) + { + e.SetReturnValue(JsonConvert.SerializeObject(new ErrorContainer("error_arguments_not_ok"))); + return; + } + string path = e.Arguments[0].StringValue; + try + { + Directory.CreateDirectory(path); + } + catch (Exception ex) + { + e.SetReturnValue(JsonConvert.SerializeObject(new ErrorContainer("cannot_delete_directory"))); + } + } // Upload and activate the program public async void uploadAndActivateProgram(object sender, CfrV8HandlerExecuteEventArgs e) { @@ -671,8 +757,7 @@ namespace Active_Client.Browser_Tools // Read info of a file public void getProgramInfo(object sender, CfrV8HandlerExecuteEventArgs e) { - string line, imagePath, imageDirectory; - int counter = 0; + string imagePath, imageDirectory; if (e.Arguments.Count() == 0) { diff --git a/Thermo.Active/Controllers/WebApi/RecipeController.cs b/Thermo.Active/Controllers/WebApi/RecipeController.cs index 0aebb19b..3a9fcf0e 100644 --- a/Thermo.Active/Controllers/WebApi/RecipeController.cs +++ b/Thermo.Active/Controllers/WebApi/RecipeController.cs @@ -70,6 +70,11 @@ namespace Thermo.Active.Controllers.WebApi return Ok(currRecipe); } + [Route("recipeNotes"), HttpGet] + public IHttpActionResult GetRecipeNotes() + { + return Ok(NcFileAdapter.RecipeLiveData.recipeNotes); + } [Route("update"), HttpPut] [WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.RECIPE_MANAGER, Action = ACTIONS.READ)] diff --git a/Thermo.Active/Properties/AssemblyInfo.cs b/Thermo.Active/Properties/AssemblyInfo.cs index ca601503..b4e385bc 100644 --- a/Thermo.Active/Properties/AssemblyInfo.cs +++ b/Thermo.Active/Properties/AssemblyInfo.cs @@ -30,4 +30,4 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("0.13.74")] \ No newline at end of file +[assembly: AssemblyVersion("0.13.75")] \ No newline at end of file diff --git a/Thermo.Active/wwwroot/assets/styles/base/modals.less b/Thermo.Active/wwwroot/assets/styles/base/modals.less index 713b3c85..5f628a9f 100644 --- a/Thermo.Active/wwwroot/assets/styles/base/modals.less +++ b/Thermo.Active/wwwroot/assets/styles/base/modals.less @@ -2378,7 +2378,7 @@ line-height: 4px; .title { - width: 110px; + min-width: 110px; text-align: right; color: @color-darkish-blue; } diff --git a/Thermo.Active/wwwroot/assets/styles/style.css b/Thermo.Active/wwwroot/assets/styles/style.css index 6db29f6e..85182c1a 100644 --- a/Thermo.Active/wwwroot/assets/styles/style.css +++ b/Thermo.Active/wwwroot/assets/styles/style.css @@ -2523,7 +2523,7 @@ article .box .body { .modal.modal-add-element-queue .modal-load-program-body .selected-item .selected-item-header .subtitle .title, .modal.modal-load-program .modal-add-element-queue-body .selected-item .selected-item-header .subtitle .title, .modal.modal-add-element-queue .modal-add-element-queue-body .selected-item .selected-item-header .subtitle .title { - width: 110px; + min-width: 110px; text-align: right; color: #002680; } diff --git a/Thermo.Active/wwwroot/config.development.json b/Thermo.Active/wwwroot/config.development.json index 58ce0f2f..f8091c43 100644 --- a/Thermo.Active/wwwroot/config.development.json +++ b/Thermo.Active/wwwroot/config.development.json @@ -2,7 +2,7 @@ "env": "development", "api": { "enabled": true, - "apiServerUrl": "http://seriate.steamware.net:9000/" + "apiServerUrl": "http://localhost:9000/" }, - "allUIVisible": true + "allUIVisible": false } \ No newline at end of file diff --git a/Thermo.Active/wwwroot/index.html b/Thermo.Active/wwwroot/index.html index f52c1422..06c2fb9c 100644 --- a/Thermo.Active/wwwroot/index.html +++ b/Thermo.Active/wwwroot/index.html @@ -13,7 +13,7 @@ - + diff --git a/Thermo.Active/wwwroot/src/App.ts b/Thermo.Active/wwwroot/src/App.ts index 30388c39..400b08c2 100644 --- a/Thermo.Active/wwwroot/src/App.ts +++ b/Thermo.Active/wwwroot/src/App.ts @@ -20,6 +20,7 @@ import Component from "vue-class-component"; import { Watch } from "vue-property-decorator"; import { UsersService } from "./services/usersService"; import { KeyboardHelper } from "./app_modules_thermo/components/KeyboardHelper"; +import printGantt from "@/app_modules_thermo/processo/components/printProcesso.vue"; declare var cmsClient; @@ -37,6 +38,7 @@ declare var cmsClient; dashboard: Dashboard, predashboard: PreDashboard, alarmList, + printGantt } }) export default class app extends Vue { diff --git a/Thermo.Active/wwwroot/src/App.vue b/Thermo.Active/wwwroot/src/App.vue index 4e28f4e5..a7c89d2a 100644 --- a/Thermo.Active/wwwroot/src/App.vue +++ b/Thermo.Active/wwwroot/src/App.vue @@ -18,6 +18,7 @@ + diff --git a/Thermo.Active/wwwroot/src/app_modules_thermo/dashboard/dashboard.ts b/Thermo.Active/wwwroot/src/app_modules_thermo/dashboard/dashboard.ts index d03c9847..8c6cbc48 100644 --- a/Thermo.Active/wwwroot/src/app_modules_thermo/dashboard/dashboard.ts +++ b/Thermo.Active/wwwroot/src/app_modules_thermo/dashboard/dashboard.ts @@ -26,7 +26,6 @@ import { Hub } from '@/services'; }) export default class Dashboard extends Vue { - get panel() { return (this.$store.state as AppModel).prod.panel; } @@ -66,7 +65,6 @@ export default class Dashboard extends Vue { return (this.$store.state as AppModel).machineInfo.cmsConnectReady; } - loading = false; async loadMore() { if (this.loading) return; @@ -81,11 +79,11 @@ export default class Dashboard extends Vue { getColor(nome, cognome) { return getColorFromName(nome, cognome); } + isDarkColor(color) { return isDarkColor(color); } - async mounted() { prodService.GetProdPanel(); @@ -157,7 +155,6 @@ export default class Dashboard extends Vue { close() { appModelActions.ShowDashboard(this.$store); }; - } enum ribbonStatusEnum { diff --git a/Thermo.Active/wwwroot/src/app_modules_thermo/processo/components/gantt/gantt-component.vue b/Thermo.Active/wwwroot/src/app_modules_thermo/processo/components/gantt/gantt-component.vue index d26517b6..30efe406 100644 --- a/Thermo.Active/wwwroot/src/app_modules_thermo/processo/components/gantt/gantt-component.vue +++ b/Thermo.Active/wwwroot/src/app_modules_thermo/processo/components/gantt/gantt-component.vue @@ -149,7 +149,7 @@ - + - + i.section == this.section).sort((a, b) => a.priority - b.priority); } + get maxVerticalPosition() { + return Math.max(...this.blocks.map(b => this.verticalPosition(b))) + } + + get maxBlockPosition() { + return Math.max(...this.blocks.map(b => this.startPosition(b))) + } + startPosition(block: server.Modblock) { return blockStartPosition(block, this.blocks, this.ganttOptions) * this.ganttOptions.secondSize; } diff --git a/Thermo.Active/wwwroot/src/app_modules_thermo/processo/components/gantt/gantt.ts b/Thermo.Active/wwwroot/src/app_modules_thermo/processo/components/gantt/gantt.ts index b89a6f7d..fa412607 100644 --- a/Thermo.Active/wwwroot/src/app_modules_thermo/processo/components/gantt/gantt.ts +++ b/Thermo.Active/wwwroot/src/app_modules_thermo/processo/components/gantt/gantt.ts @@ -4,10 +4,12 @@ import moment from "moment"; import ganttHeader from "./gantt-header.vue"; import ganttRow from "./gantt-row.vue" import timeLine from "./timeline.vue"; +import { recipeService } from "@/services/recipeService"; +import { store, AppModel } from "@/store"; var ContainerElements = ["svg", "g", "foreignobject"]; var RelevantStyles = { - "rect": ["fill", "stroke", "stroke-width"], + "rect": ["fill", "stroke", "stroke-width", "rx", "ry"], "path": ["fill", "stroke", "stroke-width"], "circle": ["fill", "stroke", "stroke-width"], "line": ["stroke", "stroke-width"], @@ -34,6 +36,16 @@ export default class Gantt extends Vue { padX: number = 0; padY: number = 0; + get panel() { + return (this.$store.state as AppModel).prod.panel; + } + + + get ganttHeight() { + return (this.$refs.section1 as any).rowHeight + + (this.$refs.section2 as any).rowHeight + + (this.$refs.section3 as any).rowHeight; + } public print() { this.ganttOptions.printing = true; @@ -48,10 +60,10 @@ export default class Gantt extends Vue { var DOMURL = (window.URL || window.webkitURL); var svgBlob = new Blob([data], { type: 'image/svg+xml;charset=utf-8' }); - var url = DOMURL.createObjectURL(svgBlob); - + // var url = DOMURL.createObjectURL(svgBlob); + recipeService.UploadImage(svgBlob, this.panel.nomeRicetta.replace('.rcp', '') + ".svg"); this.ganttOptions.printing = false; - window.open(url, '_blank') + // window.open(url, '_blank') }); } diff --git a/Thermo.Active/wwwroot/src/app_modules_thermo/processo/components/gantt/gantt.vue b/Thermo.Active/wwwroot/src/app_modules_thermo/processo/components/gantt/gantt.vue index e9bf5b37..fddec304 100644 --- a/Thermo.Active/wwwroot/src/app_modules_thermo/processo/components/gantt/gantt.vue +++ b/Thermo.Active/wwwroot/src/app_modules_thermo/processo/components/gantt/gantt.vue @@ -4,7 +4,7 @@ ref="mainContainer" preserveAspectRation="xMinYMax" width="100%" - height="100%" + :height="ganttOptions.printing ? `${ganttHeight}px` : '100%'" @mousemove.capture="doPan" v-on:touchmove="doPan" @mousedown="startPan" diff --git a/Thermo.Active/wwwroot/src/app_modules_thermo/processo/components/printProcesso.ts b/Thermo.Active/wwwroot/src/app_modules_thermo/processo/components/printProcesso.ts new file mode 100644 index 00000000..384c12a9 --- /dev/null +++ b/Thermo.Active/wwwroot/src/app_modules_thermo/processo/components/printProcesso.ts @@ -0,0 +1,23 @@ +import Vue from "vue"; +import Component from "vue-class-component"; +import gantt from "./gantt/gantt.vue"; +import { store } from "@/store"; +import { messageService } from "@/_base"; + +@Component({ + components: { + gantt + } +}) +export default class PrintProcesso extends Vue { + + get blocks(): server.Modblock[] { + return store.state.modules.blocks; + } + + mounted() { + messageService.subscribeToChannel("print", () => { + (this.$refs.gantt as any).print(); + }) + } +} \ No newline at end of file diff --git a/Thermo.Active/wwwroot/src/app_modules_thermo/processo/components/printProcesso.vue b/Thermo.Active/wwwroot/src/app_modules_thermo/processo/components/printProcesso.vue new file mode 100644 index 00000000..83da3692 --- /dev/null +++ b/Thermo.Active/wwwroot/src/app_modules_thermo/processo/components/printProcesso.vue @@ -0,0 +1,6 @@ + +