From 64906fa2a99d9754086277759e66a6c5b26f9800 Mon Sep 17 00:00:00 2001
From: zrg <z1873@LAPTOP-EAVL132E>
Date: 星期四, 15 一月 2026 17:47:54 +0800
Subject: [PATCH] 根据系统参数增加客户为华舟的自动把出站单生成条码,出站单增加重量字段

---
 WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs |  141 +++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 117 insertions(+), 24 deletions(-)

diff --git a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
index af1c550..ceb6477 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
@@ -157,6 +157,7 @@
                 int HIsTimeFlag = list[0].HIsTimeFlag;//鏄惁璁℃椂
                 string HRelBeginTime = list[0].HRelBeginTime;//寮�宸ユ椂闂�
                 string HRelEndTime = list[0].HRelEndTime;//瀹屽伐鏃堕棿
+                double HWeight = list[0].HWeight;//閲嶉噺
                 LogService.Write($"1.瀛楁璧嬪�硷紝鐢ㄦ椂" + sw.Elapsed );
 
                 //鍗曟嵁瀹屾暣鎬у垽鏂�
@@ -417,7 +418,7 @@
                     ",HMainSourceInterID,HMainSourceBillNo,HMainSourceBillType,HLastSubProc" +
                     ",HEmpID2,HEmpID3,HEmpID4,HEmpID5,HDSQty,HChongQty,HPriceRate,HWorkTimes,HQCCheckID,HMainInterID,HPRDOrgID" +
                     ",HmaterOutqty,HProcPriceRate,HTemporaryAreaID,HWasterQty_Work,HWasterQty_Mater,HBackWorkQty,HShiftsID" +
-                    ",HToCheckQty,HLossQty,HBackWorkByMaterQty,HMouldID,HMachineWorkTimes,HIsTimeFlag,HRelBeginTime,HRelEndTime " +
+                    ",HToCheckQty,HLossQty,HBackWorkByMaterQty,HMouldID,HMachineWorkTimes,HIsTimeFlag,HRelBeginTime,HRelEndTime,HWeight " +
                     ") " +
                     " values('" + BillType + "','" + (OperationType == "5" ? "SUB" : HBillSubType)  + "'," + HInterID + ",'" + HBillNo + "'," + HBillStatus + ",'"+ HDate + "','" + HMaker + "',getdate(),'" + HMouldNum + "'" +
                     "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HSourceName + "'," + HPieceQty + "," + HWasterQty + "," + HPlanPieceQty + "," + HBadPNL +
@@ -428,7 +429,7 @@
                     "," + HMainSourceInterID + ",'" + HMainSourceBillNo + "','" + HMainSourceBillType + "'," + Convert.ToString(HLastSubProc ? 1 : 0) +
                     "," + HEmpID2 + "," + HEmpID3 + "," + HEmpID4 + "," + HEmpID5 + "," + HDSQty + "," + HChongQty + "," + HPriceRate + "," + HWorkTimes + "," + HQCCheckID + "," + HMainInterID + "," + HPRDOrgID +
                     "," + HmaterOutqty + "," + HProcPriceRate + "," + HTemporaryAreaID + "," + HWasterQty_Work + "," + HWasterQty_Mater + "," + HBackWorkQty +
-                    "," + HShiftsID + "," + HToCheckQty + "," + HLossQty + ","+ HBackWorkByMaterQty + "," + HMouldID + ",'" + HMachineWorkTimes + "',"+ HIsTimeFlag + ",'" + HRelBeginTime + "','" + HRelEndTime +  "') ");
+                    "," + HShiftsID + "," + HToCheckQty + "," + HLossQty + ","+ HBackWorkByMaterQty + "," + HMouldID + ",'" + HMachineWorkTimes + "',"+ HIsTimeFlag + ",'" + HRelBeginTime + "','" + HRelEndTime + "','" + HWeight + "') ");
 
                     LogService.Write($"4.鏂板缁撴潫锛岀敤鏃�" + sw.Elapsed);
                     LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",鏂板宸ュ簭鍑虹珯鍗曟嵁:" + HBillNo);
@@ -476,9 +477,7 @@
                     ",HBackWorkByMaterQty=" + HBackWorkByMaterQty +
                     ",HMouldID=" + HMouldID +
                     ",HMachineWorkTimes=" + HMachineWorkTimes +
-                    //",HIsTimeFlag=" + HIsTimeFlag +
-                    //",HRelBeginTime='" + HRelBeginTime + "'" +
-                    //",HRelEndTime='" + HRelEndTime + "'" +
+                    ",HWeight=" + HWeight +
                     " from Sc_StationOutBillMain a with(nolock)" +
                     " where HInterID=" + HInterID);
 
@@ -641,29 +640,16 @@
                     {
                         object objResult = set_SaveStationOutBill_CLD_Json(HInterID, HBillNo, user);
                     }
+                    //鍒ゆ柇瀹㈡埛涓哄崕鑸熷寘瑁� 鐢熸垚鏉$爜涓绘。
+                    else if (oSystemParameter.omodel.WMS_CampanyName == "鍗庤垷")
+                    {
+                        var objResult = Cj_StationOutBarCode_Save(HInterID);                        
+                    }
                 }
                 sw.Stop();//缁撴潫璁℃椂
                 LogService.Write($"11.鍙傛暟鏌ヨ缁撴潫,鏂板缁撴潫锛岀敤鏃�" + sw.Elapsed);
                 LogService.Write("END--鍑虹珯鍗曟嵁淇濆瓨缁撴潫锛屽嚭绔欏崟鍙凤細" + HBillNo);
 
-                //娴嬭瘯璇彞===========================================================================================================
-                string msg_str = "";
-                string sql_str = "select a.HQty HQty_Main,b.HQty HQty_Sub " +
-                            "from Sc_ProcessExchangeBillMain as a with(nolock)" +
-                            "inner join Sc_ProcessExchangeBillSub as b with(nolock) on a.HInterID = b.HInterID " +
-                            "where a.HInterID = " + HProcExchInterID;
-                DataSet ds_str = oCN.RunProcReturn(sql_str, "Sc_ProcessExchangeBillMain");
-                if (ds_str.Tables[0].Rows.Count > 0)
-                {
-                    msg_str = "HQty_Main:" + ds_str.Tables[0].Rows[0]["HQty_Main"].ToString() + ";HQty_Sub:";
-                    for (int j = 0; j < ds_str.Tables[0].Rows.Count; j++)
-                    {
-                        msg_str += ds_str.Tables[0].Rows[j]["HQty_Sub"].ToString() + ",";
-                    }
-                }
-
-                oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "淇敼宸ュ簭鍑虹珯鍗曟嵁锛�" + HBillNo + "[宸ュ簭娴佽浆鍗″彿锛�" + HProcExchBillNo + "]" + msg_str + "','LMES-宸ュ簭鍑虹珯妯″潡','" + DBUtility.ClsPub.IPAddress + "','鏂板鎴栦慨鏀瑰崟鎹�'", ref DBUtility.ClsPub.sExeReturnInfo);
-                //==============================================================================================================
 
 
                 objJsonResult.code = "1";
@@ -1366,7 +1352,114 @@
         }
         #endregion
 
+        #region [鍑虹珯鍗曠敓鎴愭潯鐮佷富妗    
+        [Route("Cj_StationOutBill/Cj_StationOutBarCode_Save")]
+        [HttpPost]
+        public object Cj_StationOutBarCode_Save(long HInterID)
+        {
+            try
+            {
+                ListModels oListModels = new ListModels();
+                DAL.ClsGy_BarCodeBill_ChaiMa BillNew = new DAL.ClsGy_BarCodeBill_ChaiMa();             
 
+                oCN.BeginTran();
+
+                ds = oCN.RunProcReturn("select  * from Sc_StationOutBillMain where HInterID='" + HInterID + "'", "Sc_StationOutBillMain");
+
+                if (ds != null || ds.Tables[0].Rows.Count > 0)
+                {
+
+                    string sql = "insert into Gy_BarCodeBill (HInterID, HEntryID, HBarCode, HBarCodeType, HBarCodeSubType, HMaterID, HUnitID, HQty, HBatchNo, HSupID, HGroupID, HMaker, HMakeDate, " +
+                  "HPrintQty, HSourceInterID, HSourceEntryID, HSourceBillNo, HSourceBillType, HinitQty, HEndQty, HBarcodeQtys, HBarcodeNo, HDeptID, HWhID, HSPID, HRemark, " +
+                  "HCusID, HCusType, HEndDate, HWorkLineName, HBarCodeDate, HSTOCKORGID, HOWNERID, HSeOrderBillNo, HGiveAwayFlag, HMaterName, HMaterModel, " +
+                  "HPinfan, HAuxPropID, HMTONo, HInnerBillNo, HCoilNO, HFurnaceNO, HFactory, HAuxQty, HheatNO, HEmpID, HCusModel, HCusMaterName, HCheckEmpName, HZZRQ,HSupMaterNumber,HSupBatchNo" +
+                  ") values (" +
+                  "'" + ds.Tables[0].Rows[0]["HInterID"].ToString() + "', " +
+                  "'1', " +
+                  "'" + ds.Tables[0].Rows[0]["HBillNO"].ToString() + "', " +
+                  "'鍞竴鏉$爜', " +
+                  "'', " +
+                  "'" + ds.Tables[0].Rows[0]["HMaterID"].ToString() + "', " +
+                  "'0', " +
+                  "'" + ds.Tables[0].Rows[0]["HQty"].ToString() + "', " +
+                  "'', " +
+                  "'', " +
+                  "'" + ds.Tables[0].Rows[0]["HGroupID"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HMaker"].ToString() + "', getdate(), " +
+                  "'0', " +
+                  "'" + ds.Tables[0].Rows[0]["HProcExchInterID"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HProcExchEntryID"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HProcExchBillNo"].ToString() + "', " +
+                  "'3772', " +
+                  "'0', " +
+                  "'0', " +
+                  "'1', " +
+                  "'1', " +
+                  "'" + ds.Tables[0].Rows[0]["HDeptID"].ToString() + "', " +
+                  "'0', " +
+                  "'0', " +
+                  "'" + ds.Tables[0].Rows[0]["HRemark"].ToString() + "', " +
+                  "'0', " +
+                  "'', " +
+                  "getdate(), " +
+                  "'', " +
+                  "getdate(), " +
+                  "'" + ds.Tables[0].Rows[0]["HPRDORGID"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HPRDORGID"].ToString() + "', " +
+                  "'', " +
+                  "'0', " +
+                  "'', " +
+                  "'', " +
+                  "'', " +
+                  "'0', " +
+                  "'', " +
+                  "'', " +
+                  "'', " +
+                  "'', " +
+                  "'', " +
+                  "'0', " +
+                  "'', " +
+                  "'" + ds.Tables[0].Rows[0]["HEmpID"].ToString() + "', " +
+                  "'', " +
+                  "'', " +
+                  "'', " +
+                  "'', " +
+                  "'', " +
+                  "''" +
+                  ")";
+                    //鎻掑叆鎷嗗垎鏉$爜
+                    oCN.RunProc(sql);
+                  
+                    oCN.Commit();
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+
+                }
+                else
+                {
+                    oCN.RollBack();
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇濆瓨澶辫触锛佹湭鏌ヨ鍒版潯鐮佷俊鎭�";
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();
+                oCN.RunProc("update Sc_StationOutBillMain set HInterFaceRemark =" + e.ToString() + ", HInterFaceStatus ='鏈敓鎴�' where HInterID=" + HInterID);
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
 
 
 
@@ -3106,7 +3199,7 @@
                     sReturn = "鍗曟嵁鏈壘鍒帮紒";
                     return false;
                 }
-                oCN.RunProc(" Update a set HChecker='" + HChecker + "',HCheckDate='" + HCheckDate + "' from Sc_StationOutBillMain with(nolock) Where HInterID=" + lngBillKey.ToString());
+                oCN.RunProc(" Update a set HChecker='" + HChecker + "',HCheckDate='" + HCheckDate + "' from Sc_StationOutBillMain a with(nolock) Where HInterID=" + lngBillKey.ToString());
                 oCN.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_Check_In " + lngBillKey.ToString() + ",1");
                 //鍒ゆ柇鏄惁鏄� 鏈亾宸ュ簭
                 DataSet ds1;

--
Gitblit v1.9.1