From 807bb9a2b4d6db408ebdded1cff41f3094eac11e Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期二, 24 三月 2026 15:00:40 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/CJGL/Cj_SingleStationController.cs |   84 ++++++++++++++++++++++--------------------
 1 files changed, 44 insertions(+), 40 deletions(-)

diff --git a/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs b/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs
index 9cf6007..8b3b977 100644
--- a/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs
@@ -435,7 +435,7 @@
                 }
                 else
                 {
-                    if (HProcID == "90")
+                    if (HProcID == "90" || HProcID== "102")
                     {
                         DataSet dataSet = oCN.RunProcReturn(@"exec h_p_Sc_ProcessExchangeBillList2 '" + HBarCode + "'," + HProcID, "h_p_Sc_ProcessExchangeBillList2");
                         if (dataSet.Tables[0].Rows.Count > 0)
@@ -531,7 +531,7 @@
                     "(HInterID,HEntryID,HBillNo_bak,HSourceBillNo,HSourceInterID,HSourceEntryID,HMaterID" +
                     ",HProdOrgID,HSourceBillType,HAuxPropID,HProcID,HQty,HBatchNo,HBarCode,HMTONo,HPlanMode) " +
                     " values(" + HInterID + "," + (i + 1) + ",'" + HBillNo + "','" + tempList[i].HProcExchBillNo + "'," + tempList[i].HProcExchInterID + "," + tempList[i].HProcExchEntryID + "," + tempList[i].HMaterID +
-                    ",'" + HOrgID + "','',0," + HProcID + "," + tempList[i].HQty + ",'"+ tempList[i].HBatchNo + "','" + tempList[i].HBarCode + "','','') ");
+                    ",'" + HOrgID + "','',0," + tempList[i].HProcID + "," + tempList[i].HQty + ",'"+ tempList[i].HBatchNo + "','" + tempList[i].HBarCode + "','','') ");
                 }
 
                 oCN.Commit();
@@ -619,72 +619,76 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-
-                //澧炲姞浜х嚎缁勮杩芥函鍗�
-                DataSet ds1 = oCN.RunProcReturn("exec h_p_Gy_BarCodeBillBomList '" + omodel.HProcExchBillNo + "'," + omodel.HProcID, "h_p_Gy_BarCodeBillBomList");
-                if (ds1.Tables[0].Rows.Count > 0)
+                if (omodel.HProcID!=90)//鏂帿灏旀媿鐓ф竻娲佸伐搴忚繃婊�
                 {
-                    //鍒ら厤浠舵暟閲忔槸鍚︾瓑浜�0
-                    for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
+                    //澧炲姞浜х嚎缁勮杩芥函鍗�
+                    DataSet ds1 = oCN.RunProcReturn("exec h_p_Gy_BarCodeBillBomList '" + omodel.HProcExchBillNo + "'," + omodel.HProcID, "h_p_Gy_BarCodeBillBomList");
+                    if (ds1.Tables[0].Rows.Count > 0)
                     {
-                        double SYHQty = double.Parse(ds1.Tables[0].Rows[i]["閰嶄欢鏁伴噺"].ToString());
-                        string HMaterNamePJ = ds1.Tables[0].Rows[i]["閰嶄欢浠g爜"].ToString();
-                        if (SYHQty == 0)
+                        //鍒ら厤浠舵暟閲忔槸鍚︾瓑浜�0
+                        for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
                         {
-                            oCN.RollBack();
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "[3791-2-020]閰嶄欢浠g爜:" + HMaterNamePJ + ",鏁伴噺涓�0!";
-                            objJsonResult.data = null;
-                            return objJsonResult;
+                            double SYHQty = double.Parse(ds1.Tables[0].Rows[i]["閰嶄欢鏁伴噺"].ToString());
+                            string HMaterNamePJ = ds1.Tables[0].Rows[i]["閰嶄欢浠g爜"].ToString();
+                            if (SYHQty == 0)
+                            {
+                                oCN.RollBack();
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "[3791-2-020]閰嶄欢浠g爜:" + HMaterNamePJ + ",鏁伴噺涓�0!";
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
                         }
-                    }
 
 
-                    ds1 = oCN.RunProcReturn("select * from Sc_AssemblyBillMain WITH(NOLOCK) where HMainSourceInterID =" + omodel.HProcExchInterID + " and HMainSourceEntryID =" + omodel.HProcExchEntryID + " and HBarCode_P = '" + omodel.HBarCode_P + "'", "Sc_AssemblyBillMain");
+                        ds1 = oCN.RunProcReturn("select * from Sc_AssemblyBillMain WITH(NOLOCK) where HMainSourceInterID =" + omodel.HProcExchInterID + " and HMainSourceEntryID =" + omodel.HProcExchEntryID + " and HBarCode_P = '" + omodel.HBarCode_P + "'", "Sc_AssemblyBillMain");
 
-                    if (ds1.Tables[0].Rows.Count == 0)
-                    {
-                        Int64 HInterID1 = DBUtility.ClsPub.CreateBillID("3727", ref DBUtility.ClsPub.sExeReturnInfo);
-                        string HBillNo1 = DBUtility.ClsPub.CreateBillCode("3727", ref DBUtility.ClsPub.sExeReturnInfo, true);
-                        string prefix = omodel.HBarCode_P.Substring(0, 10); // 浠庣储寮�0寮�濮嬶紝鎴彇10涓瓧绗� 鍒ゆ柇姣忎釜椤圭洰鐨凮鏄熷湀閰嶄欢鏁伴噺
-                        
+                        if (ds1.Tables[0].Rows.Count == 0)
+                        {
+                            Int64 HInterID1 = DBUtility.ClsPub.CreateBillID("3727", ref DBUtility.ClsPub.sExeReturnInfo);
+                            string HBillNo1 = DBUtility.ClsPub.CreateBillCode("3727", ref DBUtility.ClsPub.sExeReturnInfo, true);
+                            string prefix = omodel.HBarCode_P.Substring(0, 10); // 浠庣储寮�0寮�濮嬶紝鎴彇10涓瓧绗� 鍒ゆ柇姣忎釜椤圭洰鐨凮鏄熷湀閰嶄欢鏁伴噺
+
                             //淇濆瓨鐢熶骇缁勮鍗曚富琛�
-                         string sql = $@"Insert Into Sc_AssemblyBillMain(HYear,HPeriod,HBillType,HBillSubType,HInterID,HDate
+                            string sql = $@"Insert Into Sc_AssemblyBillMain(HYear,HPeriod,HBillType,HBillSubType,HInterID,HDate
                         ,HBillNo,HBillStatus,HMaker,HMakeDate,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo
                         ,HICMOInterID,HICMOBillNo,HBarCode_P,HMaterID,HUnitID,HAssemblyStatus,HProdOrgID)
                         values('{DateTime.Now.Year}','{DateTime.Now.Month}','3727','3727',{HInterID1},getdate()
                         ,'{HBillNo1}','1','{user}',getdate(),{omodel.HProcExchInterID.ToString()},{omodel.HProcExchEntryID.ToString()},'{omodel.HProcExchBillNo.ToString()}'
                         ,{omodel.HICMOInterID.ToString()},'{omodel.HICMOBillNo.ToString()}','{omodel.HBarCode_P.ToString()}',{omodel.HMaterID},0,'姹囨姤',{omodel.HProdOrgID})";
-                        oCN.RunProc(sql);
-                        if (prefix == "#0TE911124") {
-                            for (int i = 0; i < sub.Count; i++)
+                            oCN.RunProc(sql);
+                            if (prefix == "#0TE911124")
                             {
-                                //瀛愯〃瀛樺偍
-                             string sq2 = $@"Insert Into Sc_AssemblyBillSub(HInterID,HBillNo_bak,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo
+                                for (int i = 0; i < sub.Count; i++)
+                                {
+                                    //瀛愯〃瀛樺偍
+                                    string sq2 = $@"Insert Into Sc_AssemblyBillSub(HInterID,HBillNo_bak,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo
                             ,HSourceBillType,HMaterID,HSourceID,HEquipID,HUnitID,HQty
                             ,HGroupID,HWorkerID,HScanDate,HBarCode,HBarCode_P,HSNNumber)
                             values({HInterID1},'{HBillNo1}',{(i + 1)},0,0,''
                             ,'',{sub[i].HMaterID},0,0,0,3
                             ,0,0,getdate(),'{sub[i].HBarCode}','{omodel.HBarCode_P}','') ";
-                                oCN.RunProc(sq2);
+                                    oCN.RunProc(sq2);
+                                }
                             }
-                        }
-                        else
-                        {
-                            for (int i = 0; i < sub.Count; i++)
+                            else
                             {
-                                //瀛愯〃瀛樺偍
-                                string sq2 = $@"Insert Into Sc_AssemblyBillSub(HInterID,HBillNo_bak,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo
+                                for (int i = 0; i < sub.Count; i++)
+                                {
+                                    //瀛愯〃瀛樺偍
+                                    string sq2 = $@"Insert Into Sc_AssemblyBillSub(HInterID,HBillNo_bak,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo
                             ,HSourceBillType,HMaterID,HSourceID,HEquipID,HUnitID,HQty
                             ,HGroupID,HWorkerID,HScanDate,HBarCode,HBarCode_P,HSNNumber)
                             values({HInterID1},'{HBillNo1}',{(i + 1)},0,0,''
                             ,'',{sub[i].HMaterID},0,0,0,1
                             ,0,0,getdate(),'{sub[i].HBarCode}','{omodel.HBarCode_P}','') ";
-                                oCN.RunProc(sq2);
+                                    oCN.RunProc(sq2);
+                                }
                             }
+
                         }
-                        
+
                     }
 
                 }

--
Gitblit v1.9.1