From aec8fb5f857231f10dc4a58fc86ecdac2b5d6250 Mon Sep 17 00:00:00 2001 From: chengsc <11752@DESKTOP-DS49RCP> Date: 星期三, 25 六月 2025 12:16:30 +0800 Subject: [PATCH] 添加拆托功能 --- Pda/View/HouseDataSetting/SkuDismantling.html | 250 ++-------------- Wms/Wms/Controllers/UpApiController.cs | 213 ++++++++++--- Wms/Wms/Controllers/PdaCrController.cs | 85 +++++ Wms/Model/ModelVm/PdaVm/PdaCrVm.cs | 10 Wms/Model/ModelDto/PdaDto/PdaCheckDto.cs | 8 Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs | 277 ++++++++++++++++++ Wms/WMS.IBLL/IPdaServer/IPdaCrServer.cs | 11 7 files changed, 583 insertions(+), 271 deletions(-) diff --git a/Pda/View/HouseDataSetting/SkuDismantling.html b/Pda/View/HouseDataSetting/SkuDismantling.html index 9905e2c..a45e59e 100644 --- a/Pda/View/HouseDataSetting/SkuDismantling.html +++ b/Pda/View/HouseDataSetting/SkuDismantling.html @@ -378,7 +378,7 @@ synData(IP + "/PdaCr/GetBoxInfo", param, 'post', function (res) { if (res.code == 0) { //鎴愬姛 - $("#boxNo").focus();//鍏夋爣榛樿閫変腑 + $("#palletNo3").focus();//鍏夋爣榛樿閫変腑 } else { //涓嶆垚鍔� layer.msg(res.msg, { icon: 2, @@ -431,14 +431,7 @@ time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 }); return; } - if ($('#boxQty').val() == "") { - layer.msg("绠卞唴鏁伴噺涓虹┖锛屼笉鑳芥嫞璐�", { - icon: 2, - time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }); - return; - } - + } @@ -463,9 +456,8 @@ "BoxNo": $('#boxNo').val(), "palletNoNew": $('#palletNo3').val(), } - sendData(IP + "/PdaSo/SoSetPinPick", param, 'post', function (res) { - //console.log(res); - + sendData(IP + "/PdaCr/UpPalletByBox", param, 'post', function (res) { + if (res.code == 0) { //鎴愬姛 layer.msg(res.msg, { icon: 1, @@ -509,29 +501,14 @@ //鏁伴噺鏍囩------------------------------------------------------------------------------- - function clear21() { - $('#outModel2').val("");//鍑哄簱鍙� - $('#standard2').val("");//瑙勬牸 - - $('#pickQty2').val("");//寰呮嫞鏁伴噺 - $('#pickedQty2').val("");//宸叉嫞鏁伴噺 - } + function clear22() { //鐗╂枡鎵规 $("#skuLotNo2").empty() $("#skuLotNo2").append('<option value =>' + '</option>'); form.render('select'); } - function clear23() { - $("#planQty2").val(""); //璁″垝鏁伴噺 - $("#finishQty2").val("");//瀹屾垚鏁伴噺 - } - function clear24() { - $('#boxNo2').val("");//绠辩爜 - $('#boxQty2').val("");//绠卞唴鏁伴噺 - } - - + //褰撴墭鐩樻潯鐮佽緭鍏ユ鏂囨湰鏀瑰彉鏃�,妫�鏌ヤ竴涓嬫墭鐩樼姸鎬� $("#palletNo2").on('input', function () { if ($("#palletNo2").val() == "" || $("#palletNo2").val().length < 8) { @@ -542,61 +519,21 @@ } checkPalletState2() }) - //妫�鏌ユ墭鐩樼姸鎬� + + //妫�鏌ユ墭鐩樼姸鎬� function checkPalletState2() { var param = { "PalletNo": $("#palletNo2").val() } synData(IP + "/PdaSo/IsEnableOkPalletNo", param, 'post', function (res) { if (res.code == 0) { //鎴愬姛 - updateBillList2(); - console.log($('#bar2').val()) - if ($('#bar2').val() == "") { - console.log(1) - clear21(); - return; - } else { - console.log(2) - updateSkuLotNoList2(); - updateQtyList2(); - getBar2(); - // GetDataInfo(); - } - + $("#palletNo4").focus(); + updateSkuLotNoList2(); } else { //涓嶆垚鍔� layer.msg(res.msg, { icon: 2, time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 }, function () { }); - } - }); - } - //鍒濆鍖栨覆鏌� 鍑哄簱鍗� - function updateBillList2() { - $("#bar2").empty() - $("#bar2").append('<option value =>' + '</option>'); - form.render('select'); - - var param = { - PalletNo: $("#palletNo2").val(), - }; - synData(IP + "/PdaSo/GetRunSoNoticeList", param, 'post', function (res) { - if (res.code == 0) { //鎴愬姛 - console.log(res.data); - for (var i = 0; i < res.data.length; i++) { - if (i == 0) { - $("#bar2").append('<option value =' + res.data[i] + ' selected>' + res.data[i] + '</option>'); - } else { - $("#bar2").append('<option value =' + res.data[i] + '>' + res.data[i] + '</option>'); - } - } - form.render('select'); - - } else { //涓嶆垚鍔� - layer.msg(res.msg, { - icon: 2, - time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }); } }); } @@ -606,26 +543,27 @@ clear22(); var param = { PalletNo: $("#palletNo2").val(), - SoNo: $("#bar2").val(), }; - synData(IP + "/PdaSo/GetSoSkuLotNoListByPallet", param, 'post', function (res) { + synData(IP + "/PdaCr/GetSelectSkuLotNo", param, 'post', function (res) { console.log(res); if (res.code == 0) { //鎴愬姛 for (var i = 0; i < res.data.length; i++) { if (i == 0) { - $("#skuLotNo2").append('<option value =' + res.data[i].SoDetailId + ' selected>' + res.data[i].SkuName); - if (res.data[i].LotNo != null) { - $("#skuLotNo2").append(" - " + res.data[i].LotNo); - } - $("#skuLotNo2").append('</option>'); - + $("#skuLotNo2").append('<option value =' + res.data[i].DetailId + ' selected>' + res.data[i].SkuName+' - ' + res.data[i].LotNo+'</option>'); + //$("#skuLotNo2").append(' - ' + res.data[i].LotNo+'</option>'); + // if (res.data[i].LotNo != null) { + // console.log(res.data[i].LotNo); + + // $("#skuLotNo2").append(' - ' + res.data[i].LotNo); + // } + //$("#skuLotNo2").append('</option>'); } else { - $("#skuLotNo2").append('<option value =' + res.data[i].SoDetailId + '>' + res.data[i].SkuName); - if (res.data[i].LotNo != null) { - $("#skuLotNo2").append(" - " + res.data[i].LotNo); - } - $("#skuLotNo2").append('</option>'); + $("#skuLotNo2").append('<option value =' + res.data[i].DetailId + '>' + res.data[i].SkuName+' - ' + res.data[i].LotNo+'</option>'); + // if (res.data[i].LotNo != null) { + // $("#skuLotNo2").append(' - ' + res.data[i].LotNo); + // } + // $("#skuLotNo2").append('</option>'); } } form.render('select'); @@ -639,130 +577,10 @@ }); } - //鍒濆鍖栨覆鍗曟嵁鐨勮鍒掓暟閲忓拰瀹屾垚鏁伴噺 - function updateQtyList2() { - clear23(); - console.log("AA"); - var param = { - SoDetailId: $("#skuLotNo2").val(), - }; - synData(IP + "/PdaSo/GetPlanAndFinishQty", param, 'post', function (res) { - console.log(res); - console.log(res.data); - if (res.code == 0) { //鎴愬姛 - $("#planQty2").val(res.data.PlanQty) - $("#finishQty2").val(res.data.FinishQty) - } else { //涓嶆垚鍔� - layer.msg(res.msg, { - icon: 2, - time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }, function () { }); - } - }); - } - - //鏍规嵁鍗曟嵁鑾峰彇鍑哄簱鍙c�佽鏍笺�佸緟妫�鏁伴噺銆佸凡鎷f暟閲� - function getBar2() { - clear21(); - - var param = { - PalletNo: $("#palletNo2").val(), - SoDetailId: $("#skuLotNo2").val(), - } - synData(IP + "/PdaSo/GetOutlets", param, 'post', function (res) { - if (res.code == 0) { //鎴愬姛 - let data = res.data - console.log(res.data); - $('#outModel2').val(res.data.OutModel); - $('#standard2').val(res.data.Standard); - - $('#pickQty2').val(res.data.PickQty - res.data.PickedQty); - $('#pickedQty2').val(res.data.PickedQty); - } else { //涓嶆垚鍔� - layer.msg(res.msg, { - icon: 2, - time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }, function () { }); - } - }); - - } - - //鑾峰彇鎵樼洏鐗╂枡鍚嶇粏 - function GetDataInfo() { - let param2 = { - "SoDetailId": $("#skuLotNo2").val(), - "PalletNo": $("#palletNo2").val(), - } - console.log(param2); - synData(IP + "/PdaSo/GetAllotPlnInfo", param2, 'post', function (res) { - if (res.code == 0) { - tableData2 = deepCopy(res.data) - - refreshTable2(tableData2) - } else { - layer.msg(res.msg, { - icon: 2, - time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }, function () { }); - } - }); - } - - //娓叉煋琛ㄦ牸鏁版嵁 - function refreshTable2(list) { - //鍏堟竻绌轰竴涓嬩俊鎭垪琛� - let trs = $("#tableBoxList2 tr") - let len = trs.length - //console.log("tr 鏁伴噺 + " + trs.length) - for (i = len - 1; i >= 2; i--) { - trs[i].remove(); - } - - console.log(list != null); - console.log(list); - if (list != null && list.length > 0) { //鎴愬姛 - - var arrTrs = new Array() - let idx = 0 - for (var i in list) { - // list[i].BoxCode - var tr = $("#boxCell2").eq(0).clone(); - tr.appendTo("#tableBoxList2"); - // tr.attr('id', list[i].BoxCode) - idx++; - tr.attr('index', idx) - // tr.find("td[name='skuNo']").attr('style', 'max-width:90px;'); - // tr.find("td[name='skuName']").attr('style', 'max-width:120px;'); - tr.find("td[name='SkuNo']").html(list[i].BoxNo); - tr.find("td[name='Qty']").html(list[i].Qty); - tr.find("td[name='pickedQty']").html(list[i].PickedQty); - - tr.show(); - arrTrs[i] = tr - } - setPages(1, list.length) - canPickBox = true - - } else { //涓嶆垚鍔� - layer.msg("鏃犳暟鎹�", { - icon: 2, - time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }, function () { }); - // $("#boxNum").val(0) - setPages(1, 0) - } - } - //鍗曟嫞璐э紙纭鎸夐挳锛� form.on('submit(formPickScatter2)', function (data) { - if ($('#bar2').val() == "") { - layer.msg("璇烽�夋嫨鍑哄簱鍗�", { - icon: 2, - time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }); return; - } + if ($('#skuLotNo2').val() == "") { layer.msg("璇烽�夋嫨鐗╂枡-鎵规", { icon: 2, @@ -781,8 +599,7 @@ time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 }); return; } - let pickedQty = parseInt($('#pickedQty2').val()) //宸叉嫞鏁伴噺 - let pickQty = parseInt($('#pickQty2').val()) //鎷h揣鏁伴噺 + let pickQty = parseFloat($('#pickQty2').val()) //鎷h揣鏁伴噺 if (pickQty <= 0) { layer.msg("鎷h揣鏁伴噺闇�澶т簬0", { icon: 2, @@ -808,24 +625,21 @@ //纭鎷h揣 function reqPickScatter2() { var param = { - "SoNo": $("#bar2").val(), - "SoDetailId": $("#skuLotNo2").val(), + "DetailId": $("#skuLotNo2").val(), "PalletNo": $('#palletNo2').val(), - "PickQty": $('#pickQty2').val(), + "Qty": parseFloat($('#pickQty2').val()), "PalletNoNew": $('#palletNo4').val(), } - sendData(IP + "/PdaSo/SoSetQtyPinPick", param, 'post', function (res) { - //console.log(res); - + sendData(IP + "/PdaCr/UpPalletByQty", param, 'post', function (res) { + if (res.code == 0) { //鎴愬姛 layer.msg(res.msg, { icon: 1, time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 }, function () { canPickBox = true//鍥炶皟 - updateQtyList2(); - getBar2(); - GetDataInfo(); + checkPalletState2(); + $('#pickQty2').val('') }); } else { //涓嶆垚鍔� layer.msg(res.msg, { diff --git a/Wms/Model/ModelDto/PdaDto/PdaCheckDto.cs b/Wms/Model/ModelDto/PdaDto/PdaCheckDto.cs index 5d80289..6a62ba8 100644 --- a/Wms/Model/ModelDto/PdaDto/PdaCheckDto.cs +++ b/Wms/Model/ModelDto/PdaDto/PdaCheckDto.cs @@ -14,4 +14,12 @@ public string SkuName { get; set; } public string LotNo { get; set; } } + + public class SelectSkuLotNo + { + public string DetailId { get; set; } + public string SkuNo { get; set; } + public string SkuName { get; set; } + public string LotNo { get; set; } + } } diff --git a/Wms/Model/ModelVm/PdaVm/PdaCrVm.cs b/Wms/Model/ModelVm/PdaVm/PdaCrVm.cs index ba58759..ca186de 100644 --- a/Wms/Model/ModelVm/PdaVm/PdaCrVm.cs +++ b/Wms/Model/ModelVm/PdaVm/PdaCrVm.cs @@ -88,4 +88,14 @@ public string PalletNo { get; set; } } + public class PdaUpPalletVm + { + public string PalletNo { get; set; } + public string PalletNoNew { get; set; } + public string BoxNo { get; set; } + public decimal Qty { get; set; } + public string DetailId { get; set; } + } + + } diff --git a/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs index e1297a5..600b343 100644 --- a/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs +++ b/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs @@ -1444,12 +1444,15 @@ #region 鐗╂枡鎷嗘墭 锛堟爣绛俱�佹暟閲忥級 + /// <summary> + /// 鏌ヨ绠变俊鎭� + /// </summary> + /// <param name="boxNo"></param> + /// <param name="pallNo"></param> public void GetBoxInfo(string boxNo,string pallNo) { try { - - var boxInfo = Db.Queryable<DataBoxInfo>().Where(m=>m.IsDel == "0" && m.BoxNo == boxNo).ToList(); if (!string.IsNullOrWhiteSpace(pallNo)) { @@ -1459,8 +1462,274 @@ { throw new Exception("鏍囩淇℃伅閿欒锛岃鑱旂郴绠$悊鍛�"); } - - + + } + catch (Exception e) + { + throw new Exception(e.Message); + } + } + + public void UpPalletByBox(string boxNo,string pallet,string palletNew,int userId) + { + try + { + Db.BeginTran(); + if (string.IsNullOrWhiteSpace(boxNo) || string.IsNullOrWhiteSpace(pallet) || string.IsNullOrWhiteSpace(palletNew)) + { + throw new Exception("鍙傛暟閿欒锛屾墭鐩樸�佹柊鎵樼洏銆佺鐮佸潎涓嶈兘涓虹┖"); + } + var boxInfoList = Db.Queryable<DataBoxInfo>().Where(m=>m.IsDel == "0" && m.BoxNo == boxNo).ToList(); + if (boxInfoList.Count != 1) + { + throw new Exception("鏍囩淇℃伅鏁伴噺涓嶆槸1鏉�"); + } + var boxInfo = boxInfoList.First(); + var detail1 = Db.Queryable<DataStockDetail>().First(m=>m.IsDel == "0" && m.PalletNo == pallet && m.Id == boxInfo.StockDetailId ); + if (detail1 == null) + { + throw new Exception("鏈煡璇㈠埌鎵樼洏鍜岀鐮佺殑搴撳瓨鏄庣粏"); + } + var palletInfoNew = Db.Queryable<SysPallets>().First(m => m.IsDel == "0" && m.PalletNo == palletNew); + if (palletInfoNew == null) + { + throw new Exception("鏈煡璇㈠埌鏂版墭鐩樹俊鎭�"); + } + var detailNewBl = Db.Queryable<DataStockDetail>().First(m => m.IsDel == "0" && m.PalletNo == palletNew && (m.SkuNo != boxInfo.SkuNo || m.LotNo != boxInfo.LotNo)); + if (detailNewBl!=null) + { + throw new Exception("鏂版墭鐩樹笂宸叉湁鍏朵粬鐗╂枡绠变俊鎭�"); + } + //娣诲姞/鏇存柊搴撳瓨鎵樼洏淇℃伅 + var detailNew1 = Db.Queryable<DataStockDetail>().First(m => m.IsDel == "0" && m.PalletNo == palletNew && m.SkuNo == boxInfo.SkuNo && m.LotNo == boxInfo.LotNo); + var newId = 0; + if (detailNew1 == null)//add + { + var detailNew = new DataStockDetail(); + detailNew.SkuNo = detail1.SkuNo; + detailNew.SkuName = detail1.SkuName; + detailNew.LotNo = detail1.LotNo; + detailNew.LotText = detail1.LotText; + detailNew.SupplierLot = detail1.SupplierLot; + detailNew.SupplierNo = detail1.SupplierNo; + detailNew.SupplierName = detail1.SupplierName; + detailNew.Standard = detail1.Standard; + detailNew.Qty = boxInfo.Qty; + detailNew.LockQty = 0; + detailNew.FrozenQty = 0; + detailNew.InspectQty = 0; + detailNew.ASNNo = ""; + + detailNew.PalletNo = palletNew; + detailNew.ProductionTime = detail1.ProductionTime; + detailNew.ExpirationTime = detail1.ExpirationTime; + detailNew.PalletTags = "0"; + detailNew.CompleteTime = DateTime.Now; + detailNew.Status = "0"; + detailNew.InspectMark = detail1.InspectMark; + detailNew.BitPalletMark = "1"; + detailNew.InspectStatus = detail1.InspectStatus; + detailNew.PackagNo = detail1.PackagNo; + detailNew.IsBale = detail1.IsBale; + detailNew.IsBelt = detail1.IsBelt; + detailNew.IsDel = "0"; + detailNew.CreateTime = DateTime.Now; + detailNew.CreateUser = 0; + + + newId = Db.Insertable(detailNew).ExecuteReturnIdentity(); + } + else //update + { + detailNew1.Qty += boxInfo.Qty; + detailNew1.PalletNo = palletNew; + + Db.Updateable(detailNew1).ExecuteCommand(); + newId = detailNew1.Id; + } + //鏇存柊鎵樼洏鐘舵�� + palletInfoNew.Status = "1"; + Db.Updateable(palletInfoNew).ExecuteCommand(); + + //鏇存敼鍘熸墭鐩樹俊鎭� + detail1.Qty -= boxInfo.Qty; + detail1.BitPalletMark = "1"; + if (detail1.Qty <= 0) + { + //鏇存柊鍘熸墭鐩樼姸鎬� + var palletInfo = Db.Queryable<SysPallets>().First(m => m.IsDel == "0" && m.PalletNo == pallet); + palletInfo.Status = "0"; + Db.Updateable(palletInfo).ExecuteCommand(); + + Db.Deleteable(detail1).ExecuteCommand(); + } + else + { + Db.Updateable(detail1).ExecuteCommand(); + } + + //鏇存柊搴撳瓨绠变俊鎭� + boxInfo.StockDetailId = newId; + boxInfo.BindNo = 0; + boxInfo.PalletNo = palletNew; + Db.Updateable(boxInfo).ExecuteCommand(); + //娣诲姞鎿嶄綔鏃ュ織 + new OperationCrServer().AddLogOperationCr("搴撳唴浣滀笟", "鎿嶄綔鏃ュ織", boxNo, "缂栬緫", $"鐗╂枡鎷嗘墭锛氱鐮侊細{boxNo}鎹㈡墭锛屽師鎵樼洏{pallet}锛屾柊鎵樼洏{palletNew}", userId); + + Db.CommitTran(); + } + catch (Exception e) + { + Db.RollbackTran(); + throw new Exception(e.Message); + } + } + + //鏁伴噺椤电----------------------------------------------------------------------------------------------------------------------------------------- + + /// <summary> + /// 鏍规嵁鎵樼洏鑾峰彇鎵樼洏涓婄殑鐗╂枡鎵规淇℃伅 + /// </summary> + /// <param name="palletNo"></param> + /// <returns></returns> + /// <exception cref="Exception"></exception> + public List<SelectSkuLotNo> GetSelectSkuLotNo(string palletNo) + { + try + { + var data = new List<SelectSkuLotNo>(); + var detailList = Db.Queryable<DataStockDetail>().Where(m=>m.IsDel == "0" && m.PalletNo == palletNo).ToList(); + + foreach (var item in detailList) + { + if (data.Count(m=>m.DetailId == item.Id.ToString()) == 0) + { + data.Add(new SelectSkuLotNo() + { + SkuNo = item.SkuNo, + SkuName = item.SkuName, + LotNo = item.LotNo, + DetailId = item.Id.ToString(), + }); + } + } + return data; + + } + catch (Exception e) + { + throw new Exception(e.Message); + } + } + + + /// <summary> + /// 鎷嗘墭-鏁伴噺 + /// </summary> + /// <param name="palletNo"></param> + /// <param name="palletNoNew"></param> + /// <param name="detailId"></param> + /// <param name="qty"></param> + /// <param name="userId"></param> + /// <exception cref="Exception"></exception> + public void UpPalletByQty(string palletNo,string palletNoNew,string detailId,decimal qty,int userId) + { + try + { + Db.BeginTran(); + if (string.IsNullOrWhiteSpace(detailId) || string.IsNullOrWhiteSpace(palletNo) || string.IsNullOrWhiteSpace(palletNoNew)) + { + throw new Exception("鍙傛暟閿欒锛屾墭鐩樸�佹柊鎵樼洏銆佺墿鏂欐壒娆″潎涓嶈兘涓虹┖"); + } + if (qty<=0) + { + throw new Exception("鍙傛暟鏁伴噺涓嶈兘涓哄皬绛�0"); + } + var detailId2 = int.Parse(detailId); + var detail1 = Db.Queryable<DataStockDetail>().First(m => m.IsDel == "0" && m.PalletNo == palletNo && m.Id == detailId2); + if (detail1 == null) + { + throw new Exception("鏈煡璇㈠埌鎵樼洏搴撳瓨鏄庣粏"); + } + var palletInfoNew = Db.Queryable<SysPallets>().First(m => m.IsDel == "0" && m.PalletNo == palletNoNew); + if (palletInfoNew == null) + { + throw new Exception("鏈煡璇㈠埌鏂版墭鐩樹俊鎭�"); + } + + //娣诲姞/鏇存柊搴撳瓨鎵樼洏淇℃伅 + var detailNew1 = Db.Queryable<DataStockDetail>().First(m => m.IsDel == "0" && m.PalletNo == palletNoNew && m.SkuNo == detail1.SkuNo && m.LotNo == detail1.LotNo); + var newId = 0; + if (detailNew1 == null)//add + { + var detailNew = new DataStockDetail(); + detailNew.SkuNo = detail1.SkuNo; + detailNew.SkuName = detail1.SkuName; + detailNew.LotNo = detail1.LotNo; + detailNew.LotText = detail1.LotText; + detailNew.SupplierLot = detail1.SupplierLot; + detailNew.SupplierNo = detail1.SupplierNo; + detailNew.SupplierName = detail1.SupplierName; + detailNew.Standard = detail1.Standard; + detailNew.Qty = qty; + detailNew.LockQty = 0; + detailNew.FrozenQty = 0; + detailNew.InspectQty = 0; + detailNew.ASNNo = ""; + + detailNew.PalletNo = palletNoNew; + detailNew.ProductionTime = detail1.ProductionTime; + detailNew.ExpirationTime = detail1.ExpirationTime; + detailNew.PalletTags = "0"; + detailNew.CompleteTime = DateTime.Now; + detailNew.Status = "0"; + detailNew.InspectMark = detail1.InspectMark; + detailNew.BitPalletMark = "1"; + detailNew.InspectStatus = detail1.InspectStatus; + detailNew.PackagNo = detail1.PackagNo; + detailNew.IsBale = detail1.IsBale; + detailNew.IsBelt = detail1.IsBelt; + detailNew.IsDel = "0"; + detailNew.CreateTime = DateTime.Now; + detailNew.CreateUser = 0; + + + newId = Db.Insertable(detailNew).ExecuteReturnIdentity(); + } + else //update + { + detailNew1.Qty += qty; + detailNew1.PalletNo = palletNoNew; + + Db.Updateable(detailNew1).ExecuteCommand(); + newId = detailNew1.Id; + } + //鏇存柊鎵樼洏鐘舵�� + palletInfoNew.Status = "1"; + Db.Updateable(palletInfoNew).ExecuteCommand(); + + //鏇存敼鍘熸墭鐩樹俊鎭� + detail1.Qty -= qty; + detail1.BitPalletMark = "1"; + if (detail1.Qty <= 0) + { + //鏇存柊鍘熸墭鐩樼姸鎬� + var palletInfo = Db.Queryable<SysPallets>().First(m => m.IsDel == "0" && m.PalletNo == palletNo); + palletInfo.Status = "0"; + Db.Updateable(palletInfo).ExecuteCommand(); + + Db.Deleteable(detail1).ExecuteCommand(); + } + else + { + Db.Updateable(detail1).ExecuteCommand(); + } + + + //娣诲姞鎿嶄綔鏃ュ織 + new OperationCrServer().AddLogOperationCr("搴撳唴浣滀笟", "鎿嶄綔鏃ュ織", palletNo, "缂栬緫", $"鐗╂枡鎷嗘墭:{detail1.SkuName}鐗╂枡鎹㈡墭锛屽師鎵樼洏{palletNo}锛屾柊鎵樼洏{palletNoNew}", userId); + + Db.CommitTran(); } catch (Exception e) { diff --git a/Wms/WMS.IBLL/IPdaServer/IPdaCrServer.cs b/Wms/WMS.IBLL/IPdaServer/IPdaCrServer.cs index b87ed44..32610f4 100644 --- a/Wms/WMS.IBLL/IPdaServer/IPdaCrServer.cs +++ b/Wms/WMS.IBLL/IPdaServer/IPdaCrServer.cs @@ -174,6 +174,17 @@ #endregion + #region 鎵樼洏鎷嗘墭鎹㈡墭 + void GetBoxInfo(string boxNo, string pallNo); + + void UpPalletByBox(string boxNo, string pallet, string palletNew, int userId); + + + List<SelectSkuLotNo> GetSelectSkuLotNo(string palletNo); + + void UpPalletByQty(string palletNo, string palletNoNew, string detailId, decimal qty, int userId); + + #endregion } } diff --git a/Wms/Wms/Controllers/PdaCrController.cs b/Wms/Wms/Controllers/PdaCrController.cs index 6a97983..fbd3020 100644 --- a/Wms/Wms/Controllers/PdaCrController.cs +++ b/Wms/Wms/Controllers/PdaCrController.cs @@ -368,5 +368,90 @@ #endregion + + #region 鐗╂枡鎷嗘墭 + + /// <summary> + /// 鏌ヨ绠变俊鎭� + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [HttpPost] + public IActionResult GetBoxInfo(PdaUpPalletVm model) + { + try + { + _pdaCrSvc.GetBoxInfo(model.BoxNo, model.PalletNo); + + return Ok(new { data = "", code = 0, msg = "鎴愬姛" }); + } + catch (Exception e) + { + return Ok(new { data = "", code = 1, msg = $"寮傚父锛歿e.Message}" }); + } + } + + /// <summary> + /// 鐗╂枡鎷嗘墭 + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [HttpPost] + public IActionResult UpPalletByBox(PdaUpPalletVm model) + { + try + { + _pdaCrSvc.UpPalletByBox(model.BoxNo, model.PalletNo,model.PalletNoNew,_userManager.UserId); + + return Ok(new { data = "", code = 0, msg = "鎴愬姛" }); + } + catch (Exception e) + { + return Ok(new { data = "", code = 1, msg = $"寮傚父锛歿e.Message}" }); + } + } + + /// <summary> + /// 鏍规嵁鎵樼洏鑾峰彇鎵樼洏涓婄殑鐗╂枡鎵规淇℃伅 + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [HttpPost] + public IActionResult GetSelectSkuLotNo(PdaUpPalletVm model) + { + try + { + var list = _pdaCrSvc.GetSelectSkuLotNo(model.PalletNo); + + return Ok(new { data = list, code = 0, msg = "鎴愬姛" }); + } + catch (Exception e) + { + return Ok(new { data = "", code = 1, msg = $"寮傚父锛歿e.Message}" }); + } + } + + /// <summary> + /// 鐗╂枡鎷嗘墭 - 鏁伴噺椤电 + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [HttpPost] + public IActionResult UpPalletByQty(PdaUpPalletVm model) + { + try + { + _pdaCrSvc.UpPalletByQty(model.PalletNo, model.PalletNoNew, model.DetailId,model.Qty, _userManager.UserId); + + return Ok(new { data = "", code = 0, msg = "鎴愬姛" }); + } + catch (Exception e) + { + return Ok(new { data = "", code = 1, msg = $"寮傚父锛歿e.Message}" }); + } + } + + #endregion + } } diff --git a/Wms/Wms/Controllers/UpApiController.cs b/Wms/Wms/Controllers/UpApiController.cs index 79cb4b6..3cc0ebb 100644 --- a/Wms/Wms/Controllers/UpApiController.cs +++ b/Wms/Wms/Controllers/UpApiController.cs @@ -26,6 +26,8 @@ using WMS.IBLL.IPdaServer; using WMS.BLL.BllQualityServer; using WMS.IBLL; +using ZXing.QrCode.Internal; +using System.Xml.Linq; namespace Wms.Controllers { @@ -55,6 +57,119 @@ _pdaAsnServer = pdaAsnServer; _http = http; } + #endregion + + #region JC34 + + + /// <summary> + /// 鐗╂枡涓嬪彂 + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [AllowAnonymous] + [HttpPost] + public IActionResult CreateSku(object model) + { + + try + { + + return Ok(new { result = true, code = "1" ,message = "success" }); + } + catch (Exception e) + { + return Ok(new { result = false, code = "400", message = e.Message }); + } + } + + + /// <summary> + /// 瀹㈡埛淇℃伅鎺ユ敹 + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [AllowAnonymous] + [HttpPost] + public IActionResult CreateCustomer(object model) + { + + try + { + return Ok(new { result = true, code = "1", message = "success" }); + } + catch (Exception e) + { + return Ok(new { result = false, code = "400", message = e.Message }); + } + } + + + /// <summary> + /// 鍏ュ簱鍗曟帴鏀� + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [AllowAnonymous] + [HttpPost] + public IActionResult CreateAsn(object model) + { + + try + { + return Ok(new { result = true, code = "1", message = "success" }); + } + catch (Exception e) + { + return Ok(new { result = false, code = "400", message = e.Message }); + } + } + + /// <summary> + /// 鍑哄簱鍗曟帴鏀� + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [AllowAnonymous] + [HttpPost] + public IActionResult CreateSo(object model) + { + + try + { + return Ok(new { result = true, code = "1", message = "success" }); + } + catch (Exception e) + { + return Ok(new { result = false, code = "400", message = e.Message }); + } + } + + + /// <summary> + /// 搴撳瓨璐ㄩ噺鐘舵�佹帴鏀� + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [AllowAnonymous] + [HttpPost] + public IActionResult UpQuality(object model) + { + + try + { + // var sd = JsonConvert.SerializeObject(model); + // var sd2 = JsonConvert.DeserializeObject<BoxPalletBindVm>(sd); + + return Ok(new { result = true, code = "1", message = "success" }); + } + catch (Exception e) + { + return Ok(new { result = false, code = "400", message = e.Message }); + } + } + + #endregion #region 璋冪敤涓婃父绯荤粺鎺ュ彛 @@ -354,59 +469,59 @@ } } - /// <summary> - /// 鍏ュ簱鍗曟嵁涓嬪彂 - /// </summary> - /// <param name="model">鍏ュ簱鍗曚俊鎭�</param> - /// <returns></returns> - [Authorize] - [HttpPost] - public IActionResult CreateAsn(AsnInfo model) - { - var result = new ErpModel { Success = -1, Message = "" }; - try - { - var claimsIdentity = this.User.Identity as ClaimsIdentity; - if (claimsIdentity == null) - { - throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅"); - } - string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; - if (string.IsNullOrWhiteSpace(UserId)) - { - throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅"); - } + ///// <summary> + ///// 鍏ュ簱鍗曟嵁涓嬪彂 + ///// </summary> + ///// <param name="model">鍏ュ簱鍗曚俊鎭�</param> + ///// <returns></returns> + //[Authorize] + //[HttpPost] + //public IActionResult CreateAsn(AsnInfo model) + //{ + // var result = new ErpModel { Success = -1, Message = "" }; + // try + // { + // var claimsIdentity = this.User.Identity as ClaimsIdentity; + // if (claimsIdentity == null) + // { + // throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅"); + // } + // string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; + // if (string.IsNullOrWhiteSpace(UserId)) + // { + // throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅"); + // } - result = _arrivalNoticeSvc.CreateAsn(model); + // result = _arrivalNoticeSvc.CreateAsn(model); - return Ok(result); - } - catch (Exception e) - { - result.Message = e.Message; - return Ok(result); - } - } + // return Ok(result); + // } + // catch (Exception e) + // { + // result.Message = e.Message; + // return Ok(result); + // } + //} - /// <summary> - /// 鍑哄簱鍗曚笅鍙戞帴鍙� - /// </summary> - /// <param name="model">鍑哄簱鍗曚俊鎭�</param> - /// <returns></returns> - [HttpPost] - public IActionResult CreateSo(SoInfo model) - { - try - { - SoResInfo result = _exNoticeSvc.ErpAddExportNotice(model); - return Ok(result); + ///// <summary> + ///// 鍑哄簱鍗曚笅鍙戞帴鍙� + ///// </summary> + ///// <param name="model">鍑哄簱鍗曚俊鎭�</param> + ///// <returns></returns> + //[HttpPost] + //public IActionResult CreateSo(SoInfo model) + //{ + // try + // { + // SoResInfo result = _exNoticeSvc.ErpAddExportNotice(model); + // return Ok(result); - } - catch (Exception e) - { - return Ok(new ErpModel { Success = -1, Message = e.Message }); - } - } + // } + // catch (Exception e) + // { + // return Ok(new ErpModel { Success = -1, Message = e.Message }); + // } + //} /// <summary> /// 杞﹂棿鍙枡 -- Gitblit v1.8.0