From 57e1796bf33346c3992edde1a63f635cfae0def9 Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期五, 22 十一月 2024 01:33:14 +0800
Subject: [PATCH] 获取出货状态更新,获取工序过站数据

---
 Tiger.Business.MES/Transaction/YadaPacking.cs |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/Tiger.Business.MES/Transaction/YadaPacking.cs b/Tiger.Business.MES/Transaction/YadaPacking.cs
index 9d04d37..a186824 100644
--- a/Tiger.Business.MES/Transaction/YadaPacking.cs
+++ b/Tiger.Business.MES/Transaction/YadaPacking.cs
@@ -12,6 +12,7 @@
 using Tiger.Model.Entitys.MES.Position;
 using Tiger.Business.MES.WorkAction;
 using Tiger.Model.MES.Yada;
+using System.Data;
 
 namespace Tiger.Business.MES.Transaction
 {
@@ -383,9 +384,20 @@
                     //璁剧疆褰撳墠鎸囦护涓烘甯镐骇鍝佽繃绔�
                     NodeCmd = "NodeSubmit";
 
-                    //
+                    //鑾峰彇鍑鸿揣鐘舵��
                     DbClient db = Biz.DataSource["YadaU9C"].Client;
-                    ShippingOrder = IsPrintCustomerLabel ? db.Queryable<mes_ShipList>().Where(q => q.MoDoc == CurBatch.WO.ORDER_NO && q.Status == 2 && SqlFunc.DateIsSame(q.BusinessDate, DateTime.Now)).First().ShipDoc : "";
+                    var ship = db.Queryable<mes_ShipList>().Where(q => q.MoDoc == CurBatch.WO.ORDER_NO && q.Status == 2 && SqlFunc.DateIsSame(q.BusinessDate, DateTime.Now)).First();
+                    if (ship.IsNullOrEmpty()) { IsPrintCustomerLabel = false; } else
+                    {
+                        SugarParameter[] pars = Biz.Db.Ado.GetParameters(new { BATCH = CurBatch.Batch.BATCH_NO, NodeIdOrName = curNode.NODE_NAME });
+                        var list = Biz.Db.Ado.UseStoredProcedure().GetDataTable("SP_MES_GET_NODE_BATCH_COUNT", pars).AsEnumerable().ToList();
+                        if (!list.IsNullOrEmpty())
+                        {
+                            var batchCount = list.Where(q => q["ProdDate"].ToString() == "Whole").FirstOrDefault();
+                            IsPrintCustomerLabel = batchCount.IsNullOrEmpty() ? false : batchCount["WaitShipment"].ToInt32() >= ship.ShipQty ? false : true;
+                        }
+                    }
+                    ShippingOrder = IsPrintCustomerLabel ? ship?.ShipDoc ?? "" : "";
 
                     //缁戝畾鏉$爜鍒板伐鍗�
                     foreach (var wipSN in wipSNs)

--
Gitblit v1.9.3