From 5692e40d092d4ff6b72ddfbd053ea431c8d1d876 Mon Sep 17 00:00:00 2001 From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com> Date: 星期四, 03 七月 2025 17:15:14 +0800 Subject: [PATCH] 添加任务删除功能及相关接口实现 --- CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Stock/StockInfoHtyService.cs | 158 ++++++++++++ CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicRepository/Stock/StockInfoHtyRepository.cs | 9 CodeManagement/WMS/WIDESEA_WMSClient/src/extension/widesea_wms/stock/Dt_BillGroupStock_Hty.jsx | 201 +++++++++++++++ CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/StockInfoHtyController.cs | 12 CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_IStorageBasicService/Stock/IStockInfoHtyvice.cs | 5 CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 8 CodeManagement/WMS/WIDESEA_WMSClient/src/router/tables.js | 7 CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs | 2 CodeManagement/WMS/WIDESEA_WMSClient/src/views/widesea_wms/stock/Dt_BillGroupStock_Hty.vue | 93 +++++++ CodeManagement/WMS/WIDESEA_WMSClient/src/extension/widesea_wms/stock/Dt_OutTime.jsx | 201 +++++++++++++++ CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs | 29 +- CodeManagement/WMS/WIDESEA_WMSClient/src/views/widesea_wms/stock/Dt_OutTime.vue | 21 CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs | 24 - CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_IStorageBasicRepository/Stock/IStockInfoHtyRepository.cs | 6 14 files changed, 727 insertions(+), 49 deletions(-) diff --git a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs index ddacd5f..90cb97e 100644 --- a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs +++ b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs @@ -321,5 +321,7 @@ /// <param name="deviceNo"></param> /// <returns></returns> Dt_Task QueryOutFireAlarmTask(string deviceNo); + + WebResponseContent Delete(Dt_Task task); } } \ No newline at end of file diff --git a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs index 06c2d6e..4e44922 100644 --- a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs +++ b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs @@ -960,6 +960,14 @@ return wcsBasez + address; } + public WebResponseContent Delete(Dt_Task task) + { + var taskHty = task.Adapt<Dt_Task_Hty>(); + taskHty.Creater = App.User.UserName != null ? App.User.UserName : "System"; + _taskHtyRepository.AddData(taskHty); + return base.DeleteData(task); + } + #region 閲嶅啓鏂规硶 public override WebResponseContent DeleteData(object[] key) diff --git a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs index 216afe0..c0608b7 100644 --- a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs +++ b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs @@ -202,8 +202,6 @@ try { var task = _taskService.QueryBarCodeConveyorLineTask(command.ConveyorLineBarcode, childDeviceCode); - //HandleTaskOut(conveyorLine, command, childDeviceCode, task); - // && command.ConveyorLineBarcode != "NoRead" && !command.ConveyorLineBarcode.IsNotEmptyOrNull() var log = $"銆恵conveyorLine.DeviceName}銆戞墭鐩樺彿锛氥�恵command.ConveyorLineBarcode}銆戜换鍔″彿锛氥�恵command.ConveyorLineTaskNum}銆戣澶囩紪鐮侊細銆恵childDeviceCode}銆�"; ConsoleHelper.WriteSuccessLine(log); @@ -216,9 +214,6 @@ } else { - //ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task); - //conveyorLine.SendCommand(taskCommand, childDeviceCode); - //conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, 1, childDeviceCode); conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, (long)task.TaskNum, childDeviceCode); conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, task.NextAddress, childDeviceCode); conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineBarcode, task.PalletCode, childDeviceCode); @@ -241,7 +236,6 @@ /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param> public void RequestInNextAddress(CommonConveyorLine_GW conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode) { - //Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode); Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode, command.ConveyorLineBarcode); if (task != null) { @@ -275,8 +269,6 @@ var task = _taskService.QueryExecutingTaskByBarcode(command.ConveyorLineBarcode, childDeviceCode); if (task != null && task.TaskState != (int)TaskInStatusEnum.Line_InFinish) { - //ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true); - WebResponseContent content = _taskService.UpdateTaskStatusToNext(task); if (content.Status) @@ -301,10 +293,6 @@ //var task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode, command.ConveyorLineBarcode); if (task != null) { - //ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task); - //conveyorLine.SendCommand(taskCommand, childDeviceCode); - //conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, 1, childDeviceCode); - conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, (long)task.TaskNum, childDeviceCode); conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, task.NextAddress, childDeviceCode); conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineBarcode, task.PalletCode, childDeviceCode); @@ -362,10 +350,6 @@ Dt_Task? newTask = _taskService.UpdatePosition(task.TaskNum, task.CurrentAddress); if (newTask != null) { - //ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(newTask); - //conveyorLine.SendCommand(taskCommand, childDeviceCode); - //conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, 1, childDeviceCode); - conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, (long)newTask.TaskNum, childDeviceCode); conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, newTask.NextAddress, childDeviceCode); conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineBarcode, newTask.PalletCode, childDeviceCode); @@ -375,11 +359,6 @@ } else { - //ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task); - //taskCommand.ConveyorLineTargetAddress = Convert.ToInt16(stationManager.stationNGChildCode); - //conveyorLine.SendCommand(taskCommand, childDeviceCode); - //conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, 1, childDeviceCode); - conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, (long)task.TaskNum, childDeviceCode); conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, task.NextAddress, childDeviceCode); conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineBarcode, task.PalletCode, childDeviceCode); @@ -484,7 +463,8 @@ _needBarcodeRepository.UpdateData(needBarcode); } } - content = _taskService.UpdateTaskStatusToNext(task); + taskNext.ExceptionMessage = log; + content = _taskService.UpdateTaskStatusToNext(taskNext); var proAddress = conveyorLine.DeviceProDTOs .FirstOrDefault(x => x.DeviceChildCode == childDeviceCode && x.DeviceProParamName == ConveyorLineDBName_After.InteractiveSignal.ToString()) ?.DeviceProAddress; diff --git a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs index 121566c..06b5fb4 100644 --- a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs +++ b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs @@ -360,7 +360,19 @@ if (_taskRepository.QueryFirst(x => x.PalletCode == command.ConveyorLineBarcode) != null) { - WriteInfo(conveyorLine.DeviceName, "褰撳墠鎵樼洏瀛樺湪浠诲姟"); + List<string> strings = new List<string>() { "3637", "3633", "3629" }; + + var taskExecuting = _taskRepository.QueryFirst(x => x.PalletCode == command.ConveyorLineBarcode && x.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting && strings.Contains(x.TargetAddress)); + + if (taskExecuting != null) + { + taskExecuting.ExceptionMessage = "鏈帴鏀跺埌绾夸綋瀹屾垚淇″彿绯荤粺鍐呴儴鑷姩瀹屾垚"; + _taskService.Delete(taskExecuting); + } + + ConsoleHelper.WriteErrorLine($"褰撳墠鎵樼洏瀛樺湪浠诲姟锛氥�恵command.ConveyorLineBarcode}銆�"); + + WriteInfo(conveyorLine.DeviceName, $"褰撳墠鎵樼洏瀛樺湪浠诲姟{command.ConveyorLineBarcode}"); return; } @@ -371,15 +383,9 @@ var content = CreateAndSendTask(taskDTO); if (content.Status) { - //var task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode); var task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode, command.ConveyorLineBarcode); if (task != null) { - //var taskCommand = MapTaskCommand(task, command); - //conveyorLine.SendCommand(taskCommand, childDeviceCode); - //conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, 1, childDeviceCode); - //ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task); - conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, (long)task.TaskNum, childDeviceCode); conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, task.NextAddress, childDeviceCode); conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineBarcode, task.PalletCode, childDeviceCode); @@ -430,10 +436,6 @@ var Hastask = _taskService.QueryBarCodeConveyorLineTask(command.ConveyorLineBarcode, childDeviceCode); if (Hastask != null) { - //ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(Hastask); - //conveyorLine.SendCommand(taskCommand, childDeviceCode); - //conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, 1, childDeviceCode); - conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, (long)Hastask.TaskNum, childDeviceCode); conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, Hastask.NextAddress, childDeviceCode); conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineBarcode, Hastask.PalletCode, childDeviceCode); @@ -447,11 +449,6 @@ var task = _taskService.QueryBarCodeConveyorLineTask(command.ConveyorLineBarcode, childDeviceCode); if (task != null) { - //ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task); - //conveyorLine.SendCommand(taskCommand, childDeviceCode); - //conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, 1, childDeviceCode); - //ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task); - conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, (long)task.TaskNum, childDeviceCode); conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, task.NextAddress, childDeviceCode); conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineBarcode, task.PalletCode, childDeviceCode); diff --git a/CodeManagement/WMS/WIDESEA_WMSClient/src/extension/widesea_wms/stock/Dt_BillGroupStock_Hty.jsx b/CodeManagement/WMS/WIDESEA_WMSClient/src/extension/widesea_wms/stock/Dt_BillGroupStock_Hty.jsx new file mode 100644 index 0000000..a301399 --- /dev/null +++ b/CodeManagement/WMS/WIDESEA_WMSClient/src/extension/widesea_wms/stock/Dt_BillGroupStock_Hty.jsx @@ -0,0 +1,201 @@ +/***************************************************************************************** + ** Author:jxx 2022 + ** QQ:283591387 + **瀹屾暣鏂囨。瑙侊細http://v2.volcore.xyz/document/api 銆愪唬鐮佺敓鎴愰〉闈iewGrid銆� + **甯哥敤绀轰緥瑙侊細http://v2.volcore.xyz/document/vueDev + **鍚庡彴鎿嶄綔瑙侊細http://v2.volcore.xyz/document/netCoreDev + *****************************************************************************************/ +//姝s鏂囦欢鏄敤鏉ヨ嚜瀹氫箟鎵╁睍涓氬姟浠g爜锛屽彲浠ユ墿灞曚竴浜涜嚜瀹氫箟椤甸潰鎴栬�呴噸鏂伴厤缃敓鎴愮殑浠g爜 + +// import gridHeader from "./demo_Product/Dt_BillGroupStockDetail.vue"; +import gridBody from "./extend/SupplementationData.vue" +let extension = { + components: { + //鏌ヨ鐣岄潰鎵╁睍缁勪欢 + gridHeader: '', + gridBody: gridBody, + gridFooter: '', + //鏂板缓銆佺紪杈戝脊鍑烘鎵╁睍缁勪欢 + modelHeader: '', + modelBody: '', + modelFooter: '' + }, + tableAction: '', //鎸囧畾鏌愬紶琛ㄧ殑鏉冮檺(杩欓噷濉啓琛ㄥ悕,榛樿涓嶇敤濉啓) + buttons: { view: [], box: [], detail: [] }, //鎵╁睍鐨勬寜閽� + methods: { + //涓嬮潰杩欎簺鏂规硶鍙互淇濈暀涔熷彲浠ュ垹闄� + onInit() { + //妗嗘灦鍒濆鍖栭厤缃墠锛� + let OutBoundBtn = this.buttons.find((x) => x.value == 'OutBound') + if (OutBoundBtn) { + OutBoundBtn.onClick = function () { + // this.$Message.success('鐐瑰嚮浜嗘寜閽�') + let row = this.$refs.table.getSelected() //鑾峰彇閫変腑鐨勮 + if (row <= 0) { + //濡傛灉娌℃湁閫変腑琛� + this.$Message.error('璇烽�夋嫨涓�琛屾暟鎹�') + return + } + let locationCode = row[0].locationCode + let palletCode = row[0].palletCode + this.http + .get( + `/api/Task/CreateAndSendOutboundTask?locationCode=${locationCode}&palletCode=${palletCode}`, + {}, + '姝e湪鍒涘缓浠诲姟' + ) + .then((res) => { + //绀轰緥锛氳皟鐢ㄥ悗鍙版帴鍙� + if (res.status) { + this.$Message.success('鍒涘缓浠诲姟鎴愬姛') + console.log(res) + this.refresh() //鍒锋柊琛ㄦ牸 + } else { + this.$Message.error(res.message) //閿欒鎻愮ず + } + }) + } + } + + + var btnSupplementationData = this.buttons.find(x => x.value == "SupplementationData"); + if (btnSupplementationData != null) { + btnSupplementationData.onClick = () => { + let rows = this.$refs.table.getSelected(); + if (rows.length == 0) { + return this.$error("璇烽�夋嫨鏁版嵁!"); + } else if (rows.length > 1) { + return this.$error("鍙兘閫夋嫨鍗曟潯鏁版嵁"); + } + this.$refs.gridBody.open(rows[0].palletCode); + this.refresh(); + } + + } + //绀轰緥锛氬湪鎸夐挳鐨勬渶鍓嶉潰娣诲姞涓�涓寜閽� + // this.buttons.unshift({ + // //涔熷彲浠ョ敤push鎴栬�卻plice鏂规硶鏉ヤ慨鏀筨uttons鏁扮粍 + // name: '鐩存帴鍑哄簱', //鎸夐挳鍚嶇О + // icon: 'el-icon-document', //鎸夐挳鍥炬爣vue2鐗堟湰瑙乮view鏂囨。icon锛寁ue3鐗堟湰瑙乪lement ui鏂囨。icon(娉ㄦ剰涓嶆槸element puls鏂囨。) + // type: 'primary', //鎸夐挳鏍峰紡vue2鐗堟湰瑙乮view鏂囨。button锛寁ue3鐗堟湰瑙乪lement ui鏂囨。button + // onClick: function () { + // this.$Message.success('鐐瑰嚮浜嗘寜閽�') + // let row = this.$refs.table.getSelected() //鑾峰彇閫変腑鐨勮 + // if (row <= 0) { + // //濡傛灉娌℃湁閫変腑琛� + // this.$Message.error('璇烽�夋嫨涓�琛屾暟鎹�') + // return + // } + // let locationCode = row[0].locationCode + // let palletCode = row[0].palletCode + // this.http.get(`/api/Task/CreateAndSendOutboundTask?locationCode=${locationCode}&palletCode=${palletCode}`, {}, "姝e湪鍒涘缓浠诲姟").then((res) => { + // //绀轰緥锛氳皟鐢ㄥ悗鍙版帴鍙� + // if (res.status) { + // this.$Message.success('鍒涘缓浠诲姟鎴愬姛') + // } else { + // this.$Message.error(res.message) //閿欒鎻愮ず + // } + // }) + // } + // }) + + //绀轰緥锛氳缃慨鏀规柊寤恒�佺紪杈戝脊鍑烘瀛楁鏍囩鐨勯暱搴� + this.boxOptions.labelWidth = 150 + + // this.columns.push({ + // title: "鎿嶄綔", + // field: "鎿嶄綔", + // width: 150, + // align: "left", // 'center', + // render: (h, { row, column, index }) => { + // return ( + // <div> + // <el-button + // onClick={($e) => { + // this.$refs.gridHeader.openModel1(row); + // }} + // type="primary" + // plain + // style="height:26px; padding: 10px !important;" + // > + // 鏌ョ湅搴撳瓨鏄庣粏 + // </el-button> + // </div> + // ); + // }, + // }); + + this.columns.forEach((column) => { + //淇敼棰滆壊 + if (column.field == 'roadwayNo') { + column.formatter = (row) => { + // return '<span style="color: #2d8cf0;">' + row?.locationInfo?.roadwayNo + '</span>' + return row?.locationInfo?.roadwayNo + } + } + if (column.field == 'materielCode') { + column.formatter = (row) => { + // return '<span style="color: #2d8cf0;">' + row?.locationInfo?.roadwayNo + '</span>' + return row?.stockInfoDetails[0]?.materielCode + } + } + //鏍煎紡鍖栨棩鏈� + // 妫�鏌ュ綋鍓嶅垪鐨勫瓧娈垫槸鍚︿负 'locationStatus' + if (column.field == 'locationStatus') { + // 浣跨敤瀵硅薄瀛楅潰閲忔潵鏄犲皠 'locationStatus' 鐨勫�煎拰瀵瑰簲鐨勬枃鏈� + const statusMap = { + '-1': '鍏ㄩ儴', + '0': '绌洪棽', + '1': '閿佸畾', + '2': '鏈夎揣', + '3': '鏈夎揣绂佺敤', + '4': '鏃犺揣绂佺敤' + }; + // 瀹氫箟涓�涓牸寮忓寲鍑芥暟锛屾牴鎹� 'locationStatus' 鐨勫�艰繑鍥炵浉搴旂殑鏂囨湰 + column.formatter = (row) => { + // 浣跨敤 statusMap 瀵硅薄鏉ヨ幏鍙栧搴旂殑鏂囨湰锛屽鏋滄病鏈夊尮閰嶅垯杩斿洖 '鏈煡鐘舵��' + return statusMap[row?.locationInfo?.locationStatus] || '鏈煡鐘舵��'; + } + } + }) + }, + onInited() { + //妗嗘灦鍒濆鍖栭厤缃悗 + //濡傛灉瑕侀厤缃槑缁嗚〃,鍦ㄦ鏂规硶鎿嶄綔 + this.detailOptions.columns.forEach(column=>{ + console.log(column) + }); + }, + searchBefore(param) { + //鐣岄潰鏌ヨ鍓�,鍙互缁檖aram.wheres娣诲姞鏌ヨ鍙傛暟 + //杩斿洖false锛屽垯涓嶄細鎵ц鏌ヨ + return true + }, + searchAfter(result) { + console.log(result) + return true + }, + addBefore(formData) { + //鏂板缓淇濆瓨鍓峟ormData涓哄璞★紝鍖呮嫭鏄庣粏琛紝鍙互缁欑粰琛ㄥ崟璁剧疆鍊硷紝鑷繁杈撳嚭鐪媐ormData鐨勫�� + return true + }, + updateBefore(formData) { + //缂栬緫淇濆瓨鍓峟ormData涓哄璞★紝鍖呮嫭鏄庣粏琛ㄣ�佸垹闄よ鐨処d + return true + }, + rowClick({ row, column, event }) { + //鏌ヨ鐣岄潰鐐瑰嚮琛屼簨浠� + // this.$refs.table.$refs.table.toggleRowSelection(row) //鍗曞嚮琛屾椂閫変腑褰撳墠琛�; + }, + modelOpenAfter(row) { + + //鐐瑰嚮缂栬緫銆佹柊寤烘寜閽脊鍑烘鍚庯紝鍙互鍦ㄦ澶勫啓閫昏緫锛屽锛屼粠鍚庡彴鑾峰彇鏁版嵁 + //(1)鍒ゆ柇鏄紪杈戣繕鏄柊寤烘搷浣滐細 this.currentAction=='Add'; + //(2)缁欏脊鍑烘璁剧疆榛樿鍊� + //(3)this.editFormFields.瀛楁='xxx'; + //濡傛灉闇�瑕佺粰涓嬫媺妗嗚缃粯璁ゅ�硷紝璇烽亶鍘唗his.editFormOptions鎵惧埌瀛楁閰嶇疆瀵瑰簲data灞炴�х殑key鍊� + //鐪嬩笉鎳傚氨鎶婅緭鍑虹湅锛歝onsole.log(this.editFormOptions) + } + } +} +export default extension diff --git a/CodeManagement/WMS/WIDESEA_WMSClient/src/extension/widesea_wms/stock/Dt_OutTime.jsx b/CodeManagement/WMS/WIDESEA_WMSClient/src/extension/widesea_wms/stock/Dt_OutTime.jsx new file mode 100644 index 0000000..a301399 --- /dev/null +++ b/CodeManagement/WMS/WIDESEA_WMSClient/src/extension/widesea_wms/stock/Dt_OutTime.jsx @@ -0,0 +1,201 @@ +/***************************************************************************************** + ** Author:jxx 2022 + ** QQ:283591387 + **瀹屾暣鏂囨。瑙侊細http://v2.volcore.xyz/document/api 銆愪唬鐮佺敓鎴愰〉闈iewGrid銆� + **甯哥敤绀轰緥瑙侊細http://v2.volcore.xyz/document/vueDev + **鍚庡彴鎿嶄綔瑙侊細http://v2.volcore.xyz/document/netCoreDev + *****************************************************************************************/ +//姝s鏂囦欢鏄敤鏉ヨ嚜瀹氫箟鎵╁睍涓氬姟浠g爜锛屽彲浠ユ墿灞曚竴浜涜嚜瀹氫箟椤甸潰鎴栬�呴噸鏂伴厤缃敓鎴愮殑浠g爜 + +// import gridHeader from "./demo_Product/Dt_BillGroupStockDetail.vue"; +import gridBody from "./extend/SupplementationData.vue" +let extension = { + components: { + //鏌ヨ鐣岄潰鎵╁睍缁勪欢 + gridHeader: '', + gridBody: gridBody, + gridFooter: '', + //鏂板缓銆佺紪杈戝脊鍑烘鎵╁睍缁勪欢 + modelHeader: '', + modelBody: '', + modelFooter: '' + }, + tableAction: '', //鎸囧畾鏌愬紶琛ㄧ殑鏉冮檺(杩欓噷濉啓琛ㄥ悕,榛樿涓嶇敤濉啓) + buttons: { view: [], box: [], detail: [] }, //鎵╁睍鐨勬寜閽� + methods: { + //涓嬮潰杩欎簺鏂规硶鍙互淇濈暀涔熷彲浠ュ垹闄� + onInit() { + //妗嗘灦鍒濆鍖栭厤缃墠锛� + let OutBoundBtn = this.buttons.find((x) => x.value == 'OutBound') + if (OutBoundBtn) { + OutBoundBtn.onClick = function () { + // this.$Message.success('鐐瑰嚮浜嗘寜閽�') + let row = this.$refs.table.getSelected() //鑾峰彇閫変腑鐨勮 + if (row <= 0) { + //濡傛灉娌℃湁閫変腑琛� + this.$Message.error('璇烽�夋嫨涓�琛屾暟鎹�') + return + } + let locationCode = row[0].locationCode + let palletCode = row[0].palletCode + this.http + .get( + `/api/Task/CreateAndSendOutboundTask?locationCode=${locationCode}&palletCode=${palletCode}`, + {}, + '姝e湪鍒涘缓浠诲姟' + ) + .then((res) => { + //绀轰緥锛氳皟鐢ㄥ悗鍙版帴鍙� + if (res.status) { + this.$Message.success('鍒涘缓浠诲姟鎴愬姛') + console.log(res) + this.refresh() //鍒锋柊琛ㄦ牸 + } else { + this.$Message.error(res.message) //閿欒鎻愮ず + } + }) + } + } + + + var btnSupplementationData = this.buttons.find(x => x.value == "SupplementationData"); + if (btnSupplementationData != null) { + btnSupplementationData.onClick = () => { + let rows = this.$refs.table.getSelected(); + if (rows.length == 0) { + return this.$error("璇烽�夋嫨鏁版嵁!"); + } else if (rows.length > 1) { + return this.$error("鍙兘閫夋嫨鍗曟潯鏁版嵁"); + } + this.$refs.gridBody.open(rows[0].palletCode); + this.refresh(); + } + + } + //绀轰緥锛氬湪鎸夐挳鐨勬渶鍓嶉潰娣诲姞涓�涓寜閽� + // this.buttons.unshift({ + // //涔熷彲浠ョ敤push鎴栬�卻plice鏂规硶鏉ヤ慨鏀筨uttons鏁扮粍 + // name: '鐩存帴鍑哄簱', //鎸夐挳鍚嶇О + // icon: 'el-icon-document', //鎸夐挳鍥炬爣vue2鐗堟湰瑙乮view鏂囨。icon锛寁ue3鐗堟湰瑙乪lement ui鏂囨。icon(娉ㄦ剰涓嶆槸element puls鏂囨。) + // type: 'primary', //鎸夐挳鏍峰紡vue2鐗堟湰瑙乮view鏂囨。button锛寁ue3鐗堟湰瑙乪lement ui鏂囨。button + // onClick: function () { + // this.$Message.success('鐐瑰嚮浜嗘寜閽�') + // let row = this.$refs.table.getSelected() //鑾峰彇閫変腑鐨勮 + // if (row <= 0) { + // //濡傛灉娌℃湁閫変腑琛� + // this.$Message.error('璇烽�夋嫨涓�琛屾暟鎹�') + // return + // } + // let locationCode = row[0].locationCode + // let palletCode = row[0].palletCode + // this.http.get(`/api/Task/CreateAndSendOutboundTask?locationCode=${locationCode}&palletCode=${palletCode}`, {}, "姝e湪鍒涘缓浠诲姟").then((res) => { + // //绀轰緥锛氳皟鐢ㄥ悗鍙版帴鍙� + // if (res.status) { + // this.$Message.success('鍒涘缓浠诲姟鎴愬姛') + // } else { + // this.$Message.error(res.message) //閿欒鎻愮ず + // } + // }) + // } + // }) + + //绀轰緥锛氳缃慨鏀规柊寤恒�佺紪杈戝脊鍑烘瀛楁鏍囩鐨勯暱搴� + this.boxOptions.labelWidth = 150 + + // this.columns.push({ + // title: "鎿嶄綔", + // field: "鎿嶄綔", + // width: 150, + // align: "left", // 'center', + // render: (h, { row, column, index }) => { + // return ( + // <div> + // <el-button + // onClick={($e) => { + // this.$refs.gridHeader.openModel1(row); + // }} + // type="primary" + // plain + // style="height:26px; padding: 10px !important;" + // > + // 鏌ョ湅搴撳瓨鏄庣粏 + // </el-button> + // </div> + // ); + // }, + // }); + + this.columns.forEach((column) => { + //淇敼棰滆壊 + if (column.field == 'roadwayNo') { + column.formatter = (row) => { + // return '<span style="color: #2d8cf0;">' + row?.locationInfo?.roadwayNo + '</span>' + return row?.locationInfo?.roadwayNo + } + } + if (column.field == 'materielCode') { + column.formatter = (row) => { + // return '<span style="color: #2d8cf0;">' + row?.locationInfo?.roadwayNo + '</span>' + return row?.stockInfoDetails[0]?.materielCode + } + } + //鏍煎紡鍖栨棩鏈� + // 妫�鏌ュ綋鍓嶅垪鐨勫瓧娈垫槸鍚︿负 'locationStatus' + if (column.field == 'locationStatus') { + // 浣跨敤瀵硅薄瀛楅潰閲忔潵鏄犲皠 'locationStatus' 鐨勫�煎拰瀵瑰簲鐨勬枃鏈� + const statusMap = { + '-1': '鍏ㄩ儴', + '0': '绌洪棽', + '1': '閿佸畾', + '2': '鏈夎揣', + '3': '鏈夎揣绂佺敤', + '4': '鏃犺揣绂佺敤' + }; + // 瀹氫箟涓�涓牸寮忓寲鍑芥暟锛屾牴鎹� 'locationStatus' 鐨勫�艰繑鍥炵浉搴旂殑鏂囨湰 + column.formatter = (row) => { + // 浣跨敤 statusMap 瀵硅薄鏉ヨ幏鍙栧搴旂殑鏂囨湰锛屽鏋滄病鏈夊尮閰嶅垯杩斿洖 '鏈煡鐘舵��' + return statusMap[row?.locationInfo?.locationStatus] || '鏈煡鐘舵��'; + } + } + }) + }, + onInited() { + //妗嗘灦鍒濆鍖栭厤缃悗 + //濡傛灉瑕侀厤缃槑缁嗚〃,鍦ㄦ鏂规硶鎿嶄綔 + this.detailOptions.columns.forEach(column=>{ + console.log(column) + }); + }, + searchBefore(param) { + //鐣岄潰鏌ヨ鍓�,鍙互缁檖aram.wheres娣诲姞鏌ヨ鍙傛暟 + //杩斿洖false锛屽垯涓嶄細鎵ц鏌ヨ + return true + }, + searchAfter(result) { + console.log(result) + return true + }, + addBefore(formData) { + //鏂板缓淇濆瓨鍓峟ormData涓哄璞★紝鍖呮嫭鏄庣粏琛紝鍙互缁欑粰琛ㄥ崟璁剧疆鍊硷紝鑷繁杈撳嚭鐪媐ormData鐨勫�� + return true + }, + updateBefore(formData) { + //缂栬緫淇濆瓨鍓峟ormData涓哄璞★紝鍖呮嫭鏄庣粏琛ㄣ�佸垹闄よ鐨処d + return true + }, + rowClick({ row, column, event }) { + //鏌ヨ鐣岄潰鐐瑰嚮琛屼簨浠� + // this.$refs.table.$refs.table.toggleRowSelection(row) //鍗曞嚮琛屾椂閫変腑褰撳墠琛�; + }, + modelOpenAfter(row) { + + //鐐瑰嚮缂栬緫銆佹柊寤烘寜閽脊鍑烘鍚庯紝鍙互鍦ㄦ澶勫啓閫昏緫锛屽锛屼粠鍚庡彴鑾峰彇鏁版嵁 + //(1)鍒ゆ柇鏄紪杈戣繕鏄柊寤烘搷浣滐細 this.currentAction=='Add'; + //(2)缁欏脊鍑烘璁剧疆榛樿鍊� + //(3)this.editFormFields.瀛楁='xxx'; + //濡傛灉闇�瑕佺粰涓嬫媺妗嗚缃粯璁ゅ�硷紝璇烽亶鍘唗his.editFormOptions鎵惧埌瀛楁閰嶇疆瀵瑰簲data灞炴�х殑key鍊� + //鐪嬩笉鎳傚氨鎶婅緭鍑虹湅锛歝onsole.log(this.editFormOptions) + } + } +} +export default extension diff --git a/CodeManagement/WMS/WIDESEA_WMSClient/src/router/tables.js b/CodeManagement/WMS/WIDESEA_WMSClient/src/router/tables.js index 8167dd3..805cad8 100644 --- a/CodeManagement/WMS/WIDESEA_WMSClient/src/router/tables.js +++ b/CodeManagement/WMS/WIDESEA_WMSClient/src/router/tables.js @@ -260,6 +260,13 @@ meta: { keepAlive: false } + },{ + path: '/Dt_BillGroupStock_Hty', + name: 'Dt_BillGroupStock_Hty', + component: () => import('@/views/widesea_wms/stock/Dt_BillGroupStock_Hty.vue'), + meta: { + keepAlive: false + } }, ] export default tables diff --git a/CodeManagement/WMS/WIDESEA_WMSClient/src/views/widesea_wms/stock/Dt_BillGroupStock_Hty.vue b/CodeManagement/WMS/WIDESEA_WMSClient/src/views/widesea_wms/stock/Dt_BillGroupStock_Hty.vue new file mode 100644 index 0000000..6335fb4 --- /dev/null +++ b/CodeManagement/WMS/WIDESEA_WMSClient/src/views/widesea_wms/stock/Dt_BillGroupStock_Hty.vue @@ -0,0 +1,93 @@ +<!-- +*Author锛歫xx + *Contact锛�283591387@qq.com + *浠g爜鐢辨鏋剁敓鎴�,浠讳綍鏇存敼閮藉彲鑳藉鑷磋浠g爜鐢熸垚鍣ㄨ鐩� + *涓氬姟璇峰湪@/extension/widesea_wms/stock/Dt_BillGroupStock.js姝ゅ缂栧啓 + --> + +<template> + <view-grid ref="grid" :columns="columns" :detail="detail" :editFormFields="editFormFields" + :editFormOptions="editFormOptions" :searchFormFields="searchFormFields" :searchFormOptions="searchFormOptions" + :table="table" :extend="extend"> + </view-grid> +</template> +<script> +import extend from "@/extension/widesea_wms/stock/Dt_BillGroupStock_Hty.jsx"; +import { ref, defineComponent } from "vue"; +export default defineComponent({ + setup() { + const table = ref({ + key: 'id', + footer: "Foots", + cnName: '搴撳瓨鍘嗗彶淇℃伅', + name: 'stock/Dt_BillGroupStock_Hty', + url: "/StockInfoHty/", + sortName: "createDate" + }); + const editFormFields = ref({ + "palletCode": "", + "productionLine": "", + "outboundTime": "", + // "groupType": "" + }); + const editFormOptions = ref([ + [ + { "title": "鎵樼洏鏉$爜", "field": "palletCode", type: "text" }, + { "title": "鐢熶骇浜х嚎", "field": "productionLine", type: "text" }, + { "title": "搴斿嚭搴撴椂闂�", "field": "outboundTime", type: "datetime" }, + // { "title": "缁勭洏绫诲瀷", "field": "groupType", type: "select", dataKey: "GroupType", data: [] }, + ] + ]); + const searchFormFields = ref({}); + const searchFormOptions = ref([ + [ + { "title": "鎵樼洏鏉$爜", "field": "palletCode", type: "text" }, + { "title": "鐢熶骇浜х嚎", "field": "productionLine", type: "select", dataKey: "ProductionLine", data: [] }, + { "title": "搴撳尯", "field": "areaCode", type: "select", dataKey: "AreaType", data: [] }, + { "title": "搴撳瓨绫诲瀷", "field": "isFull", type: "select", dataKey: "isFull", data: [] }, + ], [ + { "title": "搴撲綅鍙�", "field": "locationCode", type: "text" }, + { "title": "宸烽亾", "field": "roadwayNo", type: "text" }, + { "title": "鐗╂枡缂栫爜", "field": "materielCode", type: "text"}, + ] + ]); + const columns = ref( + [{ field: 'id', title: '搴撳瓨ID', type: 'int', width: 110, hidden: true, readonly: true, require: true, align: 'left' }, + { field: 'locationCode', title: '搴撲綅', type: 'string', width: 100, align: 'left', }, + { field: 'palletCode', title: '鎵樼洏鏉$爜', type: 'string', width: 110, align: 'left', }, + { field: 'isFull', title: '搴撳瓨绫诲瀷', type: 'bool', width: 60, align: 'left', bind: { key: "isFull", data: [{ key: false, value: '绌虹洏' }, { key: true, value: '瀹炵洏' }] }, }, + { field: 'linedProcessFeedbackTime', title: '宸ヨ壓寮�濮嬫椂闂�', type: 'string', width: 110, align: 'left', }, + { field: 'roadwayNo', title: '宸烽亾', type: 'string', width: 60, align: 'left', sort: true }, + { field: 'materielCode', title: '鐗╂枡缂栫爜', type: 'string', width: 90, align: 'left', sort: true }, + // { field: 'locationStatus', title: '璐т綅鐘舵��', type: 'int', width: 60, align: 'left', bind: { key: "LocationState", data: [] } }, + { field: 'specialParameterDuration', title: '宸ヨ壓鏃堕暱', type: 'string', width: 60, align: 'left', sort: true }, + { field: 'outboundTime', title: '搴斿嚭搴撴椂闂�', type: 'string', width: 110, align: 'left', sort: true }, + { field: 'productionLine', title: '鐢熶骇浜х嚎', type: 'string', width: 60, align: 'left', bind: { key: "ProductionLine", data: [] } }, + { field: 'areaCode', title: '搴撳尯', type: 'string', width: 60, align: 'left', bind: { key: "AreaType", data: [] } }, + { field: 'remark', title: '鐢佃姱鏁伴噺', type: 'string', width: 60, align: 'left', }, + { field: 'creater', title: '鍒涘缓浜�', type: 'string', sort: true, width: 110, align: 'left', hidden: true }, + { field: 'createDate', title: '鍒涘缓鏃堕棿', type: 'datetime', sort: true, width: 150, align: 'left', }, + { field: 'modifier', title: '鏈�鍚庝慨鏀逛汉', type: 'string', sort: true, width: 100, hidden: true, align: 'left' }, + // { field: 'modifyDate', title: '鏈�鍚庝慨鏀规椂闂�', type: 'datetime', sort: true, width: 150, align: 'left', sort: true }, + ] + ); + const detail = ref({ + cnName: "#detailCnName", + table: "#detailTable", + columns: [], + sortName: "", + key: "" + }); + return { + table, + extend, + editFormFields, + editFormOptions, + searchFormFields, + searchFormOptions, + columns, + detail, + }; + }, +}); +</script> diff --git a/CodeManagement/WMS/WIDESEA_WMSClient/src/views/widesea_wms/stock/Dt_OutTime.vue b/CodeManagement/WMS/WIDESEA_WMSClient/src/views/widesea_wms/stock/Dt_OutTime.vue index 7cf35e1..000f539 100644 --- a/CodeManagement/WMS/WIDESEA_WMSClient/src/views/widesea_wms/stock/Dt_OutTime.vue +++ b/CodeManagement/WMS/WIDESEA_WMSClient/src/views/widesea_wms/stock/Dt_OutTime.vue @@ -7,21 +7,21 @@ <template> <view-grid ref="grid" :columns="columns" :detail="detail" :editFormFields="editFormFields" - :editFormOptions="editFormOptions" :searchFormFields="searchFormFields" + :editFormOptions="editFormOptions" :searchFormFields="searchFormFields" :searchFormOptions="searchFormOptions" :table="table" :extend="extend"> </view-grid> </template> <script> -import extend from "@/extension/widesea_wms/stock/Dt_BillGroupStock.jsx"; +import extend from "@/extension/widesea_wms/stock/Dt_OutTime.jsx"; import { ref, defineComponent } from "vue"; export default defineComponent({ setup() { const table = ref({ key: 'id', footer: "Foots", - cnName: '瓒呮椂淇℃伅', - name: 'stock/Dt_BillGroupStock', - url:"/StockInfoTimeout/", + cnName: '瓒呮椂搴撳瓨淇℃伅', + name: 'stock/StockInfoTimeout', + url: "/StockInfo/", sortName: "createDate" }); const editFormFields = ref({ @@ -49,18 +49,18 @@ { "title": "搴撲綅鍙�", "field": "locationCode", type: "text" }, { "title": "宸烽亾", "field": "roadwayNo", type: "text" }, { "title": "璐т綅鐘舵��", "field": "locationStatus", type: "select", dataKey: "LocationState", data: [] }, - { "title": "鍑哄簱鏃堕棿", "field": "outboundTime", type: "datetime"}, + { "title": "鐗╂枡缂栫爜", "field": "materielCode", type: "text"}, ] ]); - const now = new Date(); - // 鐩存帴鍑忓幓 3 灏忔椂锛堝彲鑳借法澶╋紝Date 瀵硅薄浼氳嚜鍔ㄥ鐞嗭級 - now.setHours(now.getHours() - 3); const columns = ref( [{ field: 'id', title: '搴撳瓨ID', type: 'int', width: 110, hidden: true, readonly: true, require: true, align: 'left' }, { field: 'locationCode', title: '搴撲綅', type: 'string', width: 100, align: 'left', }, { field: 'palletCode', title: '鎵樼洏鏉$爜', type: 'string', width: 110, align: 'left', }, - { field: 'isFull', title: '搴撳瓨绫诲瀷', type: 'bool', width: 80, align: 'left', bind: { key: "isFull", data: [{ key: false, value: '绌虹洏' }, { key: true, value: '瀹炵洏' }] }, }, + { field: 'isFull', title: '搴撳瓨绫诲瀷', type: 'bool', width: 60, align: 'left', bind: { key: "isFull", data: [{ key: false, value: '绌虹洏' }, { key: true, value: '瀹炵洏' }] }, }, { field: 'linedProcessFeedbackTime', title: '宸ヨ壓寮�濮嬫椂闂�', type: 'string', width: 110, align: 'left', }, + { field: 'roadwayNo', title: '宸烽亾', type: 'string', width: 60, align: 'left', sort: true }, + { field: 'materielCode', title: '鐗╂枡缂栫爜', type: 'string', width: 90, align: 'left', sort: true }, + { field: 'locationStatus', title: '璐т綅鐘舵��', type: 'int', width: 60, align: 'left', bind: { key: "LocationState", data: [] } }, { field: 'specialParameterDuration', title: '宸ヨ壓鏃堕暱', type: 'string', width: 60, align: 'left', sort: true }, { field: 'outboundTime', title: '搴斿嚭搴撴椂闂�', type: 'string', width: 110, align: 'left', sort: true }, { field: 'productionLine', title: '鐢熶骇浜х嚎', type: 'string', width: 60, align: 'left', bind: { key: "ProductionLine", data: [] } }, @@ -72,7 +72,6 @@ // { field: 'modifyDate', title: '鏈�鍚庝慨鏀规椂闂�', type: 'datetime', sort: true, width: 150, align: 'left', sort: true }, ] ); - const detail = ref({ cnName: "#detailCnName", table: "#detailTable", diff --git a/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_IStorageBasicRepository/Stock/IStockInfoHtyRepository.cs b/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_IStorageBasicRepository/Stock/IStockInfoHtyRepository.cs new file mode 100644 index 0000000..2beb08b --- /dev/null +++ b/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_IStorageBasicRepository/Stock/IStockInfoHtyRepository.cs @@ -0,0 +1,6 @@ +锘縩amespace WIDESEA_IStorageBasicRepository +{ + public interface IStockInfoHtyRepository : IRepository<DtStockInfo_Hty> + { + } +} \ No newline at end of file diff --git a/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_IStorageBasicService/Stock/IStockInfoHtyvice.cs b/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_IStorageBasicService/Stock/IStockInfoHtyvice.cs new file mode 100644 index 0000000..8837b61 --- /dev/null +++ b/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_IStorageBasicService/Stock/IStockInfoHtyvice.cs @@ -0,0 +1,5 @@ +锘縩amespace WIDESEA_IStorageBasicService; + +public interface IStockInfoHtyService : IService<DtStockInfo_Hty> +{ +} \ No newline at end of file diff --git a/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicRepository/Stock/StockInfoHtyRepository.cs b/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicRepository/Stock/StockInfoHtyRepository.cs new file mode 100644 index 0000000..e16d05a --- /dev/null +++ b/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicRepository/Stock/StockInfoHtyRepository.cs @@ -0,0 +1,9 @@ +锘縩amespace WIDESEA_StorageBasicRepository +{ + public class StockInfoHtyRepository : RepositoryBase<DtStockInfo_Hty>, IStockInfoHtyRepository + { + public StockInfoHtyRepository(IUnitOfWorkManage unitOfWorkManage) : base(unitOfWorkManage) + { + } + } +} \ No newline at end of file diff --git a/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Stock/StockInfoHtyService.cs b/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Stock/StockInfoHtyService.cs new file mode 100644 index 0000000..d234d42 --- /dev/null +++ b/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Stock/StockInfoHtyService.cs @@ -0,0 +1,158 @@ +锘縰sing AngleSharp.Dom; +using Mapster; +using Masuit.Tools; +using SqlSugar; +using System.Collections; +using System.Collections.Generic; +using System.Drawing.Printing; +using System.Linq.Expressions; +using System.Threading.Tasks; +using WIDESEA_Cache; +using WIDESEA_Common; +using WIDESEA_Core; + +namespace WIDESEA_StorageBasicService; + +public class StockInfoHtyService : ServiceBase<DtStockInfo_Hty, IStockInfoHtyRepository>, IStockInfoHtyService +{ + + private readonly ISimpleCacheService _simpleCacheService; + private readonly ILocationStatusChangeRecordRepository _locationStatusChangeRecordRepository; + public StockInfoHtyService(IStockInfoHtyRepository BaseDal, ISimpleCacheService simpleCacheService, ILocationStatusChangeRecordRepository locationStatusChangeRecordRepository) : base(BaseDal) + { + _simpleCacheService = simpleCacheService; + _locationStatusChangeRecordRepository = locationStatusChangeRecordRepository; + } + + /// <summary> + /// 鍒嗛〉 + /// </summary> + /// <param name="options"></param> + /// <returns></returns> + public override PageGridData<DtStockInfo_Hty> GetPageData(PageDataOptions options) + { + string wheres = ValidatePageOptions(options); + //鑾峰彇鎺掑簭瀛楁 + Dictionary<string, SqlSugar.OrderByType> orderbyDic = GetPageDataSort(options, TProperties); + List<OrderByModel> orderByModels = new List<OrderByModel>(); + foreach (var item in orderbyDic) + { + OrderByModel orderByModel = new() + { + FieldName = item.Key, + OrderByType = item.Value + }; + orderByModels.Add(orderByModel); + } + + + int totalCount = 0; + List<SearchParameters> searchParametersList = new List<SearchParameters>(); + if (!string.IsNullOrEmpty(options.Wheres)) + { + try + { + searchParametersList = options.Wheres.DeserializeObject<List<SearchParameters>>(); + options.Filter = searchParametersList; + } + catch { } + } + + Expression<Func<DtStockInfo_Hty, bool>> locationStatus = null; + Expression<Func<DtStockInfo_Hty, bool>> roadwayNo = null; + Expression<Func<DtStockInfo_Hty, bool>> materielCode = null; + foreach (var item in searchParametersList) + { + if (item.Name.Contains("locationStatus")) + { + locationStatus = x => x.LocationInfo.LocationStatus == Convert.ToInt32(item.Value); + } + else if (item.Name.Contains("roadwayNo")) + { + roadwayNo = x => x.LocationInfo.RoadwayNo.Contains(item.Value); + } + else if (item.Name.Contains("materielCode")) + { + materielCode = x => x.StockInfoDetails.Any(d => d.MaterielCode.Contains(item.Value)); + } + } + //.IncludesAllFirstLayer() + var data = BaseDal.Db.Queryable<DtStockInfo_Hty>() + .Includes(x => x.StockInfoDetails) + .Includes(x => x.LocationInfo) + .WhereIF(!wheres.IsNullOrEmpty(), wheres) + .WhereIF(locationStatus != null, locationStatus) + .WhereIF(roadwayNo != null, roadwayNo) + .WhereIF(materielCode != null, materielCode) + .OrderBy(orderByModels) + .ToPageList(options.Page, options.Rows, ref totalCount); + return new PageGridData<DtStockInfo_Hty>(totalCount, data); + } + + /// <summary> + /// 鎵归噺鍒犻櫎 + /// </summary> + /// <param name="keys"></param> + /// <returns></returns> + public override WebResponseContent DeleteData(object[] keys) + { + try + { + List<DtStockInfo_Hty> stockInfos = new List<DtStockInfo_Hty>(); + List<DtLocationInfo> locationInfos = new List<DtLocationInfo>(); + + + var stocks = new List<string>(); + + foreach (var item in keys) + { + var stock = BaseDal.QueryFirstNavAsync(x => x.Id == item.ObjToInt()).Result; + var stockHty = stock.Adapt<DtStockInfo_Hty>(); + stockInfos.Add(stockHty); + + var location = SqlSugarHelper.DbWMS.Queryable<DtLocationInfo>().FirstAsync(x => x.Id == stock.LocationId).Result; + var lastStatus = location.LocationStatus; + location.LocationStatus = (int)LocationEnum.Free; + locationInfos.Add(location); + stocks.Add(stock.PalletCode); + _locationStatusChangeRecordRepository.AddLocationStatusChangeRecord(location, lastStatus, (int)StatusChangeTypeEnum.ManualOperation, 0); + } + + //_simpleCacheService.HashDel<DtStockInfo>(CacheConst.Cache_DtStockInfo, stocks.ToArray()); + //var hty = BaseDal.Db.InsertNav(stockInfos) + // .Include(x => x.StockInfoDetails) + // .ExecuteCommand(); + + //var locationd = SqlSugarHelper.DbWMS.Updateable(locationInfos).ExecuteCommandHasChange(); + //return base.DeleteData(keys); + + var hty = BaseDal.Db.InsertNav(stockInfos) + .Include(x => x.StockInfoDetails) + .ExecuteCommand(); + + var locationd = SqlSugarHelper.DbWMS.Updateable(locationInfos).ExecuteCommandHasChange(); + return base.DeleteData(keys); + } + catch (Exception ex) + { + return WebResponseContent.Instance.Error(ex.Message); + } + } + + // 鏍规嵁浼犲叆搴撳瓨绫诲瀷鑾峰彇涓嶅悓宸烽亾鐨勫簱瀛� + public async Task<Dictionary<string, int>> GetLocationByStockType(bool stockType, string areaCode) + { + var stockInfos = await BaseDal.Db.Queryable<DtStockInfo>().Where(x => x.IsFull == stockType && x.AreaCode == areaCode) + .Includes(x => x.LocationInfo).ToListAsync(); + + var result = stockInfos + .GroupBy(x => x.LocationInfo.RoadwayNo) + .ToDictionary(x => x.Key, x => x.Count()); + return result; + } + + //public override WebResponseContent UpdateData(DtStockInfo entity) + //{ + // return base.UpdateData(entity); + //} +} \ No newline at end of file diff --git a/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/StockInfoHtyController.cs b/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/StockInfoHtyController.cs new file mode 100644 index 0000000..3696c9c --- /dev/null +++ b/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/StockInfoHtyController.cs @@ -0,0 +1,12 @@ +锘縰sing WIDESEA_IStorageBasicService; + +namespace WIDESEA_WMSServer.Controllers; + +[Route("api/StockInfoHty")] +[ApiController] +public class StockInfoHtyController : ApiBaseController<IStockInfoHtyService, DtStockInfo_Hty> +{ + public StockInfoHtyController(IStockInfoHtyService service) : base(service) + { + } +} \ No newline at end of file -- Gitblit v1.9.3