From ab3ffc8f500e3ad83f7e60cfb6a8fc2eeca8c02f Mon Sep 17 00:00:00 2001
From: 王 垚 <1402714037@qq.com>
Date: 星期三, 04 一月 2023 14:45:56 +0800
Subject: [PATCH] 11

---
 WebAPI/Controllers/BarCodeController.cs |   25 +++++++++++++++++++++----
 1 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/WebAPI/Controllers/BarCodeController.cs b/WebAPI/Controllers/BarCodeController.cs
index 2c43b18..48470e2 100644
--- a/WebAPI/Controllers/BarCodeController.cs
+++ b/WebAPI/Controllers/BarCodeController.cs
@@ -711,7 +711,7 @@
                         }
                     }
                 }
-                
+
                 string HBarCode = "";
                 string HBarCodeType = "";
                 Int64 HMaterID = 0;
@@ -1577,6 +1577,25 @@
                         objJsonResult.data = null;
                         return objJsonResult;
                     }
+                    //鏍¢獙鎵瑰彿 鍜� 鐢熶骇鏃ユ湡
+                    sql = $"select top 1 HKFDate from Gy_BarCodeBill where HSupID = '{oItemSub.HSupID}' and HBatchNo = '{oItemSub.HBatchNo.TrimStart().TrimEnd()}' and HMaterID ={oItemSub.HMaterID} and isnull(HKFDate, '') <> ''";
+                    LogService.Write($"sql:{sql}");
+                    DataTable dt = oCn.RunProcReturn(sql, "tables").Tables[0];
+                    if (dt.Rows.Count > 0)
+                    {
+                        LogService.Write($"HKFDate:{dt.Rows[0][0]}");
+                        sql = $"select DATEDIFF(D,{dt.Rows[0][0]},{oItemSub.HKFDate})";
+                        ds = oCn.RunProcReturn(sql, "tables2");
+                        LogService.Write($"DATEDIFF:{Convert.ToInt32(ds.Tables[0].Rows[0][0])}");
+                        if (ds.Tables[0].Rows.Count > 0 && Convert.ToInt32(ds.Tables[0].Rows[0][0]) != 0)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = $"鐗╂枡缂栫爜{oItemSub.HMaterNumber}锛屾壒鍙穥oItemSub.HBatchNo.TrimStart().TrimEnd()},鐢熶骇鏃ユ湡涓簕dt.Rows[0][0]},璇锋牳瀵�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
                     if (ClsPub.isLong(oItemSub.HMaterID) != 0)
                     {
 
@@ -1611,7 +1630,7 @@
                             }
 
                             //瀹夌憺鏉$爜瑙勫垯锛氱墿鏂欑紪鐮侊紙绯荤粺浠e叆锛堾鐗╂枡鍚嶇О锛堢郴缁熶唬鍏ワ級@瑙勬牸鍨嬪彿锛堢郴缁熶唬鍏ワ級@鐢熶骇鏃ユ湡锛堟墜宸ヨ緭鍏ワ級@鏁伴噺锛堟墜宸ヨ緭鍏ワ級@澶辨晥鏃ユ湡锛堟墜宸ヨ緭鍏ワ級@鎵规鍙凤紙鎵嬪伐浠e叆锛堾渚涘簲鍟嗗悕绉帮紙绯荤粺浠e叆锛堾閲囪喘璁㈠崟鍙凤紙绯荤粺浠e叆锛�
-                            TM = $"{oItemSub.HMaterNumber}@{oItemSub.HMaterName}@{oItemSub.HMaterModel}@{oItemSub.HKFDate}@{HMinQty}@{oItemSub.HKFDQDate}@{oItemSub.HBatchNo}@{oItemSub.HSupName}@{oItemSub.HSourceBillNo}";
+                            TM = $"{oItemSub.HMaterNumber}@{oItemSub.HMaterName}@{oItemSub.HMaterModel}@{oItemSub.HKFDate}@{HMinQty}@{oItemSub.HKFDQDate}@{oItemSub.HBatchNo.TrimStart().TrimEnd()}@{oItemSub.HSupName}@{oItemSub.HSourceBillNo}";
                             Model.ClsGy_BarCodeBill_WMS_Model bar = new Model.ClsGy_BarCodeBill_WMS_Model();
 
                             bar.HBarCode = TM;
@@ -1782,7 +1801,6 @@
                                         + linterid.ToString() + ",'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID + "," + HUnitID + "," + HQty2 + ",'" + HKFDate + "'," + HKFPeriod + ",'" + HKFDQDate
                                         + "','" + HBatchNo + "','" + SubModel.Count + "','" + count + "'," + HSupID + "," + HGroupID + ",'" + ClsPub.CurUserName + "','" + DateTime.Today + "'," + HPrintQty + ",'" + HWei + "',1"
                                         + "," + HSourceInterID + "," + HSourceEntryID + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HMTONO + "')";
-                            LogService.Write(sql);
                             oCn.RunProc(sql);
                             oCn.RunProc("exec setLSH '" + DateTime.Today + "'");
                             count++;
@@ -1827,7 +1845,6 @@
                                       + linterid.ToString() + ",'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID + "," + HUnitID + "," + HQty2 + ",'" + HKFDate + "'," + HKFPeriod + ",'" + HKFDQDate
                                       + "','" + HBatchNo + "','" + SubModel.Count + "','" + _count + "'," + HSupID + "," + HGroupID + ",'" + ClsPub.CurUserName + "','" + DateTime.Today + "'," + HPrintQty + ",'" + HWei + "',1"
                                       + "," + HSourceInterID + "," + HSourceEntryID + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HMTONO + "')";
-                            LogService.Write(sql);
                             oCn.RunProc(sql);
                             _count++;
                         }

--
Gitblit v1.9.1