diff --git a/HHWMS.Web/Areas/Inventory/Controllers/InventoryController.cs b/HHWMS.Web/Areas/Inventory/Controllers/InventoryController.cs index a707dc7..576ac5c 100644 --- a/HHWMS.Web/Areas/Inventory/Controllers/InventoryController.cs +++ b/HHWMS.Web/Areas/Inventory/Controllers/InventoryController.cs @@ -247,7 +247,8 @@ namespace HHWMS.Web.Controllers ERPSN = qr, WMSSN = inv?.UniqueCode, QTY = ((int?)inv?.Qty).ToString(), - TYPE = "2" + TYPE = "2", + FLAG = "1" } } } diff --git a/HHWMS.Web/Areas/Receipt/Controllers/ReceiptDetailController.cs b/HHWMS.Web/Areas/Receipt/Controllers/ReceiptDetailController.cs index fd74eee..e5a4027 100644 --- a/HHWMS.Web/Areas/Receipt/Controllers/ReceiptDetailController.cs +++ b/HHWMS.Web/Areas/Receipt/Controllers/ReceiptDetailController.cs @@ -167,6 +167,16 @@ namespace HHWMS.Web.Controllers { return FFResult().Alert("新增明细中,存在重复的唯一码!"); } + + // 判断唯一码是否已在库内 + var reDetailList = _unitwork.Find(x => 1 == 1) + .Select(x => x.UniqueCode) + .ToList(); + if (reDetailList.Intersect(detailList.Select(x => x.UniqueCode)).Count() > 0) + { + return FFResult().Alert("新增明细中,存在已添加的唯一码!"); + } + // 判断唯一码是否已在库内 var invList = _unitwork.Find(x => 1 == 1) .Select(x => x.UniqueCode) diff --git a/HHWMS.Web/Areas/Receipt/Views/ReceiptSLIn/Index.cshtml b/HHWMS.Web/Areas/Receipt/Views/ReceiptSLIn/Index.cshtml index c570da4..d774ea0 100644 --- a/HHWMS.Web/Areas/Receipt/Views/ReceiptSLIn/Index.cshtml +++ b/HHWMS.Web/Areas/Receipt/Views/ReceiptSLIn/Index.cshtml @@ -80,7 +80,7 @@ 绑定 重置 - 回库 + 回库 @@ -127,33 +127,45 @@ // 呼叫料箱 callBox() { var _this = this; - $.ajax({ - type: "post", - dataType: "json", - data: {}, - url: "/receipt/ReceiptSLIn/CallBox", - success: function (json) { - if (json.Code == 200) { + this.$confirm('确定要呼叫料盒出库?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + $.ajax({ + type: "post", + dataType: "json", + data: {}, + url: "/receipt/ReceiptSLIn/CallBox", + success: function (json) { + if (json.Code == 200) { + _this.$message({ + message: "呼叫成功!", + }); + // _this.resetForm('form'); + } else { + _this.$message({ + message: "呼叫失败!" + json.Msg, + type: "warning", + duration: "10000", + }); + } + }, + error: function (json) { _this.$message({ - message: "呼叫成功!", - }); - // _this.resetForm('form'); - } else { - _this.$message({ - message: "呼叫失败!" + json.Msg, - type: "warning", + message: "呼叫失败!", + type: "error", duration: "10000", }); - } - }, - error: function (json) { - _this.$message({ - message: "呼叫失败!", - type: "error", - duration: "10000", - }); - }, + }, + }); + }).catch(() => { + this.$message({ + type: 'info', + message: '已取消' + }); }); + }, // 扫描散料箱 scanBox(data) { @@ -312,7 +324,7 @@ back() { var _this = this; // 创建回库任务 - if (_this.code == "") { + if (_this.form.code == "") { _this.$message({ message: "箱号为空,不能创建回库任务!", type: "error", @@ -320,32 +332,43 @@ }); return; } - $.ajax({ - type: "post", - dataType: "json", - data: { boxCode: _this.form.code, isFull: _this.form.isFull }, - url: "/receipt/ReceiptSLIn/BoxBack", - success: function (json) { - if (json.Code != 200) { + this.$confirm('确定执行回库动作?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + $.ajax({ + type: "post", + dataType: "json", + data: { boxCode: _this.form.code, isFull: _this.form.isFull }, + url: "/receipt/ReceiptSLIn/BoxBack", + success: function (json) { + if (json.Code != 200) { + _this.$message({ + message: "回库任务创建失败!" + json.Msg, + type: "warning", + duration: "10000", + }); + } else { + _this.$message({ + message: "回库任务创建成功!" + }); + _this.resetForm('form'); + } + }, + error: function (json) { _this.$message({ - message: "回库任务创建失败!" + json.Msg, - type: "warning", + message: "回库任务创建失败!", + type: "error", duration: "10000", }); - } else { - _this.$message({ - message: "回库任务创建成功!" - }); - _this.resetForm('form'); - } - }, - error: function (json) { - _this.$message({ - message: "回库任务创建失败!", - type: "error", - duration: "10000", - }); - }, + }, + }); + }).catch(() => { + this.$message({ + type: 'info', + message: '已取消' + }); }); } }, diff --git a/HHWMS.Web/Areas/Shipment/Views/ShipOut/Index.cshtml b/HHWMS.Web/Areas/Shipment/Views/ShipOut/Index.cshtml index 401d8d1..2db2fa8 100644 --- a/HHWMS.Web/Areas/Shipment/Views/ShipOut/Index.cshtml +++ b/HHWMS.Web/Areas/Shipment/Views/ShipOut/Index.cshtml @@ -26,7 +26,7 @@ - @@ -62,15 +62,10 @@ + 拣货 - - - - - - - 回库 + 回库 @@ -114,10 +109,6 @@ select(data) { this.form.code = ""; this.form.type = data; - if (data == "slbox") - this.showBack = true; - else - this.showBack = fasle; }, // 扫描料塔站台号 scanCode(data) { @@ -193,6 +184,9 @@ arr.splice(index, 1); } }); + if (_this.invTable.length == 0 && _this.form.type == "slbox") { + _this.showBack = true; + } _this.$refs['form'].resetFields(); } else { _this.$message({ @@ -223,32 +217,43 @@ }); return; } - $.ajax({ - type: "post", - dataType: "json", - data: { boxCode: _this.form.code, isFull: _this.form.isFull }, - url: "/shipment/ShipOut/BoxBack", - success: function (json) { - if (json.Code != 200) { + this.$confirm('确定执行回库动作?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + $.ajax({ + type: "post", + dataType: "json", + data: { boxCode: _this.form.code, isFull: _this.form.isFull }, + url: "/shipment/ShipOut/BoxBack", + success: function (json) { + if (json.Code != 200) { + _this.$message({ + message: "回库任务创建失败!" + json.Msg, + type: "warning", + duration: "10000", + }); + } else { + _this.$message({ + message: "回库任务创建成功!" + }); + _this.resetForm('form'); + } + }, + error: function (json) { _this.$message({ - message: "回库任务创建失败!" + json.Msg, - type: "warning", + message: "回库任务创建失败!", + type: "error", duration: "10000", }); - } else { - _this.$message({ - message: "回库任务创建成功!" - }); - _this.resetForm('form'); - } - }, - error: function (json) { - _this.$message({ - message: "回库任务创建失败!", - type: "error", - duration: "10000", - }); - }, + }, + }); + }).catch(() => { + this.$message({ + type: 'info', + message: '已取消' + }); }); } }, diff --git a/HHWMS.Web/Areas/System/Controllers/jobs/InvBackJob.cs b/HHWMS.Web/Areas/System/Controllers/jobs/InvBackJob.cs index 0797f8a..53a6cef 100644 --- a/HHWMS.Web/Areas/System/Controllers/jobs/InvBackJob.cs +++ b/HHWMS.Web/Areas/System/Controllers/jobs/InvBackJob.cs @@ -53,7 +53,8 @@ namespace HHWMS.Web ERPSN = qr, WMSSN = inv?.UniqueCode, QTY = ((int?)inv?.Qty).ToString(), - TYPE = "2" + TYPE = "2", + FLAG = "1" }); } var str = JsonConvert.SerializeObject(bizData); diff --git a/HHWMS.Web/MESToWMSService/WmsMesService.cs b/HHWMS.Web/MESToWMSService/WmsMesService.cs index 2caaf4b..0c6615d 100644 --- a/HHWMS.Web/MESToWMSService/WmsMesService.cs +++ b/HHWMS.Web/MESToWMSService/WmsMesService.cs @@ -78,27 +78,37 @@ namespace MESTOWMSService foreach(var item in data.OUTWMS.OUTITEM) { var materialqr = _unitwork.FindSingle(x => x.UniqueCode.Equals(item.SN)); - var material = _unitwork.FindSingle(x => x.QRCode.Equals(materialqr.QRCode)); - - var detail = new ShipmentDetail + if (materialqr != null) { - UniqueCode = item.SN, - MaterialCode = material?.MaterialCode, - MaterialName = material?.MaterialName, - MaterialSpec = material?.MaterialSpec, - MaterialType = material?.MaterialType, - MaterialUnit = material?.MaterialUnit, - Batch = material?.Batch, - DividedQty = 0, - Qty = material?.Qty, - CompanyCode = item?.FACTORY, - ManufactureDate = Convert.ToDateTime(item.MESDATE), - Status = ShipStatusEnum.新建, - CreateTime = DateTime.Now - }; - shipment.ShipmentDetails.Add(detail); + var material = _unitwork.FindSingle(x => x.QRCode.Equals(materialqr.QRCode)); + + var detail = new ShipmentDetail + { + UniqueCode = item.SN, + MaterialCode = material?.MaterialCode, + MaterialName = material?.MaterialName, + MaterialSpec = material?.MaterialSpec, + MaterialType = material?.MaterialType, + MaterialUnit = material?.MaterialUnit, + Batch = material?.Batch, + DividedQty = 0, + Qty = material?.Qty, + CompanyCode = item?.FACTORY, + ManufactureDate = Convert.ToDateTime(item.MESDATE), + Status = ShipStatusEnum.新建, + CreateTime = DateTime.Now + }; + shipment.ShipmentDetails.Add(detail); + } + else + { + return new Result { Status = "N", Message = $"物料不存在库内!" }; + } + } + if(shipment.ShipmentDetails.Count > 0) + { + _unitwork.Add(shipment); } - _unitwork.Add(shipment); return new Result(); } catch (Exception ex) diff --git a/HHWMS.Web/Models/Request/Request/RequestMes.cs b/HHWMS.Web/Models/Request/Request/RequestMes.cs index 0cc989d..6fa0710 100644 --- a/HHWMS.Web/Models/Request/Request/RequestMes.cs +++ b/HHWMS.Web/Models/Request/Request/RequestMes.cs @@ -166,6 +166,7 @@ namespace HHWMS.Web /// /// public string WMSSN { get; set; } + public string FLAG { get; set; } } public class INITEMS