From adb69643f9f8fef29f2f20f51ee8faff97583ad2 Mon Sep 17 00:00:00 2001
From: wxw <Administrator@DESKTOP-5BIMHQ3>
Date: 星期二, 13 八月 2024 11:18:44 +0800
Subject: [PATCH] Merge branch 'wxw'
---
Pda/View/HouseDataSetting/lingXiangUnbind.html | 169 +++
Wms/Wms/appsettings.json | 5
Wms/Wms/Controllers/PdaCrController.cs | 34
Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs | 2
Wms/Model/ModelVm/PdaVm/PdaCrVm.cs | 6
Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs | 81 +
Wms/Wms/Controllers/PdaAsnController.cs | 9
Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs | 2386 +++++++++++++++++++++++++++++----------------------
Wms/WMS.IBLL/IPdaServer/IPdaCrServer.cs | 10
9 files changed, 1,680 insertions(+), 1,022 deletions(-)
diff --git a/Pda/View/HouseDataSetting/lingXiangUnbind.html b/Pda/View/HouseDataSetting/lingXiangUnbind.html
new file mode 100644
index 0000000..3d3e72e
--- /dev/null
+++ b/Pda/View/HouseDataSetting/lingXiangUnbind.html
@@ -0,0 +1,169 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="user-scalable=0,width=device-width,initial-scale=1.0" />
+ <!-- <meta name="viewport" content="width=device-width, initial-scale=0.665, minimum-scale=0.5, maximum-scale=2.0, user-scalable=no" /> -->
+ <meta http-equiv="X-UA-Compatible" content="ie=edge" />
+ <title>Boxline PDA</title>
+
+ <link rel="stylesheet" href="/layui/css/layui.css" />
+ <link rel="stylesheet" href="/css/style.css" />
+ <script src="/js/adaptive.js"></script>
+ <link rel="stylesheet" href="/css/my.css" />
+ <link rel="stylesheet" href="/css/adapter.css" />
+ <style type="text/css">
+ .layout-bill-info {
+ height: 255px;
+ }
+ .layout-tbl-submit {
+ margin-top: 10px;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="" class="main-content">
+ <div id="" class="layout-title">
+ <table border="" cellspacing="" cellpadding="">
+ <tr>
+ <td class="img-back"><a href="../index.html"><img src="/assets/back.jpg" ></a></td>
+ <td class="title-text">闆剁瑙g粦</td>
+ <td class="title-menu-icon"><img id="menuImg" src="/assets/menu.jpg" ></td>
+ </tr>
+ </table>
+ </div>
+ <div id="" class="layout-sub-content">
+ <div id="menuList" class="menu">
+ <ul class="" style="text-align: center;">
+ <li><a href="../index.html">涓婚〉</a></li>
+ <!-- <li><a href="productEnterConfirm.html">鍏ュ簱淇℃伅纭</a></li> -->
+ <li><a href="../login.html">閲嶆柊鐧诲綍</a></li>
+ </ul>
+ </div>
+
+ <div id="" class="layout-bill-info">
+ <form class="layui-form" action="">
+ <div id="layout-boxcode" class="layui-form-item layout-input">
+ <label class="layui-form-label">鎵樼洏鏉$爜锛�</label>
+ <div class="layui-input-block">
+ <input id="PalletNo" type="text" lay-verify="required" placeholder="璇锋壂鎻忔墭鐩樻潯鐮�"
+ autocomplete="off" class="layui-input">
+ </div>
+ </div>
+ <div id="BOX" class="layui-form-item layout-input">
+ <label class="layui-form-label" lang>澶栫鏉$爜锛�</label>
+ <div class="layui-input-block">
+ <input id="BOXCODE" type="text" lay-verify="required" lang langholder
+ placeholder="璇锋壂鎻忓绠辨潯鐮�" autocomplete="off" class="layui-input">
+ </div>
+ </div>
+
+ <table class="layout-tbl-submit" border="" cellspacing="" cellpadding="">
+ <tr>
+ <td style="width: 23%;"></td>
+ <td>
+ <button class="layout-btn layout-btn-red" lang type="button" lay-submit
+ lay-filter="formUnbind">瑙g粦</button>
+ </td>
+ <td style="width: 33%;"></td>
+
+ </tr>
+ </table>
+ </form>
+ </div>
+ </div>
+ </div>
+
+
+ <script src="/js/jquery-3.5.1.min.js"></script>
+ <script src="/layui/layui.js"></script>
+ <script src="/js/public.js"></script>
+ <script src="/js/jquery.cookie.js"></script>
+ <script>
+ layui.use(['form', 'jquery'], function() {
+ var form = layui.form
+
+ $("#menuImg").click(function(e){
+ //console.log("menuImg")
+ e.stopPropagation()
+
+ if($("#menuList").is(":hidden")){
+ $("#menuList").show()
+ }else{
+ $("#menuList").hide()
+ }
+ })
+ $('body').click(function(){
+ // //console.log("body")
+ $("#menuList").hide()
+ })
+
+ //褰撴墭鐩樻潯鐮佽緭鍏ユ澶卞幓鐒︾偣鏃�,妫�鏌ヤ竴涓嬫墭鐩樼姸鎬�
+ $("#PalletNo").on('input',function(){
+
+ if($("#PalletNo").val() == "" || $("#PalletNo").val().length<10){
+ return
+ }
+ if ($("#PalletNo").val().length>=10) {
+ $("#PalletNo").val($("#PalletNo").val().substr(-10))
+
+ }
+ })
+ var isChongFu = true;
+ form.on('submit(formUnbind)', function(data) {
+ if (!$("#PalletNo").val()) {
+ layer.msg('璇锋壂鎻忔墭鐩樻潯鐮�', {
+ icon: 2,
+ time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+ });
+ return;
+ }
+ if (!$("#BOXCODE").val()) {
+ layer.msg('璇锋壂鎻忓绠辨潯鐮�', {
+ icon: 2,
+ time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+ });
+ return;
+ }
+ if (isChongFu == true) {
+ isChongFu = false;
+ var param = {
+ "PalletNo": $("#PalletNo").val(),
+ "BoxNo": $("#BOXCODE").val(),
+ }
+ sendData(IP + "/PdaCr/LingxingUnbind", param, 'post', function(res) {
+ if (res.code == 0) { //鎴愬姛
+ layer.msg("瑙g粦鎴愬姛", {
+ icon: 1,
+ time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+ }, function () {
+ tableData = null
+ $("#PalletNo").val('')
+ $("#BOXCODE").val('')
+
+ isChongFu = true;
+ });
+ } else { //涓嶆垚鍔�
+ layer.msg(res.msg, {
+ icon: 2,
+ time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+ }, function() {isChongFu = true;});
+ }
+ });
+ return false; //闃绘琛ㄥ崟璺宠浆銆傚鏋滈渶瑕佽〃鍗曡烦杞紝鍘绘帀杩欐鍗冲彲銆�
+ }else{
+ layer.msg("璇峰嬁閲嶅鐐瑰嚮", {
+ icon: 2,
+ time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+ });
+ }
+
+ });
+
+ // form.verify({
+ // stock: [/^[\S]{6}$/, '鎵樼洏鏉$爜蹇呴』涓哄叚浣嶅瓧绗�']
+ // });
+ })
+ </script>
+ </body>
+</html>
diff --git a/Wms/Model/ModelVm/PdaVm/PdaCrVm.cs b/Wms/Model/ModelVm/PdaVm/PdaCrVm.cs
index 149bf87..1e79eb3 100644
--- a/Wms/Model/ModelVm/PdaVm/PdaCrVm.cs
+++ b/Wms/Model/ModelVm/PdaVm/PdaCrVm.cs
@@ -69,4 +69,10 @@
/// </summary>
public string Ruku { get; set; }
}
+
+ public class PdaPalletUnBindVm
+ {
+ public string PalletNo { get; set; }
+ public string BoxNo { get; set; }
+ }
}
diff --git a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
index c439b34..7c124fd 100644
--- a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
+++ b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
@@ -261,7 +261,7 @@
{
throw new Exception("褰撳墠鍗曞彿瀛樺湪寮傚父锛�");
}
-
+
return notice;
}
@@ -310,14 +310,14 @@
{
throw new Exception("绌烘墭鐩樻暟閲忎笉鍙负绌�");
}
- var stockDetail = Db.Queryable<DataStockDetail>().Where(m=>m.IsDel == "0" && m.PalletNo == model.PalletNo).ToList();
+ var stockDetail = Db.Queryable<DataStockDetail>().Where(m => m.IsDel == "0" && m.PalletNo == model.PalletNo).ToList();
if (stockDetail.Count > 0)
{
throw new Exception("褰撳墠鎵樼洏鍦ㄥ簱鍐呭凡鏈夊簱瀛樹俊鎭紝璇锋牳瀹�");
}
-
+
//鑾峰彇鎵樼洏淇℃伅
- var pallet = Db.Queryable<SysPallets>().First(m=>m.IsDel == "0" && m.PalletNo == model.PalletNo);
+ var pallet = Db.Queryable<SysPallets>().First(m => m.IsDel == "0" && m.PalletNo == model.PalletNo);
if (pallet == null)
{
throw new Exception("鏈煡璇㈠埌鎵樼洏淇℃伅");
@@ -327,11 +327,11 @@
throw new Exception("鎵樼洏鐘舵�佷笉鑳芥湭浣跨敤鐘舵��");
}
//鑾峰彇鎵樼洏淇℃伅
- var sku = Db.Queryable<SysMaterials>().First(m=>m.IsDel == "0" && m.SkuNo == "100099");
+ var sku = Db.Queryable<SysMaterials>().First(m => m.IsDel == "0" && m.SkuNo == "100099");
var pNum = 0;
var bNum = 0;
- new Common().GetPackQtyInfo(sku.PackagNo,ref pNum,ref bNum);
+ new Common().GetPackQtyInfo(sku.PackagNo, ref pNum, ref bNum);
var datetime = Db.GetDate();
Db.BeginTran();
@@ -352,8 +352,8 @@
LotNo = "",
LotText = "",
SupplierLot = "",
- InspectMark ="0", //0 鍚� 1 鏄�
- BitPalletMark = pNum== (int)model.Qty? "0":"1",
+ InspectMark = "0", //0 鍚� 1 鏄�
+ BitPalletMark = pNum == (int)model.Qty ? "0" : "1",
IsBale = "0",
IsBelt = "0",
CreateUser = (int)model.CreateUser,
@@ -372,7 +372,7 @@
Status = "2",
CompleteTime = DateTime.Now,
Qty = (int)model.Qty,
- FullQty = pNum,
+ FullQty = pNum,
SkuNo = sku.SkuNo,
SkuName = sku.PackagNo,
LotNo = "",
@@ -392,7 +392,7 @@
Db.Insertable(modelbb).ExecuteCommand();
//娣诲姞搴撳瓨
-
+
#region 搴撳瓨鏄庣粏
var sd1 = new DataStockDetail()
{
@@ -464,7 +464,7 @@
CreateUser = 0,
CreateTime = datetime
- };
+ };
Db.Insertable(box2).ExecuteCommand();
#endregion
@@ -541,12 +541,12 @@
throw new Exception("褰撳墠鎵樼洏宸叉湁浠诲姟锛岃鍏堝彇娑堜换鍔″啀瑙g粦鎵樼洏");
}
//鑾峰彇浠诲姟淇℃伅
- var logtask = Db.Queryable<LogTask>().First(a => a.PalletNo == upBindPalletNo && a.IsDel == "0" &&( a.Status == "1" || a.Status == "0"));
+ var logtask = Db.Queryable<LogTask>().First(a => a.PalletNo == upBindPalletNo && a.IsDel == "0" && (a.Status == "1" || a.Status == "0"));
if (logtask != null)
{
throw new Exception("璇ユ墭鐩樻湁浠诲姟浠诲姟姝e湪鎵ц 璇锋牳瀹烇紒");
}
-
+
//鑾峰彇绠辩爜淇℃伅
var box = Db.Queryable<BllBoxInfo>().First(a => a.PalletNo == upBindPalletNo && a.IsDel == "0" && a.BindNo == bind.Id);
//鍒ゆ柇绌烘墭鍏ュ簱鐨勬墭鐩樻槸鍚︽湁璇ユ墭鐩�
@@ -555,8 +555,8 @@
strMsg = "璇ユ墭鐩樹笉鏄┖鎵樻墭鐩� 鎴栨湭缁戝畾 璇锋牳瀹炴墭鐩�";
return strMsg;
}
-
-
+
+
Db.BeginTran();
var time = DateTime.Now;
@@ -589,13 +589,13 @@
Db.Insertable(modelpb).ExecuteCommand();
//鍒犻櫎搴撳瓨淇℃伅
- var stockDetail = Db.Queryable<DataStockDetail>().First(m=>m.IsDel == "0" && m.PalletNo == upBindPalletNo);
+ var stockDetail = Db.Queryable<DataStockDetail>().First(m => m.IsDel == "0" && m.PalletNo == upBindPalletNo);
Db.Deleteable(stockDetail).ExecuteCommand();
var boxInfo = Db.Queryable<DataBoxInfo>().Where(m => m.IsDel == "0" && m.StockDetailId == stockDetail.Id).ToList();
Db.Deleteable(boxInfo).ExecuteCommand();
var stock = Db.Queryable<DataStock>().First(m => m.IsDel == "0" && m.SkuNo == box.SkuNo);
stock.Qty -= bind.Qty;
- if (stock.Qty==0)
+ if (stock.Qty == 0)
{
Db.Deleteable(stock).ExecuteCommand();
}
@@ -607,8 +607,8 @@
{
Db.Updateable(stock).ExecuteCommand();
}
-
-
+
+
// 鏇存敼鎵樼洏浣跨敤鐘舵��
string sqlStr = string.Empty;
sqlStr = $"update SysPallets set Status = '0' where PalletNo = '{upBindPalletNo}';";
@@ -773,10 +773,10 @@
throw new Exception("-1:鏈幏鍙栧埌瀵瑰簲鍏ュ簱鍗曞崟鎹槑缁嗕俊鎭紝璇锋牳瀹烇紒");
}
var bind2 = Db.Queryable<BllPalletBind>().Where(a => a.IsDel == "0" && a.Id != model.Id && model.ASNDetailNo == noticeDetail.Id).ToList();
-
+
Db.BeginTran();
- if (bind2.Count(m=>m.InspectMark == "1")>0)
+ if (bind2.Count(m => m.InspectMark == "1") > 0)
{
noticeDetail.IsSampling = "1";
}
@@ -789,9 +789,9 @@
//鍒ゆ柇宸茬粍鏁伴噺鏄惁涓�0
if (noticeDetail.FactQty == 0)
{
-
+
noticeDetail.Status = "0"; //鍏ュ簱鍗曟槑缁嗙姸鎬�
-
+
//鑾峰彇鐘舵�佷笉鏄瓑寰呮墽琛岀殑鏄庣粏淇℃伅
var count = Db.Queryable<BllArrivalNoticeDetail>().Count(m => m.IsDel == "0" && m.Id != noticeDetail.Id && m.ASNNo == bind.ASNNo && m.Status != "0");
if (count == 0)
@@ -1901,7 +1901,7 @@
{
throw new Exception("绠辩爜淇℃伅涓嶅瓨鍦�!");
}
-
+
return models;
}
catch (Exception ex)
@@ -2454,9 +2454,9 @@
}
}
-
+
int isTextTable = model.TableType;
-
+
#endregion
Db.BeginTran();
@@ -2648,7 +2648,7 @@
//box.Qty = box.Qty;
//box.BitBoxMark = box.Qty == box.FullQty ? "0" : "1";
-
+
factQty += box.Qty;
boxFullQty += box.Qty;
if (box.InspectMark == "1") //鍒ゆ柇鏄惁鍙栨牱
@@ -2684,7 +2684,7 @@
if (isSample == "1")
{
bind.InspectMark = "1";
- bind.SamplingQty = bind.SamplingQty == null? sampleQty : bind.SamplingQty + sampleQty;
+ bind.SamplingQty = bind.SamplingQty == null ? sampleQty : bind.SamplingQty + sampleQty;
}
Db.Updateable(bind).Where(m => m.Id == bindId).ExecuteCommand();
@@ -2717,7 +2717,7 @@
var sqlString2 = string.Empty;
sqlString2 += $"update BllArrivalNotice set Status = '1',UpdateTime= getDate(),UpdateUser = {userId} where ASNNo = '{model.AsnNo}' and Status ='0';";
sqlString2 += $"update BllArrivalNoticeDetail set Status = '1',UpdateTime= getDate(),UpdateUser = {userId} where id = '{model.AsnDetailId}' and Status ='0';";
-
+
Db.Ado.ExecuteCommand(sqlString2);
}
else if (detail.Status == "1")
@@ -2725,7 +2725,7 @@
var sqlString2 = string.Empty;
sqlString2 += $"update BllArrivalNotice set UpdateTime= getDate(),UpdateUser = {userId} where ASNNo = '{model.AsnNo}' and Status ='1';";
sqlString2 += $"update BllArrivalNoticeDetail set UpdateTime= getDate(),UpdateUser = {userId} where id = '{model.AsnDetailId}' and Status ='1';";
-
+
Db.Ado.ExecuteCommand(sqlString2);
}
@@ -2780,7 +2780,7 @@
if (string.IsNullOrEmpty(model.LotNo))
{
- throw new Exception("鐗╂枡涓嶄负绌�!");
+ throw new Exception("鐗╂枡涓嶄负绌�!");
}
else
{
@@ -2839,7 +2839,7 @@
}
//鍒ゆ柇鎵樼洏鏄惁鍦ㄥ簱澶�
var stockDetail = Db.Queryable<DataStockDetail>().First(m => m.IsDel == "0" && m.PalletNo == model.PalletNo);
- if (stockDetail != null && !string.IsNullOrEmpty(stockDetail.WareHouseNo))
+ if (stockDetail != null && !string.IsNullOrEmpty(stockDetail.WareHouseNo))
{
throw new Exception("璇ユ墭鐩樺凡鏈夊偍浣嶄俊鎭紝璇锋牳瀹烇紒");
}
@@ -2847,7 +2847,7 @@
{
throw new Exception("璇ユ墭鐩樺湪搴撳瓨宸叉湁鍏跺畠鐗╂枡鎵规淇℃伅锛岃鏍稿疄锛�");
}
-
+
#region 鍖呰
var package = Db.Queryable<SysPackag>().Where(m => m.IsDel == "0");
var sku = Db.Queryable<SysMaterials>().First(m => m.IsDel == "0" && m.SkuNo == detail.SkuNo);
@@ -2859,39 +2859,39 @@
//鍒ゆ柇鏄惁鏍囩椤靛垽鏂寘瑁�
//if (isTextTable == 0)
//{
- if (pack == null)
- {
- throw new Exception("鑾峰彇鐗╂枡鍖呰澶辫触锛岃鏍稿疄!");
- }
- if (pack.L5Num.HasValue)
- {
- pNum = (int)pack.L5Num;
- bNum = (int)pack.L4Num;
- }
- else if (pack.L4Num.HasValue)
- {
- pNum = (int)pack.L4Num;
- bNum = (int)pack.L3Num;
- }
- else if (pack.L3Num.HasValue)
- {
- pNum = (int)pack.L3Num;
- bNum = (int)pack.L2Num;
- }
- else if (pack.L2Num.HasValue)
- {
- pNum = (int)pack.L2Num;
- bNum = (int)pack.L1Num;
- }
- else if (pack.L1Num.HasValue)
- {
- pNum = (int)pack.L1Num;
- bNum = (int)pack.L1Num;
- }
- if (pNum == 0 || bNum == 0)
- {
- throw new Exception($"缁戝畾澶辫触锛寋detail.SkuNo}鐗╁搧鍖呰鏈壘鍒帮紒");
- }
+ if (pack == null)
+ {
+ throw new Exception("鑾峰彇鐗╂枡鍖呰澶辫触锛岃鏍稿疄!");
+ }
+ if (pack.L5Num.HasValue)
+ {
+ pNum = (int)pack.L5Num;
+ bNum = (int)pack.L4Num;
+ }
+ else if (pack.L4Num.HasValue)
+ {
+ pNum = (int)pack.L4Num;
+ bNum = (int)pack.L3Num;
+ }
+ else if (pack.L3Num.HasValue)
+ {
+ pNum = (int)pack.L3Num;
+ bNum = (int)pack.L2Num;
+ }
+ else if (pack.L2Num.HasValue)
+ {
+ pNum = (int)pack.L2Num;
+ bNum = (int)pack.L1Num;
+ }
+ else if (pack.L1Num.HasValue)
+ {
+ pNum = (int)pack.L1Num;
+ bNum = (int)pack.L1Num;
+ }
+ if (pNum == 0 || bNum == 0)
+ {
+ throw new Exception($"缁戝畾澶辫触锛寋detail.SkuNo}鐗╁搧鍖呰鏈壘鍒帮紒");
+ }
//}
#endregion
@@ -2911,7 +2911,7 @@
}
#endregion
//liudl && m.Status != "2" 缁勭洏鏃㈠叆搴撳畬鎴愭棤闇�鏍规嵁鎵樼洏鐘舵�佸垽鏂�
- var bind = Db.Queryable<BllPalletBind>().First(m => m.IsDel == "0" && m.ASNDetailNo == model.AsnDetailId && m.PalletNo == model.PalletNo);
+ var bind = Db.Queryable<BllPalletBind>().First(m => m.IsDel == "0" && m.ASNDetailNo == model.AsnDetailId && m.PalletNo == model.PalletNo);
var bindId = 0;
if (bind == null)
{
@@ -2988,7 +2988,7 @@
Db.Updateable(sd1).ExecuteCommand(); //淇敼璐ㄦ淇℃伅
}
- else
+ else
{
// 搴撳瓨涓嶅瓨鍦� 鎻掑叆鏁版嵁
sd1 = new DataStockDetail()
@@ -3059,7 +3059,7 @@
}
//娣诲姞搴撳瓨鏄庣粏
sdId1 = Db.Insertable(sd1).ExecuteReturnIdentity();
- }
+ }
#endregion
#region 绠辩爜淇℃伅
@@ -3260,7 +3260,7 @@
#endregion
#region 搴撳瓨鏄庣粏
- sd1.Qty = bind.Qty;
+ sd1.Qty = bind.Qty;
//鏇存敼搴撳瓨鏄庣粏鏁伴噺
Db.Updateable(sd1).Where(m => m.Id == sdId1).ExecuteCommand();
#endregion
@@ -3277,7 +3277,7 @@
{
dataStock.Qty += model.SkuQty;
}
-
+
if (bind.InspectMark == "1")
{
dataStock.IsSampling = bind.InspectMark;
@@ -3352,14 +3352,12 @@
}
}
-
//JC26缁戝畾鎵樼洏 璐存爣鐗╂枡
public void BindPalletPasteCode(PdaPalletBindVm model, int userId)
{
try
{
#region 鍒ゆ柇
-
//0锛氭垚鍝佸叆搴� 1锛氶噰璐叆搴� 3锛氶��璐у叆搴� 4锛氳溅闂翠綑鏂欏叆搴� 5锛氬叾瀹冨叆搴� 6锛氫唬鍌ㄥ叆搴�
var TypeLot = "5, 6";
@@ -3375,7 +3373,6 @@
{
throw new Exception("鎵樼洏鍙蜂笉鍙负绌�!");
}
-
//鏍规嵁鍗曟嵁鍙疯幏鍙栧叆搴撳崟鎬诲崟
var notice = Db.Queryable<BllArrivalNotice>().First(a => a.IsDel == "0" && a.ASNNo == model.AsnNo);
if (notice.Status != "0" && notice.Status != "1" && notice.Status != "2")
@@ -3397,20 +3394,16 @@
}
else
{
- if (!TypeLot.Contains(notice.Type))
- {
- throw new Exception("鐗╂枡鎵规涓嶅彲涓虹┖!");
- }
-
- model.LotNo = "";
+ throw new Exception("鐗╂枡鎵规涓嶅彲涓虹┖!");
}
}
+ //鍒ゆ柇绠辩爜淇℃伅
if (string.IsNullOrEmpty(model.BoxNo))
{
throw new Exception("绠辩爜淇℃伅涓嶅彲涓虹┖!");
}
-
+ //鏄惁杩炵画缁勬墭 0锛氬惁 1锛氭槸
if (model.IsContinue == "1")
{
if (string.IsNullOrWhiteSpace(model.TailBoxNo))
@@ -3419,15 +3412,13 @@
}
}
- var comTime = DateTime.Now;
-
- //鎵樼洏鏄惁瀛樺湪
+ //鎵樼洏淇℃伅鏄惁瀛樺湪
var pallet = Db.Queryable<SysPallets>().First(m => m.IsDel == "0" && m.PalletNo == model.PalletNo);
if (pallet == null)
{
throw new Exception("鏈煡璇㈠埌鎵樼洏淇℃伅锛岃鏍稿疄锛�");
}
- // 楠岃瘉鍏ュ簱鍗曟槑缁嗘槸鍚﹀瓨鍦�
+ //楠岃瘉鍏ュ簱鍗曟槑缁嗘槸鍚﹀瓨鍦�
var detail = Db.Queryable<BllArrivalNoticeDetail>().First(m => m.IsDel == "0" && m.Id == model.AsnDetailId && m.ASNNo == model.AsnNo && m.LotNo.Contains(model.LotNo));
if (detail == null)
{
@@ -3439,17 +3430,21 @@
{
throw new Exception("璇ユ墭鐩樺凡鏈夊偍浣嶄俊鎭紝璇锋牳瀹烇紒");
}
- if (stockDetail != null && (stockDetail.SkuNo != detail.SkuNo || stockDetail.LotNo != model.LotNo))
+ /*if (stockDetail != null && stockDetail.SkuNo != detail.SkuNo)
{
- throw new Exception("璇ユ墭鐩樺湪搴撳瓨宸叉湁鍏跺畠鐗╂枡鎵规淇℃伅锛岃鏍稿疄锛�");
- }
-
+ throw new Exception("璇ユ墭鐩樺湪搴撳瓨宸叉湁鍏跺畠鐗╂枡淇℃伅锛岃鏍稿疄锛�");
+ }*/
#endregion
- #region 鍖呰
+ //寮�鍚簨鍔�
+ Db.BeginTran();
+ //褰撳墠鏃堕棿
+ var comTime = DateTime.Now;
+ #region 鍖呰
+ var package = Db.Queryable<SysPackag>().Where(m => m.IsDel == "0");
var sku = Db.Queryable<SysMaterials>().First(m => m.IsDel == "0" && m.SkuNo == detail.SkuNo);
- var pack = Db.Queryable<SysPackag>().First(m => m.IsDel == "0" && m.PackagNo == detail.PackagNo); // liudl 鐢盨ku鍖呰缂栧彿鍙樻洿涓哄叆搴撳崟鏄庣粏鍖呰缂栧彿
+ var pack = package.First(m => m.IsDel == "0" && m.PackagNo == detail.PackagNo); // liudl 鐢盨ku鍖呰缂栧彿鍙樻洿涓哄叆搴撳崟鏄庣粏鍖呰缂栧彿
var pNum = 0;//鎵樼洏鐗╁搧鏁伴噺
var bNum = 0;//绠辩爜鐗╁搧鏁伴噺
@@ -3491,7 +3486,6 @@
#endregion
#region 楠岃瘉鏄惁鍏佽绔嬪簱鍚屾墭鐩樹笉鍚岀墿鏂欏叆搴撴垨鍚屾墭鐩樺悓鐗╂枡涓嶅悓鎵规鍏ュ簱
-
var palletBind = Db.Queryable<BllPalletBind>().First(m => m.IsDel == "0" && m.ASNNo == model.AsnNo && m.PalletNo == model.PalletNo && m.ASNDetailNo != model.AsnDetailId);
if (palletBind != null)
{
@@ -3505,1012 +3499,1368 @@
}
}
}
-
#endregion
- /* 鍥犺�冭檻鍙兘浼氭湁鎷肩(鍚岀墿鏂欎笉鍚屾壒娆�)锛岄�昏緫濡備笅
- * 鏌ヨ鍑鸿缁戝畾鎵樼洏鐨勭鐮佷俊鎭�佸垎缁勬暣鐞嗐�佸垽鏂槸鍚︽湁鎷肩(鍏佽鏈夊涓�)锛屽惊鐜坊鍔犵鐮�<->搴撳瓨绠辩爜 鍜� 瀵瑰簲鐨勬墭鐩樼粦瀹�<->搴撳瓨鎵樼洏鏄庣粏淇℃伅
- * 寰幆绠辩爜闇�瑕佸垽鏂槸鍚︽槸褰撳墠鍗曟嵁锛屽涓嶆槸锛氭洿鏂板搴斿崟鎹�
- *
- *
- */
+ #region 绠辩爜淇℃伅
+ var msgStr = $"绠卞彿涓簕model.BoxNo}";
+ var boxInfoList = new List<BllBoxInfo>();
- //#region 绠辩爜淇℃伅
- //var msgStr = $"绠卞彿涓簕model.BoxNo}";
- //var boxInfoList = new List<BllBoxInfo>();
+ //棣栫
+ var boxInfo = Db.Queryable<BllBoxInfo>().Where(m => m.IsDel == "0" && m.BoxNo == model.BoxNo).ToList();
+ if (boxInfo.Count == 0)
+ {
+ throw new Exception("绠辩爜淇℃伅涓嶅瓨鍦�!");
+ }
+ boxInfoList.AddRange(boxInfo);
+ //鏄惁杩炵画缁勬墭
+ if (model.IsContinue == "1")
+ {
+ //灏剧
+ var boxInfo2 = Db.Queryable<BllBoxInfo>().Where(m => m.IsDel == "0" && m.BoxNo == model.TailBoxNo).ToList();
+ if (boxInfo2.Count == 0)
+ {
+ throw new Exception("灏剧鐮佷俊鎭笉瀛樺湪!");
+ }
+ boxInfoList.AddRange(boxInfo2);
+ var sql = $"select * from BllBoxInfo where IsDel = '0' and boxNo>'{model.BoxNo}' and boxNo<'{model.TailBoxNo}'; ";
+ var list = Db.Ado.SqlQuery<BllBoxInfo>(sql);
+ boxInfoList.AddRange(list);
+ msgStr += $"灏剧鍙蜂负{model.TailBoxNo}";
+ }
+ //鍜岄�夋嫨鐨勬壒娆″悓鎵规鐨勭鐮佷俊鎭�
+ var sameBoxInfoList = boxInfoList.Where(w => w.LotNo == model.LotNo).ToList();
+ //鍜岄�夋嫨鐨勬壒娆′笉鍚屾壒娆$殑绠辩爜淇℃伅锛堟嫾绠辨壒娆★級
+ var notBoxInfoList = boxInfoList.Where(w => w.LotNo != model.LotNo).ToList();
+ //鎷肩鏁伴噺(鍜岄�夋嫨鐨勬壒娆′笉鍚屾壒娆$殑绠辩爜鏁伴噺)
+ decimal pinBoxQty = notBoxInfoList.Sum(s => s.Qty);
+ #endregion
- ////棣栫
- //var boxInfo = Db.Queryable<BllBoxInfo>().Where(m => m.IsDel == "0" && m.BoxNo == model.BoxNo).ToList();
- //if (boxInfo.Count == 0)
- //{
- // throw new Exception("绠辩爜淇℃伅涓嶅瓨鍦�!");
- //}
- //boxInfo = boxInfo.Where(m => m.Status == "0").ToList();
- //if (boxInfo.Count == 0)
- //{
- // throw new Exception("绠辩爜宸茶浣跨敤!");
- //}
- //boxInfoList.AddRange(boxInfo);
- ////鏄惁杩炵画缁勬墭
- //if (model.IsContinue == "1")
- //{
- // //灏剧
- // var boxInfo2 = Db.Queryable<BllBoxInfo>().Where(m => m.IsDel == "0" && m.BoxNo == model.TailBoxNo).ToList();
- // if (boxInfo2.Count == 0)
- // {
- // throw new Exception("灏剧鐮佷俊鎭笉瀛樺湪!");
- // }
- // boxInfo2 = boxInfo2.Where(m => m.Status == "0").ToList();
- // if (boxInfo2.Count == 0)
- // {
- // throw new Exception("灏剧绠辩爜宸茶浣跨敤!");
- // }
- // boxInfoList.AddRange(boxInfo2);
- // var sql = $"select * from BllBoxInfo where IsDel = '0' and Status = '0' and boxNo>'{model.BoxNo}' and boxNo<'{model.TailBoxNo}'; ";
- // var list = Db.Ado.SqlQuery<BllBoxInfo>(sql);
- // boxInfoList.AddRange(list);
- // msgStr += $"灏剧鍙蜂负{model.TailBoxNo}";
- //}
+ if (sameBoxInfoList.Count <= 0)
+ {
+ throw new Exception("绠辩爜淇℃伅涓嶅瓨鍦�!");
+ }
+ else
+ {
+ #region 鎵樼洏缁戝畾淇℃伅
+ var bind = Db.Queryable<BllPalletBind>().First(m => m.IsDel == "0" && m.ASNDetailNo == model.AsnDetailId && m.PalletNo == model.PalletNo);
+ var bindId = 0;
+ if (bind == null)
+ {
+ bind = new BllPalletBind
+ {
+ ASNNo = model.AsnNo,
+ ASNDetailNo = (int)model.AsnDetailId,
+ PalletNo = model.PalletNo,
+ PalletNo2 = "",
+ PalletNo3 = "",
+ Qty = model.SkuQty - pinBoxQty,//涓嶅寘鍚嫾绠变腑闈炲悓鎵规鏁伴噺
+ FullQty = pNum,
+ Status = "2",//鍏ュ簱瀹屾垚
+ Type = "0",
+ LotNo = model.LotNo,
+ LotText = detail.LotText,
+ SupplierLot = detail.SupplierLot,
+ //InspectMark = model.IsSample, //鏄惁鍙栨牱鎵樼洏 鍚庢湡涓氬姟寮�鍙戞椂 鎺ュ彛浼犲�奸渶娣诲姞瀵瑰簲瀛楁鍒ゆ柇
+ //SamplingQty = 0, //鍙栨牱鏁伴噺 鍚庢湡涓氬姟寮�鍙戞椂 鎺ュ彛浼犲�奸渶娣诲姞瀵瑰簲瀛楁鍒ゆ柇
+ BitPalletMark = "1",
+ IsBale = "0",
+ IsBelt = "0",
+ CreateUser = userId,
+ Demo = model.Demo,
+ };
+ // 鎻掑叆鎵樼洏缁戝畾琛�
+ bindId = Db.Insertable(bind).ExecuteReturnIdentity();
+ }
+ else
+ {
+ bindId = bind.Id;
+ bind.Qty += model.SkuQty;
+ }
+ if (bind.Qty < 0)
+ {
+ throw new Exception("缁勭洏鏁伴噺涓嶈兘灏忎簬0");
+ }
+ #endregion
- //#endregion
+ #region 搴撳瓨鏄庣粏鍜岃川妫�淇℃伅
+ //鑾峰彇璇ユ壒娆℃渶缁堣川妫�缁撴灉
+ BllQualityInspect quality = new BllQualityInspect();
+ //鍒ゆ柇鏄惁涓洪��璐у叆搴撳崟
+ if (notice.Type == "3")
+ {
+ quality = Db.Queryable<BllQualityInspect>().Where(a => a.IsDel == "0" && a.ASNNo == detail.ASNNo && a.SkuNo == detail.SkuNo && a.LotNo == detail.LotNo).OrderByDescending(a => a.CreateTime).First();
+ }
+ else
+ {
+ quality = Db.Queryable<BllQualityInspect>().Where(a => a.IsDel == "0" && a.SkuNo == detail.SkuNo && a.LotNo == detail.LotNo).OrderByDescending(a => a.CreateTime).First();
+ }
+ var tags = "0";
+ if (notice.Type == "3" || notice.Type == "4")
+ {
+ tags = "1";
+ }
- //// 鏇存敼绠辨敮鍏崇郴琛�
- //decimal factQty = 0.00m;//鎵樼洏鎬绘暟閲�
- //var isSample = "0";//鏄惁鍙栨牱
- //var sampleQty = 0m;//鍙栨牱鏁伴噺
+ // 鍒ゆ柇搴撳瓨鏄庣粏鏄惁宸叉湁姝ゆ墭鐩樹俊鎭�
+ var sd1 = Db.Queryable<DataStockDetail>().First(m => m.IsDel == "0" && m.ASNDetailNo == bind.ASNDetailNo && m.PalletNo == model.PalletNo);
+ var sdId1 = 0;
+ if (sd1 != null)
+ {
+ sdId1 = sd1.Id;
+ // 搴撳瓨宸插瓨鍦� 鏇存柊鏁版嵁
+ sd1.Qty = bind.Qty;
+ sd1.CompleteTime = comTime;
+ sd1.UpdateUser = userId;
+ sd1.UpdateTime = comTime;
- //var boxInfoStr = boxInfoList.Select(m => m.BoxNo3).ToList();//鏀爜闆嗗悎
- //var dataBoxInfo = Db.Queryable<DataBoxInfo>().Where(m => m.IsDel == "0" && boxInfoStr.Contains(m.BoxNo3));//浠庡簱瀛樹腑鑾峰彇瀵瑰簲鐨勭鐮佷俊鎭泦鍚�
+ Db.Updateable(sd1).ExecuteCommand();
+ }
+ else
+ {
+ // 搴撳瓨涓嶅瓨鍦� 鎻掑叆鏁版嵁
+ sd1 = new DataStockDetail()
+ {
+ LotNo = bind.LotNo,
+ LotText = bind.LotText,
+ SupplierLot = bind.SupplierLot,
+ SkuNo = sku.SkuNo,
+ SkuName = sku.SkuName,
+ Standard = sku.Standard,
+ Qty = bind.Qty,
+ LockQty = 0,
+ FrozenQty = 0,
+ InspectQty = 0,
+ ASNNo = bind.ASNNo,
+ ASNDetailNo = bind.ASNDetailNo,
+ WareHouseNo = "",//鎵�灞炰粨搴�
+ RoadwayNo = "",//鎵�灞炲贩閬�
+ AreaNo = "",//鎵�灞炲尯鍩�
+ LocatNo = "",//鍌ㄤ綅鍦板潃
+ PalletNo = bind.PalletNo,
+ PalletNo2 = bind.PalletNo2,
+ PalletNo3 = bind.PalletNo3,
+ PalletTags = tags,
+ CompleteTime = comTime,
+ ProductionTime = bind.ProductionTime,
+ ExpirationTime = bind.ExpirationTime,
+ Status = "0",
+ InspectMark = bind.InspectMark,
+ InspectStatus = sku.IsInspect,
+ BitPalletMark = bind.BitPalletMark,
+ PackagNo = detail.PackagNo, //liudl 鐢眘ku鐨勫寘瑁呯紪鍙峰彉涓哄叆搴撳崟鏄庣粏鐨勫寘瑁呯紪鐮�
+ IsBale = bind.IsBale,
+ IsBelt = bind.IsBelt,
- //var boxGroup = boxInfoList.GroupBy(m => new { m.BoxNo ,m.LotNo}).ToList(); //鏍规嵁绠辩爜銆佹壒姝ゅ垎缁�
- //foreach (var g in boxGroup)//21
- //{
-
- // var isYou = false;//闇�鍒ゆ柇鏄惁鏄瓨鍦ㄥ簱瀛�
- // var count = dataBoxInfo.Count(m => m.BoxNo == g.Key.BoxNo);
- // if (count >0)
- // {
- // isYou = true;
- // }
+ IsDel = "0",
+ CreateUser = 0,
+ CreateTime = comTime
+ };
- // var bind = Db.Queryable<BllPalletBind>().First(m => m.IsDel == "0" && m.ASNDetailNo == model.AsnDetailId && m.PalletNo == model.PalletNo && m.LotNo == g.Key.LotNo);
+ //缁存姢搴撳瓨鏄庣粏璐т富/渚涘簲鍟嗕俊鎭�
+ if (notice.Type == "0" || notice.Type == "2" || notice.Type == "4" || notice.Type == "6" || notice.Type == "7")//0:鎴愬搧鍏ュ簱锛�2:涓棿鍝佸叆搴�,4:杞﹂棿浣欐枡鍏ュ簱,6:浠e偍鍏ュ簱,7:瀵勫瓨鍏ュ簱
+ {
+ sd1.OwnerNo = notice.CustomerNo;//璐т富缂栫爜
+ sd1.OwnerName = notice.CustomerName;//璐т富鍚嶇О
+ }
+ else if (notice.Type == "1" || notice.Type == "5")//1:閲囪喘鍏ュ簱,2:鍏跺畠鍏ュ簱
+ {
+ sd1.SupplierNo = notice.CustomerNo;//渚涘簲鍟嗙紪鐮�
+ sd1.SupplierName = notice.CustomerName;//渚涘簲鍟嗗悕绉�
+ }
+ if (quality != null)
+ {
+ //淇敼鍚堟牸涓嶅悎鏍兼暟閲�
+ if (quality.IsQualified == "1") //鍚堟牸
+ {
+ //澧炲姞鍚堟牸鏁伴噺
+ quality.PassQty += bind.Qty;
+ sd1.InspectStatus = "1";
+ }
+ else if (quality.IsQualified == "0") //涓嶅悎鏍�
+ {
+ //澧炲姞涓嶅悎鏍兼暟閲�
+ quality.FailQty += bind.Qty;
+ sd1.InspectStatus = "2";
+ }
+ Db.Updateable(quality).ExecuteCommand(); //淇敼璐ㄦ淇℃伅
+ }
+ //娣诲姞搴撳瓨鏄庣粏
+ sdId1 = Db.Insertable(sd1).ExecuteReturnIdentity();
+ }
+ #endregion
- // var bindId = 0;
- // if (bind == null && !isYou)
- // {
- // bind = new BllPalletBind
- // {
- // ASNNo = model.AsnNo,
- // ASNDetailNo = (int)model.AsnDetailId,
- // PalletNo = model.PalletNo,
+ // 鏇存敼绠辨敮鍏崇郴琛�
+ decimal factQty = 0.00m;//鎵樼洏鎬绘暟閲�
+ var isSample = "0";//鏄惁鍙栨牱
+ var sampleQty = 0m;//鍙栨牱鏁伴噺
- // Qty = model.SkuQty,
- // FullQty = pNum,
- // Status = "2",//鍏ュ簱瀹屾垚
- // Type = "0",
- // LotNo = model.LotNo,
- // LotText = detail.LotText,
- // SupplierLot = detail.SupplierLot,
- // //InspectMark = model.IsSample, //鏄惁鍙栨牱鎵樼洏 鍚庢湡涓氬姟寮�鍙戞椂 鎺ュ彛浼犲�奸渶娣诲姞瀵瑰簲瀛楁鍒ゆ柇
- // //SamplingQty = 0, //鍙栨牱鏁伴噺 鍚庢湡涓氬姟寮�鍙戞椂 鎺ュ彛浼犲�奸渶娣诲姞瀵瑰簲瀛楁鍒ゆ柇
- // BitPalletMark = "1",
- // IsBale = "0",
- // IsBelt = "0",
- // CreateUser = userId,
- // Demo = model.Demo,
+ //鏍囩缁勬墭
+ var boxGroup = sameBoxInfoList.GroupBy(m => m.BoxNo).ToList();
+ foreach (var g in boxGroup)
+ {
+ decimal boxFullQty = 0;//绠卞唴鎬绘暟閲�
+ foreach (var box in g)
+ {
+ if (box.BindNo != null && box.BindNo != 0)
+ {
+ continue;
+ }
+ //绠卞唴鐗╂枡鎵规涓庡崟鎹槑缁嗕笉绗﹀悎
+ if (box.SkuNo != detail.SkuNo || box.LotNo != model.LotNo)
+ {
+ throw new Exception($"-1:{box.BoxNo}绠卞唴鐗╂枡鍙婃壒娆′笌鍗曟嵁涓嶄竴鑷达紝璇锋牳瀹�!");
+ }
- // };
- // // 鎻掑叆鎵樼洏缁戝畾琛�
- // bindId = Db.Insertable(bind).ExecuteReturnIdentity();
- // }
- // else
- // {
- // bindId = bind.Id;
- // bind.Qty += model.SkuQty;
- // }
- // if (bind.Qty < 0)
- // {
- // throw new Exception("缁勭洏鏁伴噺涓嶈兘灏忎簬0");
- // }
+ box.ASNNo = model.AsnNo;
+ box.ASNDetailNo = model.AsnDetailId;
+ box.BindNo = bindId;
+ box.PalletNo = model.PalletNo;
+ box.Status = "2";
+ //box.InspectMark = model.IsSample; //鏄惁鍙栨牱鎵樼洏 鍚庢湡涓氬姟寮�鍙戞椂 鎺ュ彛浼犲�奸渶娣诲姞瀵瑰簲瀛楁鍒ゆ柇
+ //box.SamplingQty = 0; //鍙栨牱鏁伴噺 鍚庢湡涓氬姟寮�鍙戞椂 鎺ュ彛浼犲�奸渶娣诲姞瀵瑰簲瀛楁鍒ゆ柇
+ box.CompleteTime = comTime;
+ box.UpdateTime = comTime;
+ box.UpdateUser = userId;
+ //box.Qty = box.Qty;
+ //box.BitBoxMark = box.Qty == box.FullQty ? "0" : "1";
- // decimal boxFullQty = 0;//绠卞唴鎬绘暟閲�
- // foreach (var box in g)//鏀爜 2
- // {
- // if (box.BindNo != null && box.BindNo != 0)
- // {
- // continue;
- // }
- // //绠卞唴鐗╂枡涓庡崟鎹槑缁嗕笉绗﹀悎 鍚屾墭鐩樺彲鍚岀墿鏂欎笉鍚屾壒娆�
- // if (box.SkuNo != detail.SkuNo)
- // {
- // throw new Exception($"-1:{box.BoxNo}绠卞唴鐗╂枡鍙婃壒娆′笌鍗曟嵁涓嶄竴鑷达紝璇锋牳瀹�!");
- // }
-
-
-
+ factQty += box.Qty;
+ boxFullQty += box.Qty;
+ if (box.InspectMark == "1") //鍒ゆ柇鏄惁鍙栨牱
+ {
+ isSample = "1";
+ sampleQty += (decimal)box.SamplingQty;
+ }
- // box.ASNNo = model.AsnNo;
- // box.ASNDetailNo = model.AsnDetailId;
- // box.BindNo = bindId;
- // box.PalletNo = model.PalletNo;
- // box.Status = "2";
- // //box.InspectMark = model.IsSample; //鏄惁鍙栨牱鎵樼洏 鍚庢湡涓氬姟寮�鍙戞椂 鎺ュ彛浼犲�奸渶娣诲姞瀵瑰簲瀛楁鍒ゆ柇
- // //box.SamplingQty = 0; //鍙栨牱鏁伴噺 鍚庢湡涓氬姟寮�鍙戞椂 鎺ュ彛浼犲�奸渶娣诲姞瀵瑰簲瀛楁鍒ゆ柇
- // box.CompleteTime = comTime;
- // box.UpdateTime = comTime;
- // box.UpdateUser = userId;
+ #region 搴撳瓨绠辩爜鏄庣粏
+ var box2 = new DataBoxInfo()
+ {
+ StockDetailId = sdId1,
+ BindNo = bind.Id,
+ BoxNo = box.BoxNo,
+ BoxNo2 = box.BoxNo2,
+ BoxNo3 = box.BoxNo3,
+ PalletNo = box.PalletNo,
+ PalletNo2 = box.PalletNo2,
+ PalletNo3 = box.PalletNo3,
+ Qty = box.Qty,
+ FullQty = box.FullQty,
+ Status = "2",//0锛氭湭缁勬墭 1锛氬凡缁勬墭 2锛氬凡鍏ュ簱 3锛氬凡鍑哄簱 4:宸插垎閰� 5锛氬凡鎷h揣
+ LotNo = box.LotNo,
+ LotText = box.LotText,
+ SkuNo = box.SkuNo,
+ SkuName = box.SkuName,
+ Standard = sku.Standard,
+ ProductionTime = box.ProductionTime,
+ SupplierLot = box.SupplierLot,
+ InspectStatus = sku.IsInspect,
+ InspectMark = box.InspectMark,
+ BitBoxMark = box.BitBoxMark,
+ ExpirationTime = box.ExpirationTime,
- // //box.Qty = box.Qty;
- // //box.BitBoxMark = box.Qty == box.FullQty ? "0" : "1";
+ CreateUser = 0,
+ CreateTime = comTime
+ };
+ //娣诲姞搴撳瓨绠辩爜鏄庣粏
+ Db.Insertable(box2).ExecuteCommand();
+ #endregion
+ }
+ if (boxFullQty > bNum)
+ {
+ throw new Exception($"缁戝畾澶辫触锛寋g.Key}绠辩爜缁戝畾鏁伴噺澶т簬璇ョ墿鍝佸寘瑁呮暟閲忥紒");
+ }
+ }
+ //鏇存敼绠辨敮鍏崇郴琛ㄤ俊鎭�
+ Db.Updateable(boxInfoList).ExecuteCommand();
- // factQty += box.Qty;
- // boxFullQty += box.Qty;
- // if (box.InspectMark == "1") //鍒ゆ柇鏄惁鍙栨牱
- // {
- // isSample = "1";
- // sampleQty += (decimal)box.SamplingQty;
- // }
+ // 鏇存柊鎵樼洏缁戝畾琛�
+ bind.Qty += factQty;
- // #region 搴撳瓨绠辩爜鏄庣粏
- // var box2 = new DataBoxInfo()
- // {
- // StockDetailId = sdId1,
- // BindNo = bind.Id,
- // BoxNo = box.BoxNo,
- // BoxNo2 = box.BoxNo2,
- // BoxNo3 = box.BoxNo3,
- // PalletNo = box.PalletNo,
- // PalletNo2 = box.PalletNo2,
- // PalletNo3 = box.PalletNo3,
- // Qty = box.Qty,
- // FullQty = box.FullQty,
- // Status = "2",//0锛氭湭缁勬墭 1锛氬凡缁勬墭 2锛氬凡鍏ュ簱 3锛氬凡鍑哄簱 4:宸插垎閰� 5锛氬凡鎷h揣
- // LotNo = box.LotNo,
- // LotText = box.LotText,
- // SkuNo = box.SkuNo,
- // SkuName = box.SkuName,
- // Standard = sku.Standard,
- // ProductionTime = box.ProductionTime,
- // SupplierLot = box.SupplierLot,
- // InspectStatus = sku.IsInspect,
- // InspectMark = box.InspectMark,
- // BitBoxMark = box.BitBoxMark,
- // ExpirationTime = box.ExpirationTime,
+ if (bind.FullQty < bind.Qty)
+ {
+ throw new Exception("鎵樼洏缁戝畾鏁伴噺宸茶秴鍑鸿鐗╂枡鍖呰鏁伴噺");
+ }
- // CreateUser = 0,
- // CreateTime = comTime
- // };
- // //娣诲姞搴撳瓨绠辩爜鏄庣粏
- // Db.Insertable(box2).ExecuteCommand();
- // #endregion
- // }
- // if (boxFullQty > bNum)
- // {
- // throw new Exception($"缁戝畾澶辫触锛寋g.Key}绠辩爜缁戝畾鏁伴噺澶т簬璇ョ墿鍝佸寘瑁呮暟閲忥紒");
- // }
- //}
- //Db.Updateable(boxInfoList).ExecuteCommand();
+ if (bind.FullQty == bind.Qty)
+ {
+ bind.BitPalletMark = "0";
+ sd1.BitPalletMark = "0";
+ }
+ if (bind.Qty > pNum)
+ {
+ throw new Exception($"缁戝畾澶辫触锛寋bind.PalletNo}鎵樼洏缁戝畾鏁伴噺澶т簬璇ョ墿鍝佹墭鐩樺寘瑁呮暟閲忥紒");
+ }
+ if (isSample == "1")
+ {
+ bind.InspectMark = "1";
+ bind.SamplingQty = bind.SamplingQty == null ? sampleQty : bind.SamplingQty + sampleQty;
+ }
+ Db.Updateable(bind).Where(m => m.Id == bindId).ExecuteCommand();
- //#region 搴撳瓨鏄庣粏
- ////鑾峰彇璇ユ壒娆℃渶缁堣川妫�缁撴灉
- //BllQualityInspect quality = new BllQualityInspect();
- ////鍒ゆ柇鏄惁涓洪��璐у叆搴撳崟
- //if (notice.Type == "3")
- //{
- // quality = Db.Queryable<BllQualityInspect>().Where(a => a.IsDel == "0" && a.ASNNo == detail.ASNNo && a.SkuNo == detail.SkuNo && a.LotNo == detail.LotNo).OrderByDescending(a => a.CreateTime).First();
- //}
- //else
- //{
- // quality = Db.Queryable<BllQualityInspect>().Where(a => a.IsDel == "0" && a.SkuNo == detail.SkuNo && a.LotNo == detail.LotNo).OrderByDescending(a => a.CreateTime).First();
- //}
- //var tags = "0";
- //if (notice.Type == "3" || notice.Type == "4")
- //{
- // tags = "1";
- //}
+ #region 鍏ュ簱鍗曞強鏄庣粏
+ detail.FactQty += factQty;//宸茬粍鏁伴噺
+ detail.CompleteQty += factQty;//瀹屾垚鏁伴噺
+ if (isSample == "1") //鍚庢湡涓氬姟寮�鍙戞椂 鎺ュ彛浼犲�兼敼涓哄垽鏂槸鍚﹀彇鏍�
+ {
+ detail.IsSampling = "1";
+ }
+ detail.Status = "1";//0锛氱瓑寰呮墽琛� 1锛氭鍦ㄦ墽琛� 2锛氭墽琛屽畬鎴�
+ if (detail.CompleteQty >= detail.Qty)
+ {
+ detail.Status = "2";
+ detail.CompleteTime = comTime;
+ }
+ detail.UpdateUser = userId;
+ detail.UpdateTime = comTime;
+ //鏇存柊鍏ュ簱鍗曟槑缁�
+ Db.Updateable(detail).ExecuteCommand();
- //// 鍒ゆ柇搴撳瓨鏄庣粏鏄惁宸叉湁姝ゆ墭鐩樹俊鎭�
- //var sd1 = Db.Queryable<DataStockDetail>()
- // .First(m => m.IsDel == "0" && m.ASNDetailNo == bind.ASNDetailNo && m.PalletNo == model.PalletNo);
- //var sdId1 = 0;
- //if (sd1 != null)
- //{
- // sdId1 = sd1.Id;
- // // 搴撳瓨宸插瓨鍦� 鏇存柊鏁版嵁
- // sd1.Qty = bind.Qty;
- // sd1.CompleteTime = comTime;
- // sd1.UpdateUser = userId;
- // sd1.UpdateTime = comTime;
+ notice.UpdateUser = userId;
+ notice.UpdateTime = comTime;
+ if (notice.Status == "0")
+ {
+ notice.Status = "1";
+ }
+ var asnDetailNum = Db.Queryable<BllArrivalNoticeDetail>().Count(m => m.IsDel == "0" && m.ASNNo == detail.ASNNo && m.Status != "2");
+ if (asnDetailNum == 0)
+ {
+ notice.Status = "2";//鎵ц瀹屾垚
+ notice.CompleteTime = comTime;//瀹屾垚鏃堕棿
+ }
+ //鏇存柊鍏ュ簱鍗�
+ Db.Updateable(notice).ExecuteCommand();
+ #endregion
- // Db.Updateable(sd1).ExecuteCommand(); //淇敼璐ㄦ淇℃伅
- //}
- //else
- //{
- // // 搴撳瓨涓嶅瓨鍦� 鎻掑叆鏁版嵁
- // sd1 = new DataStockDetail()
- // {
- // LotNo = bind.LotNo,
- // LotText = bind.LotText,
- // SupplierLot = bind.SupplierLot,
- // SkuNo = sku.SkuNo,
- // SkuName = sku.SkuName,
- // Standard = sku.Standard,
- // Qty = bind.Qty,
- // LockQty = 0,
- // FrozenQty = 0,
- // InspectQty = 0,
- // ASNNo = bind.ASNNo,
- // ASNDetailNo = bind.ASNDetailNo,
- // WareHouseNo = "",//鎵�灞炰粨搴�
- // RoadwayNo = "",//鎵�灞炲贩閬�
- // AreaNo = "",//鎵�灞炲尯鍩�
- // LocatNo = "",//鍌ㄤ綅鍦板潃
- // PalletNo = bind.PalletNo,
- // PalletNo2 = bind.PalletNo2,
- // PalletNo3 = bind.PalletNo3,
- // PalletTags = tags,
- // CompleteTime = comTime,
- // ProductionTime = bind.ProductionTime,
- // ExpirationTime = bind.ExpirationTime,
- // Status = "0",
- // InspectMark = bind.InspectMark,
- // InspectStatus = sku.IsInspect,
- // BitPalletMark = bind.BitPalletMark,
- // PackagNo = detail.PackagNo, //liudl 鐢眘ku鐨勫寘瑁呯紪鍙峰彉涓哄叆搴撳崟鏄庣粏鐨勫寘瑁呯紪鐮�
- // IsBale = bind.IsBale,
- // IsBelt = bind.IsBelt,
+ #region 搴撳瓨鏄庣粏
+ sd1.Qty = bind.Qty;
+ //鏇存敼搴撳瓨鏄庣粏鏁伴噺
+ Db.Updateable(sd1).Where(m => m.Id == sdId1).ExecuteCommand();
+ #endregion
- // IsDel = "0",
- // CreateUser = 0,
- // CreateTime = comTime
- // };
+ #region 搴撳瓨
+ var dataStock = Db.Queryable<DataStock>().First(m => m.IsDel == "0" && m.SkuNo == sku.SkuNo && m.LotNo == bind.LotNo);
+ if (dataStock != null)
+ {
+ dataStock.Qty += factQty;
- // //缁存姢搴撳瓨鏄庣粏璐т富/渚涘簲鍟嗕俊鎭�
- // if (notice.Type == "0" || notice.Type == "2" || notice.Type == "4" || notice.Type == "6" || notice.Type == "7")//0:鎴愬搧鍏ュ簱锛�2:涓棿鍝佸叆搴�,4:杞﹂棿浣欐枡鍏ュ簱,6:浠e偍鍏ュ簱,7:瀵勫瓨鍏ュ簱
- // {
- // sd1.OwnerNo = notice.CustomerNo;//璐т富缂栫爜
- // sd1.OwnerName = notice.CustomerName;//璐т富鍚嶇О
- // }
- // else if (notice.Type == "1" || notice.Type == "5")//1:閲囪喘鍏ュ簱,2:鍏跺畠鍏ュ簱
- // {
- // sd1.SupplierNo = notice.CustomerNo;//渚涘簲鍟嗙紪鐮�
- // sd1.SupplierName = notice.CustomerName;//渚涘簲鍟嗗悕绉�
- // }
- // if (quality != null)
- // {
- // //淇敼鍚堟牸涓嶅悎鏍兼暟閲�
- // if (quality.IsQualified == "1") //鍚堟牸
- // {
- // //澧炲姞鍚堟牸鏁伴噺
- // quality.PassQty += bind.Qty;
- // sd1.InspectStatus = "1";
- // }
- // else if (quality.IsQualified == "0") //涓嶅悎鏍�
- // {
- // //澧炲姞涓嶅悎鏍兼暟閲�
- // quality.FailQty += bind.Qty;
- // sd1.InspectStatus = "2";
- // }
- // Db.Updateable(quality).ExecuteCommand(); //淇敼璐ㄦ淇℃伅
- // }
- // //娣诲姞搴撳瓨鏄庣粏
- // sdId1 = Db.Insertable(sd1).ExecuteReturnIdentity();
- //}
- //#endregion
+ if (bind.InspectMark == "1")
+ {
+ dataStock.IsSampling = bind.InspectMark;
+ }
+ Db.Updateable(dataStock).ExecuteCommand();
+ }
+ else
+ {
+ var stock = new DataStock()
+ {
+ SkuNo = sku.SkuNo,
+ SkuName = sku.SkuName,
+ Standard = sku.Standard,
+ LotNo = bind.LotNo,
+ LotText = bind.LotText,
+ Qty = bind.Qty,
+ LockQty = 0,
+ FrozenQty = 0,
+ IsSampling = bind.InspectMark,
+ IsDel = "0",
+ CreateUser = userId,
+ CreateTime = comTime
+ };
+ //缁存姢搴撳瓨璐т富淇℃伅
+ if (notice.Type == "0" || notice.Type == "2" || notice.Type == "4" || notice.Type == "6" || notice.Type == "7")//0:鎴愬搧鍏ュ簱锛�2:涓棿鍝佸叆搴�,4:杞﹂棿浣欐枡鍏ュ簱,6:浠e偍鍏ュ簱,7:瀵勫瓨鍏ュ簱
+ {
+ stock.OwnerNo = notice.CustomerNo;//璐т富缂栫爜
+ stock.OwnerName = notice.CustomerName;//璐т富鍚嶇О
+ }
+ Db.Insertable(stock).ExecuteCommand();
+ }
+ #endregion
- //#region 绠辩爜淇℃伅
- //var msgStr = $"绠卞彿涓簕model.BoxNo}";
- //var boxInfoList = new List<BllBoxInfo>();
+ #region 璐ㄦ璇烽獙
+ if ((notice.Type == "1" || notice.Type == "4" || notice.Type == "5") && sku.IsInspect != "1")
+ {
+ var qualityRequest = Db.Queryable<BllQualityInspectionRequest>().First(m => m.IsDel == "0" && m.SkuNo == sku.SkuNo && m.LotNo == bind.LotNo && m.SupplierLot == bind.SupplierLot);
+ if (qualityRequest == null)
+ {
+ string qcNo = new Common().GetMaxNo("QC");
+ qualityRequest = new BllQualityInspectionRequest();
+ qualityRequest.QcNo = qcNo;
+ qualityRequest.Status = "0";
+ qualityRequest.SkuNo = sku.SkuNo;
+ qualityRequest.SkuName = sku.SkuName;
+ qualityRequest.LotNo = bind.LotNo;
+ qualityRequest.SupplierLot = bind.SupplierLot;
+ qualityRequest.Qty = detail.Qty;
+ qualityRequest.SamplingQty = 0;
+ qualityRequest.ASNNo = detail.ASNNo;
+ qualityRequest.CreateUser = userId;
+ qualityRequest.CreateTime = comTime;
+ //娣诲姞璐ㄦ璇烽獙鍗�
+ Db.Insertable(qualityRequest).ExecuteCommand();
+ }
+ }
+ #endregion
+ }
+ //鎷肩
+ if (notBoxInfoList.Count > 0)
+ {
+ var gbox = notBoxInfoList.GroupBy(g => g.BoxNo).ToList();
+ if (gbox.Count > 1)
+ {
+ throw new Exception("涓�涓墭鐩樹笂鍙兘鏈�1涓嫾绠�!");
+ }
+ gbox = notBoxInfoList.GroupBy(g => g.LotNo).ToList();
+ if (gbox.Count > 1)
+ {
+ throw new Exception("涓�涓鍐呮渶澶氳兘鏈�2涓笉鍚屾壒娆$墿鏂�!");
+ }
+ var pinBoxNo = notBoxInfoList[0].BoxNo;//鎷肩绠辩爜
+ var pinBoxLotNo = notBoxInfoList[0].LotNo;//鎷肩鎵规鍙�
- ////棣栫
- //var boxInfo = Db.Queryable<BllBoxInfo>().Where(m => m.IsDel == "0" && m.BoxNo == model.BoxNo).ToList();
- //if (boxInfo.Count == 0)
- //{
- // throw new Exception("绠辩爜淇℃伅涓嶅瓨鍦�!");
- //}
- //boxInfo = boxInfo.Where(m => m.Status == "0").ToList();
- //if (boxInfo.Count == 0)
- //{
- // throw new Exception("绠辩爜宸茶浣跨敤!");
- //}
- //boxInfoList.AddRange(boxInfo);
- ////鏄惁杩炵画缁勬墭
- //if (model.IsContinue == "1")
- //{
- // //灏剧
- // var boxInfo2 = Db.Queryable<BllBoxInfo>().Where(m => m.IsDel == "0" && m.BoxNo == model.TailBoxNo).ToList();
- // if (boxInfo2.Count == 0)
- // {
- // throw new Exception("灏剧鐮佷俊鎭笉瀛樺湪!");
- // }
- // boxInfo2 = boxInfo2.Where(m => m.Status == "0").ToList();
- // if (boxInfo2.Count == 0)
- // {
- // throw new Exception("灏剧绠辩爜宸茶浣跨敤!");
- // }
- // boxInfoList.AddRange(boxInfo2);
- // var sql = $"select * from BllBoxInfo where IsDel = '0' and Status = '0' and boxNo>'{model.BoxNo}' and boxNo<'{model.TailBoxNo}'; ";
- // var list = Db.Ado.SqlQuery<BllBoxInfo>(sql);
- // boxInfoList.AddRange(list);
- // msgStr += $"灏剧鍙蜂负{model.TailBoxNo}";
- //}
+ var dataBoxList = Db.Queryable<DataBoxInfo>().Where(w => w.IsDel == "0" && w.BoxNo == pinBoxNo && w.LotNo == pinBoxLotNo).ToList();
+ if (dataBoxList.Count > 0)//宸叉湁搴撳瓨
+ {
+ //鍘熸墭鐩樼粦瀹氫俊鎭�
+ var oldPalletBind = Db.Queryable<BllPalletBind>().First(w => w.Id == notBoxInfoList[0].BindNo);
+ //鍘熷叆搴撳崟鏄庣粏
+ var oldAsnDetail = Db.Queryable<BllArrivalNoticeDetail>().First(w => w.Id == oldPalletBind.ASNDetailNo);
+ #region 鎵樼洏缁戝畾淇℃伅
+ var bind = Db.Queryable<BllPalletBind>().First(m => m.IsDel == "0" && m.ASNDetailNo == oldAsnDetail.Id && m.PalletNo == model.PalletNo);
+ var bindId = 0;
+ if (bind == null)
+ {
+ bind = new BllPalletBind
+ {
+ ASNNo = oldAsnDetail.ASNNo,
+ ASNDetailNo = oldAsnDetail.Id,
+ PalletNo = model.PalletNo,
+ PalletNo2 = "",
+ PalletNo3 = "",
+ Qty = pinBoxQty,
+ FullQty = pNum,
+ Status = "2",//鍏ュ簱瀹屾垚
+ Type = "0",
+ LotNo = pinBoxLotNo,
+ LotText = oldAsnDetail.LotText,
+ SupplierLot = oldAsnDetail.SupplierLot,
+ //InspectMark = model.IsSample, //鏄惁鍙栨牱鎵樼洏 鍚庢湡涓氬姟寮�鍙戞椂 鎺ュ彛浼犲�奸渶娣诲姞瀵瑰簲瀛楁鍒ゆ柇
+ //SamplingQty = 0, //鍙栨牱鏁伴噺 鍚庢湡涓氬姟寮�鍙戞椂 鎺ュ彛浼犲�奸渶娣诲姞瀵瑰簲瀛楁鍒ゆ柇
+ BitPalletMark = "1",
+ IsBale = "0",
+ IsBelt = "0",
+ CreateUser = userId,
+ Demo = model.Demo,
+ };
+ // 鎻掑叆鎵樼洏缁戝畾琛�
+ bindId = Db.Insertable(bind).ExecuteReturnIdentity();
+ }
+ else
+ {
+ bindId = bind.Id;
+ bind.Qty += pinBoxQty;
- //#endregion
+ Db.Updateable(bind).ExecuteCommand();
+ }
+ #endregion
- //// 鏇存敼绠辨敮鍏崇郴琛�
- //decimal factQty = 0.00m;//鎵樼洏鎬绘暟閲�
- //var isSample = "0";//鏄惁鍙栨牱
- //var sampleQty = 0m;//鍙栨牱鏁伴噺
+ // 鎻掑叆搴撳瓨鏄庣粏鏁版嵁
+ var sd1 = new DataStockDetail()
+ {
+ LotNo = pinBoxNo,
+ LotText = notBoxInfoList[0].LotText,
+ SupplierLot = notBoxInfoList[0].SupplierLot,
+ SkuNo = sku.SkuNo,
+ SkuName = sku.SkuName,
+ Standard = sku.Standard,
+ Qty = pinBoxQty,
+ LockQty = 0,
+ FrozenQty = 0,
+ InspectQty = 0,
+ ASNNo = oldPalletBind.ASNNo,
+ ASNDetailNo = oldPalletBind.ASNDetailNo,
+ WareHouseNo = "",//鎵�灞炰粨搴�
+ RoadwayNo = "",//鎵�灞炲贩閬�
+ AreaNo = "",//鎵�灞炲尯鍩�
+ LocatNo = "",//鍌ㄤ綅鍦板潃
+ PalletNo = oldPalletBind.PalletNo,
+ PalletNo2 = oldPalletBind.PalletNo2,
+ PalletNo3 = oldPalletBind.PalletNo3,
+ PalletTags = "0",
+ CompleteTime = comTime,
+ ProductionTime = oldPalletBind.ProductionTime,
+ ExpirationTime = oldPalletBind.ExpirationTime,
+ Status = "0",
+ InspectMark = oldPalletBind.InspectMark,
+ InspectStatus = sku.IsInspect,
+ BitPalletMark = oldPalletBind.BitPalletMark,
+ PackagNo = oldAsnDetail.PackagNo,
+ IsBale = oldPalletBind.IsBale,
+ IsBelt = oldPalletBind.IsBelt,
+ IsDel = "0",
+ CreateUser = 0,
+ CreateTime = comTime
+ };
+ //娣诲姞搴撳瓨鏄庣粏
+ var sdId1 = Db.Insertable(sd1).ExecuteReturnIdentity();
+ foreach (var item in dataBoxList)
+ {
+ item.StockDetailId = sdId1;//搴撳瓨鏄庣粏id
+ item.BindNo = bind.Id;//鎵樼洏缁戝畾id
+ }
+ //鏇存柊搴撳瓨绠辨敮鏄庣粏琛�
+ Db.Updateable(dataBoxList).ExecuteCommand();
- //var boxGroup = boxInfoList.GroupBy(m => m.BoxNo).ToList();
- //foreach (var g in boxGroup)
- //{
- // decimal boxFullQty = 0;//绠卞唴鎬绘暟閲�
- // foreach (var box in g)
- // {
- // if (box.BindNo != null && box.BindNo != 0)
- // {
- // continue;
- // }
- // //绠卞唴鐗╂枡鎵规涓庡崟鎹槑缁嗕笉绗﹀悎
- // if (box.SkuNo != detail.SkuNo || box.LotNo != model.LotNo)
- // {
- // throw new Exception($"-1:{box.BoxNo}绠卞唴鐗╂枡鍙婃壒娆′笌鍗曟嵁涓嶄竴鑷达紝璇锋牳瀹�!");
- // }
+ //鎵樼洏瑙g粦淇℃伅
+ var palletUnbind = Db.Queryable<BllPalletUnbind>().First(w => w.IsDel == "0" && w.UpbindPalletNo == oldPalletBind.PalletNo && w.BoxNo == pinBoxNo);
+ if (palletUnbind == null)
+ {
+ throw new Exception("鎷肩鐨勬墭鐩樿В缁戜俊鎭笉瀛樺湪!");
+ }
+ palletUnbind.BindPalletNo = model.PalletNo;//缁戝畾鎵樼洏鍙�
+ palletUnbind.UpdateTime = comTime;
+ palletUnbind.UpdateUser = userId;
+ //鏇存柊鎵樼洏瑙g粦缁戝畾琛ㄤ俊鎭�
+ Db.Updateable(palletUnbind).ExecuteCommand();
+ }
+ else
+ {
+ string sql = $@"SELECT detail.* FROM BllArrivalNoticeDetail as detail
+ JOIN BllArrivalNotice as notice ON detail.ASNNo=notice.ASNNo
+ WHERE notice.IsDel='0'
+ AND notice.Status='1'
+ AND detail.IsDel='0'
+ AND detail.LotNo='{pinBoxLotNo}'
+ AND detail.SkuNo='{sku.SkuNo}'
+ ORDER BY detail.CreateTime ";
+ //鎵惧埌鎷肩鍐呭叾浠栨壒娆℃墍灞炲叆搴撳崟鏄庣粏
+ var arrDetail = Db.Ado.SqlQuery<BllArrivalNoticeDetail>(sql).FirstOrDefault();
+ if (arrDetail == null)
+ {
+ throw new Exception("鎷肩鍐呯墿鏂欐墍灞炲叆搴撳崟鏄庣粏涓嶅瓨鍦�!");
+ }
+ //鎵惧埌鎷肩鍐呭叾浠栨壒娆℃墍灞炲叆搴撳崟
+ var arrNotice = Db.Queryable<BllArrivalNotice>().First(w => w.IsDel == "0" && w.ASNNo == arrDetail.ASNNo && w.Status == "1");
+ if (arrNotice == null)
+ {
+ throw new Exception("鎷肩鍐呯墿鏂欐墍灞炲叆搴撳崟涓嶅瓨鍦�!");
+ }
+ #region 鎵樼洏缁戝畾淇℃伅
+ var bind = Db.Queryable<BllPalletBind>().First(m => m.IsDel == "0" && m.ASNDetailNo == arrDetail.Id && m.PalletNo == model.PalletNo);
+ var bindId = 0;
+ if (bind == null)
+ {
+ bind = new BllPalletBind
+ {
+ ASNNo = arrDetail.ASNNo,
+ ASNDetailNo = arrDetail.Id,
+ PalletNo = model.PalletNo,
+ PalletNo2 = "",
+ PalletNo3 = "",
+ Qty = pinBoxQty,
+ FullQty = pNum,
+ Status = "2",//鍏ュ簱瀹屾垚
+ Type = "0",
+ LotNo = pinBoxLotNo,
+ LotText = arrDetail.LotText,
+ SupplierLot = arrDetail.SupplierLot,
+ //InspectMark = model.IsSample, //鏄惁鍙栨牱鎵樼洏 鍚庢湡涓氬姟寮�鍙戞椂 鎺ュ彛浼犲�奸渶娣诲姞瀵瑰簲瀛楁鍒ゆ柇
+ //SamplingQty = 0, //鍙栨牱鏁伴噺 鍚庢湡涓氬姟寮�鍙戞椂 鎺ュ彛浼犲�奸渶娣诲姞瀵瑰簲瀛楁鍒ゆ柇
+ BitPalletMark = "1",
+ IsBale = "0",
+ IsBelt = "0",
+ CreateUser = userId,
+ Demo = model.Demo,
+ };
+ // 鎻掑叆鎵樼洏缁戝畾琛�
+ bindId = Db.Insertable(bind).ExecuteReturnIdentity();
+ }
+ else
+ {
+ bindId = bind.Id;
+ bind.Qty += pinBoxQty;
- // box.ASNNo = model.AsnNo;
- // box.ASNDetailNo = model.AsnDetailId;
- // box.BindNo = bindId;
- // box.PalletNo = model.PalletNo;
- // box.Status = "2";
- // //box.InspectMark = model.IsSample; //鏄惁鍙栨牱鎵樼洏 鍚庢湡涓氬姟寮�鍙戞椂 鎺ュ彛浼犲�奸渶娣诲姞瀵瑰簲瀛楁鍒ゆ柇
- // //box.SamplingQty = 0; //鍙栨牱鏁伴噺 鍚庢湡涓氬姟寮�鍙戞椂 鎺ュ彛浼犲�奸渶娣诲姞瀵瑰簲瀛楁鍒ゆ柇
- // box.CompleteTime = comTime;
- // box.UpdateTime = comTime;
- // box.UpdateUser = userId;
+ Db.Updateable(bind).ExecuteCommand();
+ }
+ #endregion
- // //box.Qty = box.Qty;
- // //box.BitBoxMark = box.Qty == box.FullQty ? "0" : "1";
+ #region 搴撳瓨鏄庣粏鍜岃川妫�淇℃伅
+ //鑾峰彇璇ユ壒娆℃渶缁堣川妫�缁撴灉
+ BllQualityInspect quality = new BllQualityInspect();
+ //鍒ゆ柇鏄惁涓洪��璐у叆搴撳崟
+ if (arrNotice.Type == "3")
+ {
+ quality = Db.Queryable<BllQualityInspect>().Where(a => a.IsDel == "0" && a.ASNNo == arrDetail.ASNNo && a.SkuNo == arrDetail.SkuNo && a.LotNo == arrDetail.LotNo).OrderByDescending(a => a.CreateTime).First();
+ }
+ else
+ {
+ quality = Db.Queryable<BllQualityInspect>().Where(a => a.IsDel == "0" && a.SkuNo == arrDetail.SkuNo && a.LotNo == arrDetail.LotNo).OrderByDescending(a => a.CreateTime).First();
+ }
+ var tags = "0";
+ if (arrNotice.Type == "3" || arrNotice.Type == "4")
+ {
+ tags = "1";
+ }
- // factQty += box.Qty;
- // boxFullQty += box.Qty;
- // if (box.InspectMark == "1") //鍒ゆ柇鏄惁鍙栨牱
- // {
- // isSample = "1";
- // sampleQty += (decimal)box.SamplingQty;
- // }
+ // 鍒ゆ柇搴撳瓨鏄庣粏鏄惁宸叉湁姝ゆ墭鐩樹俊鎭�
+ var sd1 = Db.Queryable<DataStockDetail>().First(m => m.IsDel == "0" && m.ASNDetailNo == arrDetail.Id && m.PalletNo == model.PalletNo);
+ var sdId1 = 0;
+ if (sd1 != null)
+ {
+ sdId1 = sd1.Id;
+ // 搴撳瓨宸插瓨鍦� 鏇存柊鏁版嵁
+ sd1.Qty = pinBoxQty;
+ sd1.CompleteTime = comTime;
+ sd1.UpdateUser = userId;
+ sd1.UpdateTime = comTime;
- // #region 搴撳瓨绠辩爜鏄庣粏
- // var box2 = new DataBoxInfo()
- // {
- // StockDetailId = sdId1,
- // BindNo = bind.Id,
- // BoxNo = box.BoxNo,
- // BoxNo2 = box.BoxNo2,
- // BoxNo3 = box.BoxNo3,
- // PalletNo = box.PalletNo,
- // PalletNo2 = box.PalletNo2,
- // PalletNo3 = box.PalletNo3,
- // Qty = box.Qty,
- // FullQty = box.FullQty,
- // Status = "2",//0锛氭湭缁勬墭 1锛氬凡缁勬墭 2锛氬凡鍏ュ簱 3锛氬凡鍑哄簱 4:宸插垎閰� 5锛氬凡鎷h揣
- // LotNo = box.LotNo,
- // LotText = box.LotText,
- // SkuNo = box.SkuNo,
- // SkuName = box.SkuName,
- // Standard = sku.Standard,
- // ProductionTime = box.ProductionTime,
- // SupplierLot = box.SupplierLot,
- // InspectStatus = sku.IsInspect,
- // InspectMark = box.InspectMark,
- // BitBoxMark = box.BitBoxMark,
- // ExpirationTime = box.ExpirationTime,
+ Db.Updateable(sd1).ExecuteCommand();
+ }
+ else
+ {
+ // 搴撳瓨涓嶅瓨鍦� 鎻掑叆鏁版嵁
+ sd1 = new DataStockDetail()
+ {
+ LotNo = pinBoxLotNo,
+ LotText = notBoxInfoList[0].LotText,
+ SupplierLot = bind.SupplierLot,
+ SkuNo = sku.SkuNo,
+ SkuName = sku.SkuName,
+ Standard = sku.Standard,
+ Qty = pinBoxQty,
+ LockQty = 0,
+ FrozenQty = 0,
+ InspectQty = 0,
+ ASNNo = arrDetail.ASNNo,
+ ASNDetailNo = arrDetail.Id,
+ WareHouseNo = "",//鎵�灞炰粨搴�
+ RoadwayNo = "",//鎵�灞炲贩閬�
+ AreaNo = "",//鎵�灞炲尯鍩�
+ LocatNo = "",//鍌ㄤ綅鍦板潃
+ PalletNo = bind.PalletNo,
+ PalletNo2 = bind.PalletNo2,
+ PalletNo3 = bind.PalletNo3,
+ PalletTags = tags,
+ CompleteTime = comTime,
+ ProductionTime = bind.ProductionTime,
+ ExpirationTime = bind.ExpirationTime,
+ Status = "0",
+ InspectMark = bind.InspectMark,
+ InspectStatus = sku.IsInspect,
+ BitPalletMark = bind.BitPalletMark,
+ PackagNo = detail.PackagNo, //liudl 鐢眘ku鐨勫寘瑁呯紪鍙峰彉涓哄叆搴撳崟鏄庣粏鐨勫寘瑁呯紪鐮�
+ IsBale = bind.IsBale,
+ IsBelt = bind.IsBelt,
- // CreateUser = 0,
- // CreateTime = comTime
- // };
- // //娣诲姞搴撳瓨绠辩爜鏄庣粏
- // Db.Insertable(box2).ExecuteCommand();
- // #endregion
- // }
- // if (boxFullQty > bNum)
- // {
- // throw new Exception($"缁戝畾澶辫触锛寋g.Key}绠辩爜缁戝畾鏁伴噺澶т簬璇ョ墿鍝佸寘瑁呮暟閲忥紒");
- // }
- //}
- //Db.Updateable(boxInfoList).ExecuteCommand();
+ IsDel = "0",
+ CreateUser = 0,
+ CreateTime = comTime
+ };
- //// 鏇存柊鎵樼洏缁戝畾琛�
- //bind.Qty += factQty;
+ //缁存姢搴撳瓨鏄庣粏璐т富/渚涘簲鍟嗕俊鎭�
+ if (arrNotice.Type == "0" || arrNotice.Type == "2" || arrNotice.Type == "4" || arrNotice.Type == "6" || arrNotice.Type == "7")//0:鎴愬搧鍏ュ簱锛�2:涓棿鍝佸叆搴�,4:杞﹂棿浣欐枡鍏ュ簱,6:浠e偍鍏ュ簱,7:瀵勫瓨鍏ュ簱
+ {
+ sd1.OwnerNo = arrNotice.CustomerNo;//璐т富缂栫爜
+ sd1.OwnerName = arrNotice.CustomerName;//璐т富鍚嶇О
+ }
+ else if (arrNotice.Type == "1" || arrNotice.Type == "5")//1:閲囪喘鍏ュ簱,2:鍏跺畠鍏ュ簱
+ {
+ sd1.SupplierNo = arrNotice.CustomerNo;//渚涘簲鍟嗙紪鐮�
+ sd1.SupplierName = arrNotice.CustomerName;//渚涘簲鍟嗗悕绉�
+ }
+ if (quality != null)
+ {
+ //淇敼鍚堟牸涓嶅悎鏍兼暟閲�
+ if (quality.IsQualified == "1") //鍚堟牸
+ {
+ //澧炲姞鍚堟牸鏁伴噺
+ quality.PassQty += bind.Qty;
+ sd1.InspectStatus = "1";
+ }
+ else if (quality.IsQualified == "0") //涓嶅悎鏍�
+ {
+ //澧炲姞涓嶅悎鏍兼暟閲�
+ quality.FailQty += bind.Qty;
+ sd1.InspectStatus = "2";
+ }
+ Db.Updateable(quality).ExecuteCommand(); //淇敼璐ㄦ淇℃伅
+ }
+ //娣诲姞搴撳瓨鏄庣粏
+ sdId1 = Db.Insertable(sd1).ExecuteReturnIdentity();
+ }
+ #endregion
- ////if (bind.FullQty < bind.Qty && isTextTable == 0)
- //if (bind.FullQty < bind.Qty)
- //{
- // throw new Exception("鎵樼洏缁戝畾鏁伴噺宸茶秴鍑鸿鐗╂枡鍖呰鏁伴噺");
- //}
+ // 鏇存敼绠辨敮鍏崇郴琛�
+ decimal factQty = 0.00m;//鎵樼洏鎬绘暟閲�
+ var isSample = "0";//鏄惁鍙栨牱
+ var sampleQty = 0m;//鍙栨牱鏁伴噺
- //if (bind.FullQty == bind.Qty)
- //{
- // bind.BitPalletMark = "0";
- // sd1.BitPalletMark = "0";
- //}
- ////if (bind.Qty > pNum && isTextTable == 0)
- //if (bind.Qty > pNum)
- //{
- // throw new Exception($"缁戝畾澶辫触锛寋bind.PalletNo}鎵樼洏缁戝畾鏁伴噺澶т簬璇ョ墿鍝佹墭鐩樺寘瑁呮暟閲忥紒");
- //}
+ //鏍囩缁勬墭
+ var boxGroup = notBoxInfoList.GroupBy(m => m.BoxNo).ToList();
+ foreach (var g in boxGroup)
+ {
+ decimal boxFullQty = 0;//绠卞唴鎬绘暟閲�
+ foreach (var box in g)
+ {
+ if (box.BindNo != null && box.BindNo != 0)
+ {
+ continue;
+ }
+ //绠卞唴鐗╂枡鎵规涓庡崟鎹槑缁嗕笉绗﹀悎
+ if (box.SkuNo != detail.SkuNo || box.LotNo != model.LotNo)
+ {
+ throw new Exception($"-1:{box.BoxNo}绠卞唴鐗╂枡鍙婃壒娆′笌鍗曟嵁涓嶄竴鑷达紝璇锋牳瀹�!");
+ }
- //if (isSample == "1")
- //{
- // bind.InspectMark = "1";
- // bind.SamplingQty = bind.SamplingQty == null ? sampleQty : bind.SamplingQty + sampleQty;
- //}
- //Db.Updateable(bind).Where(m => m.Id == bindId).ExecuteCommand();
+ box.ASNNo = arrDetail.ASNNo;
+ box.ASNDetailNo = arrDetail.Id;
+ box.BindNo = bindId;
+ box.PalletNo = model.PalletNo;
+ box.Status = "2";
+ //box.InspectMark = model.IsSample; //鏄惁鍙栨牱鎵樼洏 鍚庢湡涓氬姟寮�鍙戞椂 鎺ュ彛浼犲�奸渶娣诲姞瀵瑰簲瀛楁鍒ゆ柇
+ //box.SamplingQty = 0; //鍙栨牱鏁伴噺 鍚庢湡涓氬姟寮�鍙戞椂 鎺ュ彛浼犲�奸渶娣诲姞瀵瑰簲瀛楁鍒ゆ柇
+ box.CompleteTime = comTime;
+ box.UpdateTime = comTime;
+ box.UpdateUser = userId;
- //#region 鍏ュ簱鍗曞強鏄庣粏
- //decimal addQty = factQty;
+ //box.Qty = box.Qty;
+ //box.BitBoxMark = box.Qty == box.FullQty ? "0" : "1";
- //detail.FactQty += addQty;//宸茬粍鏁伴噺
- //detail.CompleteQty += addQty;//瀹屾垚鏁伴噺
- //if (isSample == "1") //鍚庢湡涓氬姟寮�鍙戞椂 鎺ュ彛浼犲�兼敼涓哄垽鏂槸鍚﹀彇鏍�
- //{
- // detail.IsSampling = "1";
- //}
- //detail.Status = "1";//0锛氱瓑寰呮墽琛� 1锛氭鍦ㄦ墽琛� 2锛氭墽琛屽畬鎴�
- //if (detail.CompleteQty >= detail.Qty)
- //{
- // detail.Status = "2";
- // detail.CompleteTime = comTime;
- //}
- //detail.UpdateUser = userId;
- //detail.UpdateTime = comTime;
- ////鏇存柊鍏ュ簱鍗曟槑缁�
- //Db.Updateable(detail).ExecuteCommand();
+ factQty += box.Qty;
+ boxFullQty += box.Qty;
+ if (box.InspectMark == "1") //鍒ゆ柇鏄惁鍙栨牱
+ {
+ isSample = "1";
+ sampleQty += (decimal)box.SamplingQty;
+ }
- //notice.UpdateUser = userId;
- //notice.UpdateTime = comTime;
- //if (notice.Status == "0")
- //{
- // notice.Status = "1";
- //}
- //var asnDetailNum = Db.Queryable<BllArrivalNoticeDetail>()
- // .Count(m => m.IsDel == "0" && m.ASNNo == detail.ASNNo && m.Status != "2");
- //if (asnDetailNum == 0)
- //{
- // notice.Status = "2";
- // notice.CompleteTime = comTime;//瀹屾垚鏃堕棿
- //}
- ////鏇存柊鍏ュ簱鍗�
- //Db.Updateable(notice).ExecuteCommand();
- //#endregion
+ #region 搴撳瓨绠辩爜鏄庣粏
+ var box2 = new DataBoxInfo()
+ {
+ StockDetailId = sdId1,
+ BindNo = bind.Id,
+ BoxNo = box.BoxNo,
+ BoxNo2 = box.BoxNo2,
+ BoxNo3 = box.BoxNo3,
+ PalletNo = box.PalletNo,
+ PalletNo2 = box.PalletNo2,
+ PalletNo3 = box.PalletNo3,
+ Qty = box.Qty,
+ FullQty = box.FullQty,
+ Status = "2",//0锛氭湭缁勬墭 1锛氬凡缁勬墭 2锛氬凡鍏ュ簱 3锛氬凡鍑哄簱 4:宸插垎閰� 5锛氬凡鎷h揣
+ LotNo = box.LotNo,
+ LotText = box.LotText,
+ SkuNo = box.SkuNo,
+ SkuName = box.SkuName,
+ Standard = sku.Standard,
+ ProductionTime = box.ProductionTime,
+ SupplierLot = box.SupplierLot,
+ InspectStatus = sku.IsInspect,
+ InspectMark = box.InspectMark,
+ BitBoxMark = box.BitBoxMark,
+ ExpirationTime = box.ExpirationTime,
- //#region 搴撳瓨鏄庣粏
- //sd1.Qty = bind.Qty;
- ////鏇存敼搴撳瓨鏄庣粏鏁伴噺
- //Db.Updateable(sd1).Where(m => m.Id == sdId1).ExecuteCommand();
- //#endregion
+ CreateUser = 0,
+ CreateTime = comTime
+ };
+ //娣诲姞搴撳瓨绠辩爜鏄庣粏
+ Db.Insertable(box2).ExecuteCommand();
+ #endregion
+ }
+ if (boxFullQty > bNum)
+ {
+ throw new Exception($"缁戝畾澶辫触锛寋g.Key}绠辩爜缁戝畾鏁伴噺澶т簬璇ョ墿鍝佸寘瑁呮暟閲忥紒");
+ }
+ }
+ //鏇存敼绠辨敮鍏崇郴琛ㄤ俊鎭�
+ Db.Updateable(boxInfoList).ExecuteCommand();
- //#region 搴撳瓨
- //var dataStock = Db.Queryable<DataStock>().First(m => m.IsDel == "0" && m.SkuNo == sku.SkuNo && m.LotNo == bind.LotNo);
- //if (dataStock != null)
- //{
- // dataStock.Qty += factQty;
+ // 鏇存柊鎵樼洏缁戝畾琛�
+ bind.Qty += factQty;
- // if (bind.InspectMark == "1")
- // {
- // dataStock.IsSampling = bind.InspectMark;
- // }
- // Db.Updateable(dataStock).ExecuteCommand();
- //}
- //else
- //{
- // var stock = new DataStock()
- // {
- // SkuNo = sku.SkuNo,
- // SkuName = sku.SkuName,
- // Standard = sku.Standard,
- // LotNo = bind.LotNo,
- // LotText = bind.LotText,
- // Qty = bind.Qty,
- // LockQty = 0,
- // FrozenQty = 0,
- // IsSampling = bind.InspectMark,
- // IsDel = "0",
- // CreateUser = userId,
- // CreateTime = comTime
- // };
- // //缁存姢搴撳瓨璐т富淇℃伅
- // if (notice.Type == "0" || notice.Type == "2" || notice.Type == "4" || notice.Type == "6" || notice.Type == "7")//0:鎴愬搧鍏ュ簱锛�2:涓棿鍝佸叆搴�,4:杞﹂棿浣欐枡鍏ュ簱,6:浠e偍鍏ュ簱,7:瀵勫瓨鍏ュ簱
- // {
- // stock.OwnerNo = notice.CustomerNo;//璐т富缂栫爜
- // stock.OwnerName = notice.CustomerName;//璐т富鍚嶇О
- // }
- // Db.Insertable(stock).ExecuteCommand();
- //}
- //#endregion
+ if (bind.FullQty < bind.Qty)
+ {
+ throw new Exception("鎵樼洏缁戝畾鏁伴噺宸茶秴鍑鸿鐗╂枡鍖呰鏁伴噺");
+ }
- //#region 璐ㄦ璇烽獙
- //if ((notice.Type == "1" || notice.Type == "4" || notice.Type == "5") && sku.IsInspect != "1")
- //{
- // var qualityRequest = Db.Queryable<BllQualityInspectionRequest>().First(m => m.IsDel == "0" && m.SkuNo == sku.SkuNo && m.LotNo == bind.LotNo && m.SupplierLot == bind.SupplierLot);
- // if (qualityRequest == null)
- // {
- // string qcNo = new Common().GetMaxNo("QC");
- // qualityRequest = new BllQualityInspectionRequest();
- // qualityRequest.QcNo = qcNo;
- // qualityRequest.Status = "0";
- // qualityRequest.SkuNo = sku.SkuNo;
- // qualityRequest.SkuName = sku.SkuName;
- // qualityRequest.LotNo = bind.LotNo;
- // qualityRequest.SupplierLot = bind.SupplierLot;
- // qualityRequest.Qty = detail.Qty;
- // qualityRequest.SamplingQty = 0;
- // qualityRequest.ASNNo = detail.ASNNo;
- // qualityRequest.CreateUser = userId;
- // qualityRequest.CreateTime = comTime;
- // //娣诲姞璐ㄦ璇烽獙鍗�
- // Db.Insertable(qualityRequest).ExecuteCommand();
- // }
- //}
- //#endregion
+ if (bind.FullQty == bind.Qty)
+ {
+ bind.BitPalletMark = "0";
+ sd1.BitPalletMark = "0";
+ }
+ if (bind.Qty > pNum)
+ {
+ throw new Exception($"缁戝畾澶辫触锛寋bind.PalletNo}鎵樼洏缁戝畾鏁伴噺澶т簬璇ョ墿鍝佹墭鐩樺寘瑁呮暟閲忥紒");
+ }
+ if (isSample == "1")
+ {
+ bind.InspectMark = "1";
+ bind.SamplingQty = bind.SamplingQty == null ? sampleQty : bind.SamplingQty + sampleQty;
+ }
+ Db.Updateable(bind).Where(m => m.Id == bindId).ExecuteCommand();
+
+ #region 鍏ュ簱鍗曞強鏄庣粏
+ arrDetail.FactQty += factQty;//宸茬粍鏁伴噺
+ arrDetail.CompleteQty += factQty;//瀹屾垚鏁伴噺
+ if (isSample == "1") //鍚庢湡涓氬姟寮�鍙戞椂 鎺ュ彛浼犲�兼敼涓哄垽鏂槸鍚﹀彇鏍�
+ {
+ arrDetail.IsSampling = "1";
+ }
+ arrDetail.Status = "1";//0锛氱瓑寰呮墽琛� 1锛氭鍦ㄦ墽琛� 2锛氭墽琛屽畬鎴�
+ if (arrDetail.CompleteQty >= detail.Qty)
+ {
+ arrDetail.Status = "2";
+ arrDetail.CompleteTime = comTime;
+ }
+ arrDetail.UpdateUser = userId;
+ arrDetail.UpdateTime = comTime;
+ //鏇存柊鍏ュ簱鍗曟槑缁�
+ Db.Updateable(arrDetail).ExecuteCommand();
+
+ arrNotice.UpdateUser = userId;
+ arrNotice.UpdateTime = comTime;
+ if (arrNotice.Status == "0")
+ {
+ arrNotice.Status = "1";
+ }
+ var asnDetailNum = Db.Queryable<BllArrivalNoticeDetail>().Count(m => m.IsDel == "0" && m.ASNNo == arrDetail.ASNNo && m.Status != "2");
+ if (asnDetailNum == 0)
+ {
+ arrNotice.Status = "2";//鎵ц瀹屾垚
+ arrNotice.CompleteTime = comTime;//瀹屾垚鏃堕棿
+ }
+ //鏇存柊鍏ュ簱鍗�
+ Db.Updateable(arrNotice).ExecuteCommand();
+ #endregion
+
+ #region 搴撳瓨鏄庣粏
+ sd1.Qty = bind.Qty;
+ //鏇存敼搴撳瓨鏄庣粏鏁伴噺
+ Db.Updateable(sd1).Where(m => m.Id == sdId1).ExecuteCommand();
+ #endregion
+
+ #region 搴撳瓨
+ var dataStock = Db.Queryable<DataStock>().First(m => m.IsDel == "0" && m.SkuNo == sku.SkuNo && m.LotNo == bind.LotNo);
+ if (dataStock != null)
+ {
+ dataStock.Qty += factQty;
+
+ if (bind.InspectMark == "1")
+ {
+ dataStock.IsSampling = bind.InspectMark;
+ }
+ Db.Updateable(dataStock).ExecuteCommand();
+ }
+ else
+ {
+ var stock = new DataStock()
+ {
+ SkuNo = sku.SkuNo,
+ SkuName = sku.SkuName,
+ Standard = sku.Standard,
+ LotNo = bind.LotNo,
+ LotText = bind.LotText,
+ Qty = bind.Qty,
+ LockQty = 0,
+ FrozenQty = 0,
+ IsSampling = bind.InspectMark,
+ IsDel = "0",
+ CreateUser = userId,
+ CreateTime = comTime
+ };
+ //缁存姢搴撳瓨璐т富淇℃伅
+ if (arrNotice.Type == "0" || arrNotice.Type == "2" || arrNotice.Type == "4" || arrNotice.Type == "6" || arrNotice.Type == "7")//0:鎴愬搧鍏ュ簱锛�2:涓棿鍝佸叆搴�,4:杞﹂棿浣欐枡鍏ュ簱,6:浠e偍鍏ュ簱,7:瀵勫瓨鍏ュ簱
+ {
+ stock.OwnerNo = notice.CustomerNo;//璐т富缂栫爜
+ stock.OwnerName = notice.CustomerName;//璐т富鍚嶇О
+ }
+ Db.Insertable(stock).ExecuteCommand();
+ }
+ #endregion
+
+ #region 璐ㄦ璇烽獙
+ if ((arrNotice.Type == "1" || arrNotice.Type == "4" || arrNotice.Type == "5") && sku.IsInspect != "1")
+ {
+ var qualityRequest = Db.Queryable<BllQualityInspectionRequest>().First(m => m.IsDel == "0" && m.SkuNo == sku.SkuNo && m.LotNo == bind.LotNo && m.SupplierLot == bind.SupplierLot);
+ if (qualityRequest == null)
+ {
+ string qcNo = new Common().GetMaxNo("QC");
+ qualityRequest = new BllQualityInspectionRequest();
+ qualityRequest.QcNo = qcNo;
+ qualityRequest.Status = "0";
+ qualityRequest.SkuNo = sku.SkuNo;
+ qualityRequest.SkuName = sku.SkuName;
+ qualityRequest.LotNo = bind.LotNo;
+ qualityRequest.SupplierLot = bind.SupplierLot;
+ qualityRequest.Qty = arrDetail.Qty;
+ qualityRequest.SamplingQty = 0;
+ qualityRequest.ASNNo = arrDetail.ASNNo;
+ qualityRequest.CreateUser = userId;
+ qualityRequest.CreateTime = comTime;
+ //娣诲姞璐ㄦ璇烽獙鍗�
+ Db.Insertable(qualityRequest).ExecuteCommand();
+ }
+ }
+ #endregion
+ }
+ }
// 鏇存敼鎵樼洏浣跨敤鐘舵��
var sqlStr = $"update SysPallets set Status = '1' where PalletNo = '{model.PalletNo}';";
//娣诲姞鎵樼洏璁板綍琛ㄦ暟鎹�
sqlStr += $"insert into LogPalletTrack values('{model.PalletNo}','{model.AsnNo}','缁勭洏','0',getDate(),{userId},NULL,NULL);";
Db.Ado.ExecuteCommand(sqlStr);
- //new OperationASNServer().AddLogOperationAsn("PDA妯″潡", "鎵樼洏缁戝畾", model.AsnNo, "娣诲姞", $"娣诲姞浜嗘墭鐩樼爜涓猴細{model.PalletNo}銆亄msgStr}鐨勭粍鐩樹俊鎭�", userId);
+ new OperationASNServer().AddLogOperationAsn("PDA妯″潡", "鎵樼洏缁戝畾", model.AsnNo, "娣诲姞", $"娣诲姞浜嗘墭鐩樼爜涓猴細{model.PalletNo}銆亄msgStr}鐨勭粍鐩樹俊鎭�", userId);
+ //鎻愪氦浜嬪姟
Db.CommitTran();
}
catch (Exception e)
{
+ //鍥炴粴浜嬪姟
Db.RollbackTran();
throw new Exception(e.Message);
}
}
-
//JC26缁戝畾鎵樼洏 涓嶈创鏍囩墿鏂�
public void BindPalletNoPasteCode(PdaPalletBindVm model, int userId)
{
-
- #region 鍒ゆ柇
-
- //0锛氭垚鍝佸叆搴� 1锛氶噰璐叆搴� 3锛氶��璐у叆搴� 4锛氳溅闂翠綑鏂欏叆搴� 5锛氬叾瀹冨叆搴� 6锛氫唬鍌ㄥ叆搴�
- var TypeLot = "5, 6";
- if (string.IsNullOrEmpty(model.AsnNo))
- {
- throw new Exception("鍗曟嵁鍙蜂笉鍙负绌�!");
- }
- if (model.AsnDetailId == null || model.AsnDetailId == 0)
- {
- throw new Exception("鐗╂枡涓嶅彲涓虹┖!");
- }
- if (string.IsNullOrEmpty(model.PalletNo))
- {
- throw new Exception("鎵樼洏鍙蜂笉鍙负绌�!");
- }
- if (model.SkuQty < 0)
- {
- throw new Exception("鐗╂枡鏁伴噺涓嶈兘灏忎簬0!");
- }
- //鏍规嵁鍗曟嵁鍙疯幏鍙栧叆搴撳崟鎬诲崟
- var notice = Db.Queryable<BllArrivalNotice>().First(a => a.IsDel == "0" && a.ASNNo == model.AsnNo);
- if (notice.Status != "0" && notice.Status != "1" && notice.Status != "2")
- {
- throw new Exception("璇ュ崟鎹凡鍏冲崟!");
- }
+ #region 鍒ゆ柇
- if (string.IsNullOrEmpty(model.LotNo))
+ //0锛氭垚鍝佸叆搴� 1锛氶噰璐叆搴� 3锛氶��璐у叆搴� 4锛氳溅闂翠綑鏂欏叆搴� 5锛氬叾瀹冨叆搴� 6锛氫唬鍌ㄥ叆搴�
+ var TypeLot = "5, 6";
+
+ if (string.IsNullOrEmpty(model.AsnNo))
+ {
+ throw new Exception("鍗曟嵁鍙蜂笉鍙负绌�!");
+ }
+ if (model.AsnDetailId == null || model.AsnDetailId == 0)
+ {
+ throw new Exception("鐗╂枡涓嶅彲涓虹┖!");
+ }
+ if (string.IsNullOrEmpty(model.PalletNo))
+ {
+ throw new Exception("鎵樼洏鍙蜂笉鍙负绌�!");
+ }
+ if (model.SkuQty < 0)
+ {
+ throw new Exception("鐗╂枡鏁伴噺涓嶈兘灏忎簬0!");
+ }
+ //鏍规嵁鍗曟嵁鍙疯幏鍙栧叆搴撳崟鎬诲崟
+ var notice = Db.Queryable<BllArrivalNotice>().First(a => a.IsDel == "0" && a.ASNNo == model.AsnNo);
+ if (notice.Status != "0" && notice.Status != "1" && notice.Status != "2")
+ {
+ throw new Exception("璇ュ崟鎹凡鍏冲崟!");
+ }
+
+ if (string.IsNullOrEmpty(model.LotNo))
+ {
+ throw new Exception("鐗╂枡鎵规涓嶄负绌�!");
+ }
+ else
+ {
+ //浠庣墿鏂欏悕绉�-鎵规涓彇鍑烘壒娆�
+ int indexOfDash = model.LotNo.IndexOf("-");
+ if (indexOfDash != -1)
{
- throw new Exception("鐗╂枡鎵规涓嶄负绌�!");
+ model.LotNo = model.LotNo.Substring(indexOfDash + 1);
}
else
{
- //浠庣墿鏂欏悕绉�-鎵规涓彇鍑烘壒娆�
- int indexOfDash = model.LotNo.IndexOf("-");
- if (indexOfDash != -1)
+ if (!TypeLot.Contains(notice.Type))
{
- model.LotNo = model.LotNo.Substring(indexOfDash + 1);
+ throw new Exception("鐗╂枡鎵规涓嶅彲涓虹┖!");
}
- else
- {
- if (!TypeLot.Contains(notice.Type))
- {
- throw new Exception("鐗╂枡鎵规涓嶅彲涓虹┖!");
- }
- model.LotNo = "";
+ model.LotNo = "";
+ }
+ }
+
+ //int isTextTable = model.TableType;
+ #endregion
+
+ var comTime = DateTime.Now;
+
+ //鎵樼洏鏄惁瀛樺湪
+ var pallet = Db.Queryable<SysPallets>().First(m => m.IsDel == "0" && m.PalletNo == model.PalletNo);
+ if (pallet == null)
+ {
+ throw new Exception("鏈煡璇㈠埌鎵樼洏淇℃伅锛岃鏍稿疄锛�");
+ }
+ // 楠岃瘉鍏ュ簱鍗曟槑缁嗘槸鍚﹀瓨鍦�
+ var detail = Db.Queryable<BllArrivalNoticeDetail>().First(m => m.IsDel == "0" && m.Id == model.AsnDetailId && m.ASNNo == model.AsnNo && m.LotNo.Contains(model.LotNo));
+ if (detail == null)
+ {
+ throw new Exception("褰撳墠鐗╂枡鍙婃壒娆′笌鍗曟嵁鏃犲叧鑱旓紝璇锋牳瀹�!");
+ }
+ //鍒ゆ柇鎵樼洏鏄惁鍦ㄥ簱澶�
+ var stockDetail = Db.Queryable<DataStockDetail>().First(m => m.IsDel == "0" && m.PalletNo == model.PalletNo);
+ if (stockDetail != null && !string.IsNullOrEmpty(stockDetail.WareHouseNo))
+ {
+ throw new Exception("璇ユ墭鐩樺凡鏈夊偍浣嶄俊鎭紝璇锋牳瀹烇紒");
+ }
+ if (stockDetail != null && (stockDetail.SkuNo != detail.SkuNo || stockDetail.LotNo != model.LotNo))
+ {
+ throw new Exception("璇ユ墭鐩樺湪搴撳瓨宸叉湁鍏跺畠鐗╂枡鎵规淇℃伅锛岃鏍稿疄锛�");
+ }
+
+ #region 鍖呰
+ var sku = Db.Queryable<SysMaterials>().First(m => m.IsDel == "0" && m.SkuNo == detail.SkuNo);
+ var pack = Db.Queryable<SysPackag>().First(m => m.IsDel == "0" && m.PackagNo == detail.PackagNo); // liudl 鐢盨ku鍖呰缂栧彿鍙樻洿涓哄叆搴撳崟鏄庣粏鍖呰缂栧彿
+
+ var pNum = 0;//鎵樼洏鐗╁搧鏁伴噺
+ var bNum = 0;//绠辩爜鐗╁搧鏁伴噺
+
+ if (pack == null)
+ {
+ throw new Exception("鑾峰彇鐗╂枡鍖呰澶辫触锛岃鏍稿疄!");
+ }
+ if (pack.L5Num.HasValue)
+ {
+ pNum = (int)pack.L5Num;
+ bNum = (int)pack.L4Num;
+ }
+ else if (pack.L4Num.HasValue)
+ {
+ pNum = (int)pack.L4Num;
+ bNum = (int)pack.L3Num;
+ }
+ else if (pack.L3Num.HasValue)
+ {
+ pNum = (int)pack.L3Num;
+ bNum = (int)pack.L2Num;
+ }
+ else if (pack.L2Num.HasValue)
+ {
+ pNum = (int)pack.L2Num;
+ bNum = (int)pack.L1Num;
+ }
+ else if (pack.L1Num.HasValue)
+ {
+ pNum = (int)pack.L1Num;
+ bNum = (int)pack.L1Num;
+ }
+ if (pNum == 0 || bNum == 0)
+ {
+ throw new Exception($"缁戝畾澶辫触锛寋detail.SkuNo}鐗╁搧鍖呰鏈壘鍒帮紒");
+ }
+
+ #endregion
+
+ #region 楠岃瘉鏄惁鍏佽绔嬪簱鍚屾墭鐩樹笉鍚岀墿鏂欏叆搴撴垨鍚屾墭鐩樺悓鐗╂枡涓嶅悓鎵规鍏ュ簱
+ var palletBind = Db.Queryable<BllPalletBind>().First(m => m.IsDel == "0" && m.ASNNo == model.AsnNo && m.PalletNo == model.PalletNo && m.ASNDetailNo != model.AsnDetailId);
+ if (palletBind != null)
+ {
+ var box = Db.Queryable<BllBoxInfo>().First(m => m.IsDel == "0" && m.BindNo == palletBind.Id && m.BitBoxMark == "0");
+ if (box != null && (box.SkuNo != detail.SkuNo || !detail.LotNo.Contains(box.LotNo)))
+ {
+ var funSetting = Db.Queryable<SysFunSetting>().First(a => a.IsDel == "0" && a.FunSetNo == "Fun045");
+ if (funSetting == null || funSetting.IsEnable == "OFF")
+ {
+ throw new Exception($"涓嶅厑璁哥珛搴撳悓鎵樼洏涓嶅悓鐗╂枡鍏ュ簱鎴栧悓鎵樼洏涓嶅悓鎵规鍏ュ簱锛�");
}
}
+ }
+ #endregion
+ //liudl && m.Status != "2" 缁勭洏鏃㈠叆搴撳畬鎴愭棤闇�鏍规嵁鎵樼洏鐘舵�佸垽鏂�
+ var bind = Db.Queryable<BllPalletBind>().First(m => m.IsDel == "0" && m.ASNDetailNo == model.AsnDetailId && m.PalletNo == model.PalletNo);
+ var bindId = 0;
+ if (bind == null)
+ {
+ bind = new BllPalletBind
+ {
+ ASNNo = model.AsnNo,
+ ASNDetailNo = (int)model.AsnDetailId,
+ PalletNo = model.PalletNo,
- //int isTextTable = model.TableType;
- #endregion
+ Qty = model.SkuQty,
+ FullQty = pNum,
+ Status = "2",//鍏ュ簱瀹屾垚
+ Type = "0",
+ LotNo = model.LotNo,
+ LotText = detail.LotText,
+ SupplierLot = detail.SupplierLot,
+ //InspectMark = model.IsSample, //鏄惁鍙栨牱鎵樼洏 鍚庢湡涓氬姟寮�鍙戞椂 鎺ュ彛浼犲�奸渶娣诲姞瀵瑰簲瀛楁鍒ゆ柇
+ //SamplingQty = 0, //鍙栨牱鏁伴噺 鍚庢湡涓氬姟寮�鍙戞椂 鎺ュ彛浼犲�奸渶娣诲姞瀵瑰簲瀛楁鍒ゆ柇
+ BitPalletMark = "1",
+ IsBale = "0",
+ IsBelt = "0",
+ CreateUser = userId,
+ Demo = model.Demo,
- var comTime = DateTime.Now;
+ };
+ // 鎻掑叆鎵樼洏缁戝畾琛�
+ bindId = Db.Insertable(bind).ExecuteReturnIdentity();
+ }
+ else
+ {
+ bindId = bind.Id;
+ bind.Qty += model.SkuQty;
+ }
+ if (bind.Qty < 0)
+ {
+ throw new Exception("缁勭洏鏁伴噺涓嶈兘灏忎簬0");
+ }
- //鎵樼洏鏄惁瀛樺湪
- var pallet = Db.Queryable<SysPallets>().First(m => m.IsDel == "0" && m.PalletNo == model.PalletNo);
- if (pallet == null)
- {
- throw new Exception("鏈煡璇㈠埌鎵樼洏淇℃伅锛岃鏍稿疄锛�");
- }
- // 楠岃瘉鍏ュ簱鍗曟槑缁嗘槸鍚﹀瓨鍦�
- var detail = Db.Queryable<BllArrivalNoticeDetail>().First(m => m.IsDel == "0" && m.Id == model.AsnDetailId && m.ASNNo == model.AsnNo && m.LotNo.Contains(model.LotNo));
- if (detail == null)
- {
- throw new Exception("褰撳墠鐗╂枡鍙婃壒娆′笌鍗曟嵁鏃犲叧鑱旓紝璇锋牳瀹�!");
- }
- //鍒ゆ柇鎵樼洏鏄惁鍦ㄥ簱澶�
- var stockDetail = Db.Queryable<DataStockDetail>().First(m => m.IsDel == "0" && m.PalletNo == model.PalletNo);
- if (stockDetail != null && !string.IsNullOrEmpty(stockDetail.WareHouseNo))
- {
- throw new Exception("璇ユ墭鐩樺凡鏈夊偍浣嶄俊鎭紝璇锋牳瀹烇紒");
- }
- if (stockDetail != null && (stockDetail.SkuNo != detail.SkuNo || stockDetail.LotNo != model.LotNo))
- {
- throw new Exception("璇ユ墭鐩樺湪搴撳瓨宸叉湁鍏跺畠鐗╂枡鎵规淇℃伅锛岃鏍稿疄锛�");
- }
+ #region 搴撳瓨鏄庣粏
+ //鑾峰彇璇ユ壒娆℃渶缁堣川妫�缁撴灉
+ BllQualityInspect quality = new BllQualityInspect();
+ //鍒ゆ柇鏄惁涓洪��璐у叆搴撳崟
+ if (notice.Type == "3")
+ {
+ quality = Db.Queryable<BllQualityInspect>().Where(a => a.IsDel == "0" && a.ASNNo == detail.ASNNo && a.SkuNo == detail.SkuNo && a.LotNo == detail.LotNo).OrderByDescending(a => a.CreateTime).First();
+ }
+ else
+ {
+ quality = Db.Queryable<BllQualityInspect>().Where(a => a.IsDel == "0" && a.SkuNo == detail.SkuNo && a.LotNo == detail.LotNo).OrderByDescending(a => a.CreateTime).First();
+ }
+ var tags = "0";
+ if (notice.Type == "3" || notice.Type == "4")
+ {
+ tags = "1";
+ }
- #region 鍖呰
- var sku = Db.Queryable<SysMaterials>().First(m => m.IsDel == "0" && m.SkuNo == detail.SkuNo);
- var pack = Db.Queryable<SysPackag>().First(m => m.IsDel == "0" && m.PackagNo == detail.PackagNo); // liudl 鐢盨ku鍖呰缂栧彿鍙樻洿涓哄叆搴撳崟鏄庣粏鍖呰缂栧彿
-
- var pNum = 0;//鎵樼洏鐗╁搧鏁伴噺
- var bNum = 0;//绠辩爜鐗╁搧鏁伴噺
-
- if (pack == null)
- {
- throw new Exception("鑾峰彇鐗╂枡鍖呰澶辫触锛岃鏍稿疄!");
- }
- if (pack.L5Num.HasValue)
- {
- pNum = (int)pack.L5Num;
- bNum = (int)pack.L4Num;
- }
- else if (pack.L4Num.HasValue)
- {
- pNum = (int)pack.L4Num;
- bNum = (int)pack.L3Num;
- }
- else if (pack.L3Num.HasValue)
- {
- pNum = (int)pack.L3Num;
- bNum = (int)pack.L2Num;
- }
- else if (pack.L2Num.HasValue)
- {
- pNum = (int)pack.L2Num;
- bNum = (int)pack.L1Num;
- }
- else if (pack.L1Num.HasValue)
- {
- pNum = (int)pack.L1Num;
- bNum = (int)pack.L1Num;
- }
- if (pNum == 0 || bNum == 0)
- {
- throw new Exception($"缁戝畾澶辫触锛寋detail.SkuNo}鐗╁搧鍖呰鏈壘鍒帮紒");
- }
-
- #endregion
-
- #region 楠岃瘉鏄惁鍏佽绔嬪簱鍚屾墭鐩樹笉鍚岀墿鏂欏叆搴撴垨鍚屾墭鐩樺悓鐗╂枡涓嶅悓鎵规鍏ュ簱
- var palletBind = Db.Queryable<BllPalletBind>().First(m => m.IsDel == "0" && m.ASNNo == model.AsnNo && m.PalletNo == model.PalletNo && m.ASNDetailNo != model.AsnDetailId);
- if (palletBind != null)
- {
- var box = Db.Queryable<BllBoxInfo>().First(m => m.IsDel == "0" && m.BindNo == palletBind.Id && m.BitBoxMark == "0");
- if (box != null && (box.SkuNo != detail.SkuNo || !detail.LotNo.Contains(box.LotNo)))
- {
- var funSetting = Db.Queryable<SysFunSetting>().First(a => a.IsDel == "0" && a.FunSetNo == "Fun045");
- if (funSetting == null || funSetting.IsEnable == "OFF")
- {
- throw new Exception($"涓嶅厑璁哥珛搴撳悓鎵樼洏涓嶅悓鐗╂枡鍏ュ簱鎴栧悓鎵樼洏涓嶅悓鎵规鍏ュ簱锛�");
- }
- }
- }
- #endregion
- //liudl && m.Status != "2" 缁勭洏鏃㈠叆搴撳畬鎴愭棤闇�鏍规嵁鎵樼洏鐘舵�佸垽鏂�
- var bind = Db.Queryable<BllPalletBind>().First(m => m.IsDel == "0" && m.ASNDetailNo == model.AsnDetailId && m.PalletNo == model.PalletNo);
- var bindId = 0;
- if (bind == null)
- {
- bind = new BllPalletBind
- {
- ASNNo = model.AsnNo,
- ASNDetailNo = (int)model.AsnDetailId,
- PalletNo = model.PalletNo,
-
- Qty = model.SkuQty,
- FullQty = pNum,
- Status = "2",//鍏ュ簱瀹屾垚
- Type = "0",
- LotNo = model.LotNo,
- LotText = detail.LotText,
- SupplierLot = detail.SupplierLot,
- //InspectMark = model.IsSample, //鏄惁鍙栨牱鎵樼洏 鍚庢湡涓氬姟寮�鍙戞椂 鎺ュ彛浼犲�奸渶娣诲姞瀵瑰簲瀛楁鍒ゆ柇
- //SamplingQty = 0, //鍙栨牱鏁伴噺 鍚庢湡涓氬姟寮�鍙戞椂 鎺ュ彛浼犲�奸渶娣诲姞瀵瑰簲瀛楁鍒ゆ柇
- BitPalletMark = "1",
- IsBale = "0",
- IsBelt = "0",
- CreateUser = userId,
- Demo = model.Demo,
-
- };
- // 鎻掑叆鎵樼洏缁戝畾琛�
- bindId = Db.Insertable(bind).ExecuteReturnIdentity();
- }
- else
- {
- bindId = bind.Id;
- bind.Qty += model.SkuQty;
- }
- if (bind.Qty < 0)
- {
- throw new Exception("缁勭洏鏁伴噺涓嶈兘灏忎簬0");
- }
-
- #region 搴撳瓨鏄庣粏
- //鑾峰彇璇ユ壒娆℃渶缁堣川妫�缁撴灉
- BllQualityInspect quality = new BllQualityInspect();
- //鍒ゆ柇鏄惁涓洪��璐у叆搴撳崟
- if (notice.Type == "3")
- {
- quality = Db.Queryable<BllQualityInspect>().Where(a => a.IsDel == "0" && a.ASNNo == detail.ASNNo && a.SkuNo == detail.SkuNo && a.LotNo == detail.LotNo).OrderByDescending(a => a.CreateTime).First();
- }
- else
- {
- quality = Db.Queryable<BllQualityInspect>().Where(a => a.IsDel == "0" && a.SkuNo == detail.SkuNo && a.LotNo == detail.LotNo).OrderByDescending(a => a.CreateTime).First();
- }
- var tags = "0";
- if (notice.Type == "3" || notice.Type == "4")
- {
- tags = "1";
- }
-
- // 鍒ゆ柇搴撳瓨鏄庣粏鏄惁宸叉湁姝ゆ墭鐩樹俊鎭�
- var sd1 = Db.Queryable<DataStockDetail>()
- .First(m => m.IsDel == "0" && m.ASNDetailNo == bind.ASNDetailNo && m.PalletNo == model.PalletNo && m.LotNo == bind.LotNo);
- var sdId1 = 0;
- if (sd1 != null)
- {
- sdId1 = sd1.Id;
- // 搴撳瓨宸插瓨鍦� 鏇存柊鏁版嵁
- sd1.Qty = bind.Qty;
- sd1.CompleteTime = comTime;
- sd1.UpdateUser = userId;
- sd1.UpdateTime = comTime;
-
- Db.Updateable(sd1).ExecuteCommand(); //淇敼璐ㄦ淇℃伅
- }
- else
- {
- // 搴撳瓨涓嶅瓨鍦� 鎻掑叆鏁版嵁
- sd1 = new DataStockDetail()
- {
- LotNo = bind.LotNo,
- LotText = bind.LotText,
- SupplierLot = bind.SupplierLot,
- SkuNo = sku.SkuNo,
- SkuName = sku.SkuName,
- Standard = sku.Standard,
- Qty = bind.Qty,
- LockQty = 0,
- FrozenQty = 0,
- InspectQty = 0,
- ASNNo = bind.ASNNo,
- ASNDetailNo = bind.ASNDetailNo,
- WareHouseNo = "",//鎵�灞炰粨搴�
- RoadwayNo = "",//鎵�灞炲贩閬�
- AreaNo = "",//鎵�灞炲尯鍩�
- LocatNo = "",//鍌ㄤ綅鍦板潃
- PalletNo = bind.PalletNo,
- PalletNo2 = bind.PalletNo2,
- PalletNo3 = bind.PalletNo3,
- PalletTags = tags,
- CompleteTime = comTime,
- ProductionTime = bind.ProductionTime,
- ExpirationTime = bind.ExpirationTime,
- Status = "0",
- InspectMark = bind.InspectMark,
- InspectStatus = sku.IsInspect,
- BitPalletMark = bind.BitPalletMark,
- PackagNo = detail.PackagNo, //liudl 鐢眘ku鐨勫寘瑁呯紪鍙峰彉涓哄叆搴撳崟鏄庣粏鐨勫寘瑁呯紪鐮�
- IsBale = bind.IsBale,
- IsBelt = bind.IsBelt,
-
- IsDel = "0",
- CreateUser = 0,
- CreateTime = comTime
- };
-
- //缁存姢搴撳瓨鏄庣粏璐т富/渚涘簲鍟嗕俊鎭�
- if (notice.Type == "0" || notice.Type == "2" || notice.Type == "4" || notice.Type == "6" || notice.Type == "7")//0:鎴愬搧鍏ュ簱锛�2:涓棿鍝佸叆搴�,4:杞﹂棿浣欐枡鍏ュ簱,6:浠e偍鍏ュ簱,7:瀵勫瓨鍏ュ簱
- {
- sd1.OwnerNo = notice.CustomerNo;//璐т富缂栫爜
- sd1.OwnerName = notice.CustomerName;//璐т富鍚嶇О
- }
- else if (notice.Type == "1" || notice.Type == "5")//1:閲囪喘鍏ュ簱,2:鍏跺畠鍏ュ簱
- {
- sd1.SupplierNo = notice.CustomerNo;//渚涘簲鍟嗙紪鐮�
- sd1.SupplierName = notice.CustomerName;//渚涘簲鍟嗗悕绉�
- }
- if (quality != null)
- {
- //淇敼鍚堟牸涓嶅悎鏍兼暟閲�
- if (quality.IsQualified == "1") //鍚堟牸
- {
- //澧炲姞鍚堟牸鏁伴噺
- quality.PassQty += bind.Qty;
- sd1.InspectStatus = "1";
- }
- else if (quality.IsQualified == "0") //涓嶅悎鏍�
- {
- //澧炲姞涓嶅悎鏍兼暟閲�
- quality.FailQty += bind.Qty;
- sd1.InspectStatus = "2";
- }
- Db.Updateable(quality).ExecuteCommand(); //淇敼璐ㄦ淇℃伅
- }
- //娣诲姞搴撳瓨鏄庣粏
- sdId1 = Db.Insertable(sd1).ExecuteReturnIdentity();
- }
- #endregion
-
-
-
- // 鏇存敼绠辨敮鍏崇郴琛�
-
- var isSample = "0";//鏄惁鍙栨牱
- var sampleQty = 0m;//鍙栨牱鏁伴噺
-
-
- //if (bind.FullQty < bind.Qty && isTextTable == 0)
- if (bind.FullQty < bind.Qty)
- {
- throw new Exception("鎵樼洏缁戝畾鏁伴噺宸茶秴鍑鸿鐗╂枡鍖呰鏁伴噺");
- }
-
- if (bind.FullQty == bind.Qty)
- {
- bind.BitPalletMark = "0";
- sd1.BitPalletMark = "0";
- }
- //if (bind.Qty > pNum && isTextTable == 0)
- if (bind.Qty > pNum)
- {
- throw new Exception($"缁戝畾澶辫触锛寋bind.PalletNo}鎵樼洏缁戝畾鏁伴噺澶т簬璇ョ墿鍝佹墭鐩樺寘瑁呮暟閲忥紒");
- }
-
- if (isSample == "1")
- {
- bind.InspectMark = "1";
- bind.SamplingQty = bind.SamplingQty == null ? sampleQty : bind.SamplingQty + sampleQty;
- }
- Db.Updateable(bind).Where(m => m.Id == bindId).ExecuteCommand();
-
- #region 鍏ュ簱鍗曞強鏄庣粏
- decimal addQty = model.SkuQty;
-
- detail.FactQty += addQty;//宸茬粍鏁伴噺
- detail.CompleteQty += addQty;//瀹屾垚鏁伴噺
- if (isSample == "1") //鍚庢湡涓氬姟寮�鍙戞椂 鎺ュ彛浼犲�兼敼涓哄垽鏂槸鍚﹀彇鏍�
- {
- detail.IsSampling = "1";
- }
- detail.Status = "1";//0锛氱瓑寰呮墽琛� 1锛氭鍦ㄦ墽琛� 2锛氭墽琛屽畬鎴�
- if (detail.CompleteQty >= detail.Qty)
- {
- detail.Status = "2";
- detail.CompleteTime = comTime;
- }
- detail.UpdateUser = userId;
- detail.UpdateTime = comTime;
- //鏇存柊鍏ュ簱鍗曟槑缁�
- Db.Updateable(detail).ExecuteCommand();
-
- notice.UpdateUser = userId;
- notice.UpdateTime = comTime;
- if (notice.Status == "0")
- {
- notice.Status = "1";
- }
- var asnDetailNum = Db.Queryable<BllArrivalNoticeDetail>()
- .Count(m => m.IsDel == "0" && m.ASNNo == detail.ASNNo && m.Status != "2");
- if (asnDetailNum == 0)
- {
- notice.Status = "2";
- notice.CompleteTime = comTime;//瀹屾垚鏃堕棿
- }
- //鏇存柊鍏ュ簱鍗�
- Db.Updateable(notice).ExecuteCommand();
- #endregion
-
- #region 搴撳瓨鏄庣粏
+ // 鍒ゆ柇搴撳瓨鏄庣粏鏄惁宸叉湁姝ゆ墭鐩樹俊鎭�
+ var sd1 = Db.Queryable<DataStockDetail>()
+ .First(m => m.IsDel == "0" && m.ASNDetailNo == bind.ASNDetailNo && m.PalletNo == model.PalletNo && m.LotNo == bind.LotNo);
+ var sdId1 = 0;
+ if (sd1 != null)
+ {
+ sdId1 = sd1.Id;
+ // 搴撳瓨宸插瓨鍦� 鏇存柊鏁版嵁
sd1.Qty = bind.Qty;
- //鏇存敼搴撳瓨鏄庣粏鏁伴噺
- Db.Updateable(sd1).Where(m => m.Id == sdId1).ExecuteCommand();
- #endregion
+ sd1.CompleteTime = comTime;
+ sd1.UpdateUser = userId;
+ sd1.UpdateTime = comTime;
- #region 搴撳瓨
- var dataStock = Db.Queryable<DataStock>().First(m => m.IsDel == "0" && m.SkuNo == sku.SkuNo && m.LotNo == bind.LotNo);
- if (dataStock != null)
+ Db.Updateable(sd1).ExecuteCommand(); //淇敼璐ㄦ淇℃伅
+ }
+ else
+ {
+ // 搴撳瓨涓嶅瓨鍦� 鎻掑叆鏁版嵁
+ sd1 = new DataStockDetail()
{
- dataStock.Qty += model.SkuQty;
-
+ LotNo = bind.LotNo,
+ LotText = bind.LotText,
+ SupplierLot = bind.SupplierLot,
+ SkuNo = sku.SkuNo,
+ SkuName = sku.SkuName,
+ Standard = sku.Standard,
+ Qty = bind.Qty,
+ LockQty = 0,
+ FrozenQty = 0,
+ InspectQty = 0,
+ ASNNo = bind.ASNNo,
+ ASNDetailNo = bind.ASNDetailNo,
+ WareHouseNo = "",//鎵�灞炰粨搴�
+ RoadwayNo = "",//鎵�灞炲贩閬�
+ AreaNo = "",//鎵�灞炲尯鍩�
+ LocatNo = "",//鍌ㄤ綅鍦板潃
+ PalletNo = bind.PalletNo,
+ PalletNo2 = bind.PalletNo2,
+ PalletNo3 = bind.PalletNo3,
+ PalletTags = tags,
+ CompleteTime = comTime,
+ ProductionTime = bind.ProductionTime,
+ ExpirationTime = bind.ExpirationTime,
+ Status = "0",
+ InspectMark = bind.InspectMark,
+ InspectStatus = sku.IsInspect,
+ BitPalletMark = bind.BitPalletMark,
+ PackagNo = detail.PackagNo, //liudl 鐢眘ku鐨勫寘瑁呯紪鍙峰彉涓哄叆搴撳崟鏄庣粏鐨勫寘瑁呯紪鐮�
+ IsBale = bind.IsBale,
+ IsBelt = bind.IsBelt,
- if (bind.InspectMark == "1")
- {
- dataStock.IsSampling = bind.InspectMark;
- }
- Db.Updateable(dataStock).ExecuteCommand();
- }
- else
+ IsDel = "0",
+ CreateUser = 0,
+ CreateTime = comTime
+ };
+
+ //缁存姢搴撳瓨鏄庣粏璐т富/渚涘簲鍟嗕俊鎭�
+ if (notice.Type == "0" || notice.Type == "2" || notice.Type == "4" || notice.Type == "6" || notice.Type == "7")//0:鎴愬搧鍏ュ簱锛�2:涓棿鍝佸叆搴�,4:杞﹂棿浣欐枡鍏ュ簱,6:浠e偍鍏ュ簱,7:瀵勫瓨鍏ュ簱
{
- var stock = new DataStock()
- {
- SkuNo = sku.SkuNo,
- SkuName = sku.SkuName,
- Standard = sku.Standard,
- LotNo = bind.LotNo,
- LotText = bind.LotText,
- Qty = bind.Qty,
- LockQty = 0,
- FrozenQty = 0,
- IsSampling = bind.InspectMark,
- IsDel = "0",
- CreateUser = userId,
- CreateTime = comTime
- };
- //缁存姢搴撳瓨璐т富淇℃伅
- if (notice.Type == "0" || notice.Type == "2" || notice.Type == "4" || notice.Type == "6" || notice.Type == "7")//0:鎴愬搧鍏ュ簱锛�2:涓棿鍝佸叆搴�,4:杞﹂棿浣欐枡鍏ュ簱,6:浠e偍鍏ュ簱,7:瀵勫瓨鍏ュ簱
- {
- stock.OwnerNo = notice.CustomerNo;//璐т富缂栫爜
- stock.OwnerName = notice.CustomerName;//璐т富鍚嶇О
- }
- Db.Insertable(stock).ExecuteCommand();
+ sd1.OwnerNo = notice.CustomerNo;//璐т富缂栫爜
+ sd1.OwnerName = notice.CustomerName;//璐т富鍚嶇О
}
- #endregion
-
- #region 璐ㄦ璇烽獙
- if ((notice.Type == "1" || notice.Type == "4" || notice.Type == "5") && sku.IsInspect != "1")
+ else if (notice.Type == "1" || notice.Type == "5")//1:閲囪喘鍏ュ簱,2:鍏跺畠鍏ュ簱
{
- var qualityRequest = Db.Queryable<BllQualityInspectionRequest>().First(m => m.IsDel == "0" && m.SkuNo == sku.SkuNo && m.LotNo == bind.LotNo && m.SupplierLot == bind.SupplierLot);
- if (qualityRequest == null)
- {
- string qcNo = new Common().GetMaxNo("QC");
- qualityRequest = new BllQualityInspectionRequest();
- qualityRequest.QcNo = qcNo;
- qualityRequest.Status = "0";
- qualityRequest.SkuNo = sku.SkuNo;
- qualityRequest.SkuName = sku.SkuName;
- qualityRequest.LotNo = bind.LotNo;
- qualityRequest.SupplierLot = bind.SupplierLot;
- qualityRequest.Qty = detail.Qty;
- qualityRequest.SamplingQty = 0;
- qualityRequest.ASNNo = detail.ASNNo;
- qualityRequest.CreateUser = userId;
- qualityRequest.CreateTime = comTime;
- //娣诲姞璐ㄦ璇烽獙鍗�
- Db.Insertable(qualityRequest).ExecuteCommand();
- }
+ sd1.SupplierNo = notice.CustomerNo;//渚涘簲鍟嗙紪鐮�
+ sd1.SupplierName = notice.CustomerName;//渚涘簲鍟嗗悕绉�
}
- #endregion
+ if (quality != null)
+ {
+ //淇敼鍚堟牸涓嶅悎鏍兼暟閲�
+ if (quality.IsQualified == "1") //鍚堟牸
+ {
+ //澧炲姞鍚堟牸鏁伴噺
+ quality.PassQty += bind.Qty;
+ sd1.InspectStatus = "1";
+ }
+ else if (quality.IsQualified == "0") //涓嶅悎鏍�
+ {
+ //澧炲姞涓嶅悎鏍兼暟閲�
+ quality.FailQty += bind.Qty;
+ sd1.InspectStatus = "2";
+ }
+ Db.Updateable(quality).ExecuteCommand(); //淇敼璐ㄦ淇℃伅
+ }
+ //娣诲姞搴撳瓨鏄庣粏
+ sdId1 = Db.Insertable(sd1).ExecuteReturnIdentity();
+ }
+ #endregion
- // 鏇存敼鎵樼洏浣跨敤鐘舵��
- var sqlStr = $"update SysPallets set Status = '1' where PalletNo = '{model.PalletNo}';";
- //娣诲姞鎵樼洏璁板綍琛ㄦ暟鎹�
- sqlStr += $"insert into LogPalletTrack values('{model.PalletNo}','{model.AsnNo}','缁勭洏','0',getDate(),{userId},NULL,NULL);";
- Db.Ado.ExecuteCommand(sqlStr);
- new OperationASNServer().AddLogOperationAsn("PDA妯″潡", "鎵樼洏缁戝畾", model.AsnNo, "娣诲姞", $"娣诲姞浜嗘墭鐩樼爜涓猴細{model.PalletNo}鐨勭粍鐩樹俊鎭�", userId);
-
-
+
+ // 鏇存敼绠辨敮鍏崇郴琛�
+
+ var isSample = "0";//鏄惁鍙栨牱
+ var sampleQty = 0m;//鍙栨牱鏁伴噺
+
+
+ //if (bind.FullQty < bind.Qty && isTextTable == 0)
+ if (bind.FullQty < bind.Qty)
+ {
+ throw new Exception("鎵樼洏缁戝畾鏁伴噺宸茶秴鍑鸿鐗╂枡鍖呰鏁伴噺");
+ }
+
+ if (bind.FullQty == bind.Qty)
+ {
+ bind.BitPalletMark = "0";
+ sd1.BitPalletMark = "0";
+ }
+ //if (bind.Qty > pNum && isTextTable == 0)
+ if (bind.Qty > pNum)
+ {
+ throw new Exception($"缁戝畾澶辫触锛寋bind.PalletNo}鎵樼洏缁戝畾鏁伴噺澶т簬璇ョ墿鍝佹墭鐩樺寘瑁呮暟閲忥紒");
+ }
+
+ if (isSample == "1")
+ {
+ bind.InspectMark = "1";
+ bind.SamplingQty = bind.SamplingQty == null ? sampleQty : bind.SamplingQty + sampleQty;
+ }
+ Db.Updateable(bind).Where(m => m.Id == bindId).ExecuteCommand();
+
+ #region 鍏ュ簱鍗曞強鏄庣粏
+ decimal addQty = model.SkuQty;
+
+ detail.FactQty += addQty;//宸茬粍鏁伴噺
+ detail.CompleteQty += addQty;//瀹屾垚鏁伴噺
+ if (isSample == "1") //鍚庢湡涓氬姟寮�鍙戞椂 鎺ュ彛浼犲�兼敼涓哄垽鏂槸鍚﹀彇鏍�
+ {
+ detail.IsSampling = "1";
+ }
+ detail.Status = "1";//0锛氱瓑寰呮墽琛� 1锛氭鍦ㄦ墽琛� 2锛氭墽琛屽畬鎴�
+ if (detail.CompleteQty >= detail.Qty)
+ {
+ detail.Status = "2";
+ detail.CompleteTime = comTime;
+ }
+ detail.UpdateUser = userId;
+ detail.UpdateTime = comTime;
+ //鏇存柊鍏ュ簱鍗曟槑缁�
+ Db.Updateable(detail).ExecuteCommand();
+
+ notice.UpdateUser = userId;
+ notice.UpdateTime = comTime;
+ if (notice.Status == "0")
+ {
+ notice.Status = "1";
+ }
+ var asnDetailNum = Db.Queryable<BllArrivalNoticeDetail>()
+ .Count(m => m.IsDel == "0" && m.ASNNo == detail.ASNNo && m.Status != "2");
+ if (asnDetailNum == 0)
+ {
+ notice.Status = "2";
+ notice.CompleteTime = comTime;//瀹屾垚鏃堕棿
+ }
+ //鏇存柊鍏ュ簱鍗�
+ Db.Updateable(notice).ExecuteCommand();
+ #endregion
+
+ #region 搴撳瓨鏄庣粏
+ sd1.Qty = bind.Qty;
+ //鏇存敼搴撳瓨鏄庣粏鏁伴噺
+ Db.Updateable(sd1).Where(m => m.Id == sdId1).ExecuteCommand();
+ #endregion
+
+ #region 搴撳瓨
+ var dataStock = Db.Queryable<DataStock>().First(m => m.IsDel == "0" && m.SkuNo == sku.SkuNo && m.LotNo == bind.LotNo);
+ if (dataStock != null)
+ {
+ dataStock.Qty += model.SkuQty;
+
+
+ if (bind.InspectMark == "1")
+ {
+ dataStock.IsSampling = bind.InspectMark;
+ }
+ Db.Updateable(dataStock).ExecuteCommand();
+ }
+ else
+ {
+ var stock = new DataStock()
+ {
+ SkuNo = sku.SkuNo,
+ SkuName = sku.SkuName,
+ Standard = sku.Standard,
+ LotNo = bind.LotNo,
+ LotText = bind.LotText,
+ Qty = bind.Qty,
+ LockQty = 0,
+ FrozenQty = 0,
+ IsSampling = bind.InspectMark,
+ IsDel = "0",
+ CreateUser = userId,
+ CreateTime = comTime
+ };
+ //缁存姢搴撳瓨璐т富淇℃伅
+ if (notice.Type == "0" || notice.Type == "2" || notice.Type == "4" || notice.Type == "6" || notice.Type == "7")//0:鎴愬搧鍏ュ簱锛�2:涓棿鍝佸叆搴�,4:杞﹂棿浣欐枡鍏ュ簱,6:浠e偍鍏ュ簱,7:瀵勫瓨鍏ュ簱
+ {
+ stock.OwnerNo = notice.CustomerNo;//璐т富缂栫爜
+ stock.OwnerName = notice.CustomerName;//璐т富鍚嶇О
+ }
+ Db.Insertable(stock).ExecuteCommand();
+ }
+ #endregion
+
+ #region 璐ㄦ璇烽獙
+ if ((notice.Type == "1" || notice.Type == "4" || notice.Type == "5") && sku.IsInspect != "1")
+ {
+ var qualityRequest = Db.Queryable<BllQualityInspectionRequest>().First(m => m.IsDel == "0" && m.SkuNo == sku.SkuNo && m.LotNo == bind.LotNo && m.SupplierLot == bind.SupplierLot);
+ if (qualityRequest == null)
+ {
+ string qcNo = new Common().GetMaxNo("QC");
+ qualityRequest = new BllQualityInspectionRequest();
+ qualityRequest.QcNo = qcNo;
+ qualityRequest.Status = "0";
+ qualityRequest.SkuNo = sku.SkuNo;
+ qualityRequest.SkuName = sku.SkuName;
+ qualityRequest.LotNo = bind.LotNo;
+ qualityRequest.SupplierLot = bind.SupplierLot;
+ qualityRequest.Qty = detail.Qty;
+ qualityRequest.SamplingQty = 0;
+ qualityRequest.ASNNo = detail.ASNNo;
+ qualityRequest.CreateUser = userId;
+ qualityRequest.CreateTime = comTime;
+ //娣诲姞璐ㄦ璇烽獙鍗�
+ Db.Insertable(qualityRequest).ExecuteCommand();
+ }
+ }
+ #endregion
+
+ // 鏇存敼鎵樼洏浣跨敤鐘舵��
+ var sqlStr = $"update SysPallets set Status = '1' where PalletNo = '{model.PalletNo}';";
+ //娣诲姞鎵樼洏璁板綍琛ㄦ暟鎹�
+ sqlStr += $"insert into LogPalletTrack values('{model.PalletNo}','{model.AsnNo}','缁勭洏','0',getDate(),{userId},NULL,NULL);";
+ Db.Ado.ExecuteCommand(sqlStr);
+ new OperationASNServer().AddLogOperationAsn("PDA妯″潡", "鎵樼洏缁戝畾", model.AsnNo, "娣诲姞", $"娣诲姞浜嗘墭鐩樼爜涓猴細{model.PalletNo}鐨勭粍鐩樹俊鎭�", userId);
+
+
+
}
#endregion
@@ -4954,7 +5304,7 @@
#region JC23鍙栨牱涓氬姟鎺ュ彛
//鑾峰彇鏈粍鎵樻垨宸茬粍鎵樼殑绠辩爜绾у埆
- public BoxInfoDto GetBoxLevel(string boxNo,string boxNo3)
+ public BoxInfoDto GetBoxLevel(string boxNo, string boxNo3)
{
try
{
@@ -4974,7 +5324,7 @@
}
var str = "0";
var data = Db.Queryable<BllBoxInfo>().Where(m => m.IsDel == "0" && m.BoxNo == boxNo && m.Status != "2")
- .GroupBy(m=>new {m.BoxNo,m.SkuNo,m.SkuName,m.LotNo}).Select(m=>new BoxInfoDto()
+ .GroupBy(m => new { m.BoxNo, m.SkuNo, m.SkuName, m.LotNo }).Select(m => new BoxInfoDto()
{
SkuNo = m.SkuNo,
SkuName = m.SkuName,
@@ -4989,7 +5339,7 @@
}
var count = Db.Queryable<BllBoxInfo>().Count(m =>
m.IsDel == "0" && m.BoxNo == boxNo && !string.IsNullOrWhiteSpace(m.BoxNo3));
- str = count>0 ? "2" : "1";
+ str = count > 0 ? "2" : "1";
data[0].BoxLevel = str;
return data[0];
}
@@ -5020,7 +5370,7 @@
throw new Exception("鏈煡璇㈠埌绛夊緟鎵ц鐨勬墭鐩樼粦瀹氫俊鎭�");
}
- if (bindList.Count>1)
+ if (bindList.Count > 1)
{
throw new Exception("鎵樼洏缁戝畾淇℃伅瀛樺湪澶氭潯淇℃伅锛岃鏍稿疄");
}
@@ -5067,7 +5417,7 @@
throw new Exception("鍙栨牱鏁伴噺涓嶈兘涓虹┖");
}
- if (model.BoxLevel!= "1" && model.BoxLevel != "2")
+ if (model.BoxLevel != "1" && model.BoxLevel != "2")
{
throw new Exception("鍙栨牱鏍囪瘑閿欒锛岃鍒锋柊椤甸潰");
}
@@ -5114,7 +5464,7 @@
{
item.Qty -= sampleQty;
item.InspectMark = "1";//鎶芥鎵樻爣璁�
- item.SamplingQty = item.SamplingQty == null? sampleQty: item.SamplingQty + sampleQty;
+ item.SamplingQty = item.SamplingQty == null ? sampleQty : item.SamplingQty + sampleQty;
}
}
Db.Updateable(boxList).ExecuteCommand();
@@ -5128,7 +5478,7 @@
throw new Exception("绠辩爜鐘舵�佸凡缁勬墭锛屼絾鏈煡璇㈠埌鎵樼洏缁戝畾淇℃伅");
}
bind.BitPalletMark = "1";
- bind.SamplingQty = bind.SamplingQty == null ? sampleQty : bind.SamplingQty + sampleQty;
+ bind.SamplingQty = bind.SamplingQty == null ? sampleQty : bind.SamplingQty + sampleQty;
bind.Qty -= sampleQty;
bind.InspectMark = "1";
Db.Updateable(bind).ExecuteCommand();
@@ -5145,11 +5495,11 @@
}
-
- }
+
+ }
else if (model.BoxLevel == "1")
{
- if (boxList.Count>1)
+ if (boxList.Count > 1)
{
throw new Exception("涓�绾х鐮佹煡璇㈤敊璇紝鍚湁澶氭潯鐩稿悓绠辩爜鏁版嵁");
}
@@ -5229,7 +5579,7 @@
var bind = bindList.First();
var boxInfoCount = Db.Queryable<BllBoxInfo>().Count(m => m.IsDel == "0" && m.BindNo == bind.Id);
- if (boxInfoCount>0)
+ if (boxInfoCount > 0)
{
throw new Exception("褰撳墠鎵樼洏缁戝畾淇℃伅鏄湁绠辩爜鐨勶紝璇峰湪鏍囩椤靛彇鏍�");
}
diff --git a/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs
index 1b53369..2c3e986 100644
--- a/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs
+++ b/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs
@@ -1083,5 +1083,86 @@
}
#endregion
+ #region 闆剁瑙g粦
+ public void LingxingUnbind(string palletNo,string boxNo, int userId)
+ {
+ try
+ {
+ if (string.IsNullOrEmpty(palletNo))
+ {
+ throw new Exception("鎵樼洏鍙蜂笉鑳戒负绌�");
+ }
+ if (string.IsNullOrEmpty(boxNo))
+ {
+ throw new Exception("绠辩爜涓嶈兘涓虹┖");
+ }
+ //寮�鍚簨鍔�
+ Db.BeginTran();
+ var comTime = DateTime.Now;
+
+ //鎵樼洏搴撳瓨鏄庣粏淇℃伅
+ var detail = Db.Queryable<DataStockDetail>().First(w => w.IsDel == "0" && w.PalletNo == palletNo);
+ if (detail == null)
+ {
+ throw new Exception("璇ユ墭鐩樺簱瀛樻槑缁嗕俊鎭笉瀛樺湪");
+ }
+ //搴撳瓨绠辨敮鏄庣粏淇℃伅
+ var boxList = Db.Queryable<DataBoxInfo>().Where(w => w.IsDel == "0" && w.StockDetailId == detail.Id && w.BoxNo == boxNo).ToList();
+ if (boxList.Count <= 0)
+ {
+ throw new Exception("璇ョ鐮佸簱瀛樼鏀俊鎭笉瀛樺湪");
+ }
+ decimal boxQty = 0;//绠卞唴鏁伴噺
+ foreach (var item in boxList)
+ {
+ boxQty += item.Qty;
+
+ item.StockDetailId = 0;//娓呯┖鎵樼洏澶栭敭
+ }
+ //鏇存柊搴撳瓨绠辨敮鏄庣粏琛�
+ Db.Updateable(boxList).ExecuteCommand();
+
+ detail.Qty -= boxQty;//鎵樼洏搴撳瓨鏁伴噺
+ detail.BitPalletMark = "1";//闆舵墭鏍囪
+ //鏇存柊鎵樼洏搴撳瓨琛�
+ Db.Updateable(detail).ExecuteCommand();
+
+ //娣诲姞鎵樼洏瑙g粦缁戝畾璁板綍
+ var unBind = new BllPalletUnbind()
+ {
+ UpbindPalletNo = palletNo,
+ BindPalletNo = "",
+ LotNo = detail.LotNo,
+ LotText = detail.LotText,
+ SupplierLot = detail.SupplierLot,
+ SkuNo = detail.SkuNo,
+ SkuName = detail.SkuName,
+ Standard = detail.Standard,
+ Qty = boxQty,
+ PalletNo2 = detail.PalletNo2,
+ PalletNo3 = detail.PalletNo3,
+ BoxNo = boxNo,
+ InspectNo = "",
+ InspectStatus = detail.InspectStatus,
+
+ IsDel = "0",
+ CreateTime = comTime,
+ CreateUser = userId
+ };
+ Db.Insertable(unBind).ExecuteCommand();
+
+ //娣诲姞鎿嶄綔鏃ュ織
+ new OperationCrServer().AddLogOperationCr("搴撳唴浣滀笟", "鎿嶄綔鏃ュ織", boxNo, "缂栬緫", $"闆剁瑙g粦锛氬師鎵樼洏鐮侊細{palletNo}涓婄殑绠辩爜{boxNo}瑙g粦", userId);
+ //鎻愪氦浜嬪姟
+ Db.CommitTran();
+ }
+ catch (Exception e)
+ {
+ //鍥炴粴浜嬪姟
+ Db.RollbackTran();
+ throw new Exception(e.Message);
+ }
+ }
+ #endregion
}
}
diff --git a/Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs b/Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs
index bbb4008..702e76c 100644
--- a/Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs
+++ b/Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs
@@ -58,7 +58,7 @@
///// </summary>
///// <param name="model"></param>
///// <param name="userId"></param>
- //void BindPalletPasteCode(PdaPalletBindVm model, int userId);
+ void BindPalletPasteCode(PdaPalletBindVm model, int userId);
/// <summary>
/// JC26缁戝畾鎵樼洏 涓嶈创鏍囩墿鏂�
diff --git a/Wms/WMS.IBLL/IPdaServer/IPdaCrServer.cs b/Wms/WMS.IBLL/IPdaServer/IPdaCrServer.cs
index 746c614..2a0e958 100644
--- a/Wms/WMS.IBLL/IPdaServer/IPdaCrServer.cs
+++ b/Wms/WMS.IBLL/IPdaServer/IPdaCrServer.cs
@@ -140,5 +140,15 @@
/// <param name="userId"></param>
Task AgvTransport2(string soNo, string palletNo, string areaNo, int userId);
#endregion
+
+ #region 闆舵墭瑙g粦
+ /// <summary>
+ /// 闆舵墭瑙g粦
+ /// </summary>
+ /// <param name="palletNo"></param>
+ /// <param name="boxNo"></param>
+ /// <param name="userId"></param>
+ public void LingxingUnbind(string palletNo, string boxNo, int userId);
+ #endregion
}
}
diff --git a/Wms/Wms/Controllers/PdaAsnController.cs b/Wms/Wms/Controllers/PdaAsnController.cs
index f59a6ce..d896832 100644
--- a/Wms/Wms/Controllers/PdaAsnController.cs
+++ b/Wms/Wms/Controllers/PdaAsnController.cs
@@ -583,7 +583,14 @@
{
throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
}
- _PdaAsnSvc.BindPalletNoPasteCode(model, int.Parse(UserId));
+ if (model.TableType == 0)
+ {
+ _PdaAsnSvc.BindPalletPasteCode(model, int.Parse(UserId));
+ }
+ else if (model.TableType == 1)
+ {
+ _PdaAsnSvc.BindPalletNoPasteCode(model, int.Parse(UserId));
+ }
return Ok(new { code = 0, msg = "缁戝畾鎴愬姛!" });
diff --git a/Wms/Wms/Controllers/PdaCrController.cs b/Wms/Wms/Controllers/PdaCrController.cs
index 5170c06..86c1d5e 100644
--- a/Wms/Wms/Controllers/PdaCrController.cs
+++ b/Wms/Wms/Controllers/PdaCrController.cs
@@ -248,5 +248,39 @@
#endregion
+ #region 闆剁瑙g粦
+ /// <summary>
+ /// 闆剁瑙g粦
+ /// </summary>
+ /// <param name="model"></param>
+ /// <returns></returns>
+ [HttpPost]
+ public IActionResult LingxingUnbind(PdaPalletUnBindVm model)
+ {
+ try
+ {
+ //鑾峰彇褰撳墠鐧诲綍鐨勭敤鎴稩D
+ var claimsIdentity = this.User.Identity as ClaimsIdentity;
+ if (claimsIdentity == null)
+ {
+ return Ok(new { code = 1, msg = "鏈幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
+ }
+ var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
+ if (string.IsNullOrWhiteSpace(userId))
+ {
+ return Ok(new { code = 1, msg = "鏈幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
+ }
+
+ var uId = int.Parse(userId);
+ _pdaCrSvc.LingxingUnbind(model.PalletNo, model.BoxNo, uId);
+
+ 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/appsettings.json b/Wms/Wms/appsettings.json
index bf36940..b5ce370 100644
--- a/Wms/Wms/appsettings.json
+++ b/Wms/Wms/appsettings.json
@@ -11,7 +11,8 @@
//"ConnectionString": "Server=47.95.120.93;Database=WMS_JC09;User ID=sa;password=boxline!@#; Integrated Security=True;",
//"ConnectionString": "Server=47.95.120.53;Database=WMS_JC09;User ID=sa;Password=boxline!@#;Integrated Security=False;",
//"ConnectionString": "Server=192.168.62.106;Database=WMS_JC24;User ID=sa;Password=sql2019;Integrated Security=False;",
- "ConnectionString": "Server=192.168.62.200;Database=WMS_JC26;User ID=sa;Password=sql2019;Integrated Security=False;"
+ //"ConnectionString": "Server=192.168.62.200;Database=WMS_JC26;User ID=sa;Password=sql2019;Integrated Security=False;",
+ "ConnectionString": "Server=.\\MSSQLSERVER2019;Database=WMS_JC26;User ID=sa;Password=admin2023@;Integrated Security=False;"
//"ConnectionString": "Server=.;Database=WMS_JC09;User ID=sa;Password=sql2019;Integrated Security=False;"
//"ConnectionString": "Data Source=DESKTOP-0EJDG95\\MSSQLSERVER1;Initial Catalog=WMS_V01;Integrated Security=True;"
},
@@ -46,7 +47,7 @@
},
"Quartz": {
"dbProviderName": "SqlServer",
- "connectionString": "Server=192.168.62.200;Database=QRTZ;User ID=sa;Password=sql2019;Integrated Security=False;"
+ "connectionString": "Server=.\\MSSQLSERVER2019;Database=QRTZ;User ID=sa;Password=admin2023@;Integrated Security=False;"
}
--
Gitblit v1.8.0