From ef10f06e96034f6ab3db93ea103f2a4d78fcb2b9 Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期一, 13 五月 2024 17:32:29 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/生产管理/生产任务单/Sc_ICMOBillController.cs |  148 +++++++++++++++++++++++++++++++------------------
 1 files changed, 94 insertions(+), 54 deletions(-)

diff --git "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs" "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs"
index 440c080..44abd3c 100644
--- "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs"
+++ "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs"
@@ -327,12 +327,12 @@
                 //涓昏〃
                 oCN.RunProc(@"Insert Into Sc_ICMOBillMain   
                         (HBillType,HInterID,HBillNo,HDate,HPRDORGID
-                        ,HYear,HPeriod,HRemark,HMaker,HMakeDate
+                        ,HYear,HPeriod,HRemark,HMaker,HMakeDate,HChecker,HCheckDate
                         ,HSeOrderBillNo,HSeOrderInterID,HSeOrderEntryID,HEmpID,HCusID
                         ,HCenterID,HPlanQty,HDeptID,HMaterID,HUnitID,HBomID,HPlanBeginDate,HPlanEndDate,HBillStatus
                         ,HOWNERID,HOWNERTYPEID)
                         values('3710'," + mainList[0].HInterID + ",'" + mainList[0].HBillNo + "','" + mainList[0].HDate + "'," + mainList[0].HPRDORGID +
-                "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + mainList[0].HRemark + "','" + mainList[0].HMaker + "',getdate()" +
+                "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + mainList[0].HRemark + "','" + mainList[0].HMaker + "',getdate(),'" + mainList[0].HMaker + "',getdate()" +
                 ",'" + mainList[0].HSeOrderBillNo + "'," + mainList[0].HSeOrderInterID + "," + mainList[0].HSeOrderEntryID + "," + mainList[0].HEmpID + "," + mainList[0].HCusID +
                 "," + mainList[0].HCenterID + "," + mainList[0].HPlanQty + ",0,0,0,0,'','',2" +
                 ","+ mainList[0].HOWNERID + ",'"+ mainList[0].HOWNERTYPEID + "') ");
@@ -473,6 +473,7 @@
 
                 long HInterID = mainList[0].HInterID;//閫掑叆type寰楀埌鐨勫崟鎹甀D
                 string HBillNo = mainList[0].HBillNo;//閫掑叆type寰楀埌鐨勫崟鎹彿
+                string HMainSourceBillSubType = mainList[0].HMainSourceBillSubType;
                 long HPRDORGID = mainList[0].HPRDORGID;//缁勭粐
                 DateTime HDate = mainList[0].HDate;//鏃ユ湡
                 string HRemark = mainList[0].HRemark;//澶囨敞
@@ -486,45 +487,46 @@
                 //double? HPlanQty = mainList[0].HPlanQty == null ? 0 : mainList[0].HPlanQty;//璁″垝鏁伴噺
                 string HMaker = user;//鍒跺崟浜�
                 string HIsStockQty = mainList[0].HIsStockQty;
+                string HIsStockQty_SeOrderBill = mainList[0].HIsStockQty_SeOrderBill;
                 string HRemark3 = mainList[0].HRemark3;
-              
+
+                //淇濆瓨鍓嶆帶鍒�=========================================              
+                ds = oCN.RunProcReturn("exec h_p_Sc_ICMOBill_BeforeSaveCtrl_New " + HInterID, "h_p_Sc_ICMOBill_BeforeSaveCtrl_New");
+
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇濆瓨鍓嶅垽鏂け璐ワ紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //=========================================================
 
                 ds = oCN.RunProcReturn("select * from h_v_IF_ICMOBillList where hmainid=" + HInterID + " and 鍗曟嵁鍙�='" + HBillNo + "'", "h_v_IF_ICMOBillList");
 
                 if ((OperationType == 1 || OperationType == 2 || OperationType == 4) && ds.Tables[0].Rows.Count == 0)//鏂板
                 {
-                    //淇濆瓨鍓嶆帶鍒�=========================================              
-                    ds = oCN.RunProcReturn("exec h_p_Sc_ICMOBill_BeforeSaveCtrl_New " + HInterID, "h_p_Sc_ICMOBill_BeforeSaveCtrl_New");
-
-                    if (ds == null || ds.Tables[0].Rows.Count == 0)
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 0;
-                        objJsonResult.Message = "淇濆瓨鍓嶅垽鏂け璐ワ紒";
-                        objJsonResult.data = null;
-                        return objJsonResult;
-                    }
-                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 0;
-                        objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
-                        objJsonResult.data = null;
-                        return objJsonResult;
-                    }
-                    //=========================================================
                     //涓昏〃
                     oCN.RunProc(@"Insert Into Sc_ICMOBillMain   
-                        (HBillType,HBillStatus,HInterID,HBillNo,HDate,HPRDORGID
+                        (HBillType,HMainSourceBillSubType,HBillStatus,HInterID,HBillNo,HDate,HPRDORGID
                         ,HYear,HPeriod,HRemark,HMaker,HMakeDate
                         ,HSeOrderBillNo,HSeOrderInterID,HSeOrderEntryID,HEmpID,HCusID
                         ,HCenterID,HPlanQty,HDeptID,HMaterID,HUnitID,HBomID,HPlanBeginDate,HPlanEndDate
-                        ,HIsStockQty,HRemark3)
-                        values('3710',1," + HInterID + ",'" + HBillNo + "','" + HDate + "'," + HPRDORGID +
+                        ,HIsStockQty,HIsStockQty_SeOrderBill,HRemark3)
+                        values('3710','" + (HMainSourceBillSubType==null?"":HMainSourceBillSubType) + "',1," + HInterID + ",'" + HBillNo + "','" + HDate + "'," + HPRDORGID +
                     "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + HRemark + "','" + HMaker + "',getdate()" +
                     ",'" + HSeOrderBillNo + "'," + HSeOrderInterID + "," + HSeOrderEntryID + "," + HEmpID + "," + HCusID +
                     "," + HCenterID + ",0,0,0,0," + HBomID + ",'',''" +
-                    ",'"+ HIsStockQty + "','"+ HRemark3 + "') ");
+                    ",'"+ HIsStockQty + "','" + HIsStockQty_SeOrderBill + "','"+ HRemark3 + "') ");
                     
 
 
@@ -545,9 +547,13 @@
 
                     //淇敼
                     oCN.RunProc("update Sc_ICMOBillMain  set " +
+                                "HMainSourceBillSubType='" + (HMainSourceBillSubType == null ? "" : HMainSourceBillSubType) + "'," +
                                 "HRemark='" + HRemark + "', HUpDater='" + HMaker + "', HUpDateDate=getdate()" +
                                 ", HSeOrderBillNo='" + HSeOrderBillNo + "', HSeOrderInterID=" + HSeOrderInterID + ", HSeOrderEntryID=" + HSeOrderEntryID + ", HEmpID=" + HEmpID + ", HCusID=" + HCusID +
-                                ", HCenterID=" + HCenterID + ",HBomID=" + HBomID + ",HIsStockQty='"+ HIsStockQty + "',HRemark3='" + HRemark3 + "' where HInterID=" + HInterID);
+                                ", HCenterID=" + HCenterID + ",HBomID=" + HBomID + ",HIsStockQty='"+ HIsStockQty + "',HIsStockQty_SeOrderBill='" + HIsStockQty_SeOrderBill + "',HRemark3='" + HRemark3 + "' where HInterID=" + HInterID);
+
+                    //鐢熶骇璁㈠崟鍒犻櫎鍥炲~閿�鍞鍗曞叧鑱旀暟閲�
+                    oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToICMO_Delete " + HInterID);
 
                     //鍒犻櫎瀛愯〃
                     oCN.RunProc("delete from Sc_ICMOBillSub where HInterID='" + HInterID + "' and HEntryID='" + HEntryID + "'");
@@ -567,13 +573,30 @@
                 }
                 else if (OperationType == 3)
                 {
-                    //鐢熶骇璁㈠崟鍒犻櫎鍥炲~閿�鍞鍗曞叧鑱旀暟閲�
-                    oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToICMO_Delete " + HInterID);
                     //鐢熶骇璁㈠崟鏂板鍥炲~閿�鍞鍗曞叧鑱旀暟閲�
                     oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToICMO_Add " + HInterID);
                 }
 
+                //淇濆瓨鍚庢帶鍒�=========================================              
+                ds = oCN.RunProcReturn("exec h_p_Sc_ICMOBill_AfterSaveCtrl_New " + HInterID, "h_p_Sc_ICMOBill_AfterSaveCtrl_New");
 
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇濆瓨鍚庡垽鏂け璐ワ紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //=========================================================
 
                 if (objJsonResult.code == "0")
                 {
@@ -650,35 +673,15 @@
                 ,HMaterID,HUnitID,HRemark,HSourceID,HDeptID,HSTATUS
                 ,HBomID,HEntryCusID,HSTOCKINORGID
 				,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney
-                ,HAuxQty,HAuxUnit,HWidth,HWeight,HColorRemark,HCusMaterName,HCusModel,HOrderPickRemark,HCusMaterNumber) 
+                ,HAuxQty,HAuxUnit,HWidth,HWeight,HColorRemark,HCusMaterName,HCusModel,HOrderPickRemark,HCusMaterNumber,HWidth_New,HWeight_New,HMaterModel,HRemark_New,HPlanOrderProcNo) 
                  values({HInterID},{HEntryID},{(oSub.HQty == null ? 0 : oSub.HQty)}
                 ,'{(oSub.HPlanBeginDate == null ? DateTime.Now.ToString("yyyy-MM-dd") : oSub.HPlanBeginDate.ToString())}','{(oSub.HPlanEndDate == null ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : oSub.HPlanEndDate.ToString())}'
                 ,'{(oSub.HBeginDate == null ? DateTime.Now.ToString("yyyy-MM-dd") : oSub.HBeginDate.ToString())}','{(oSub.HEndDate == null ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : oSub.HEndDate.ToString())}'
                 ,{oSub.HMaterID},{oSub.HUnitID},'{oSub.HRemark}',{oSub.HSourceID},{oSub.HDeptID},{oSub.HSTATUS}
                  ,{oSub.HBomID}  ,{oSub.HCusID} ,{oSub.HSTOCKINORGID}
 	                    ,{oSub.HSourceInterID},{oSub.HSourceEntryID},'{oSub.HSourceBillNo}','{oSub.HSourceBillType}',0,0
-                ,{oSub.HAuxQty},{oSub.HAuxUnit},{oSub.HWidth},{oSub.HWeight},'{oSub.HColorRemark}','{oSub.HCusMaterName}','{oSub.HCusModel}','{oSub.HOrderPickRemark}','{oSub.HCusMaterNumber}')");
+                ,{oSub.HAuxQty},{oSub.HAuxUnit},{oSub.HWidth},{oSub.HWeight},'{oSub.HColorRemark}','{oSub.HCusMaterName}','{oSub.HCusModel}','{oSub.HOrderPickRemark}','{oSub.HCusMaterNumber}',{oSub.HWidth_New},{oSub.HWeight_New},'{oSub.HModel}','{oSub.HRemark_New}','{oSub.HPlanOrderProcNo}')");
 
-            //淇濆瓨鍚庢帶鍒�=========================================              
-            ds = oCN.RunProcReturn("exec h_p_Sc_ICMOBill_AfterSaveCtrl_New " + HInterID, "h_p_Sc_ICMOBill_AfterSaveCtrl_New");
-
-            if (ds == null || ds.Tables[0].Rows.Count == 0)
-            {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "淇濆瓨鍚庡垽鏂け璐ワ紒";
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
-            if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
-            {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
-            //=========================================================
 
             objJsonResult.code = "1";
             objJsonResult.count = 1;
@@ -1044,8 +1047,6 @@
                 //==================================================================================      
 
 
-
-                oCN.BeginTran();//寮�濮嬩簨鍔�
                 ds = oCN.RunProcReturn("select * from Sc_ICMOBillMain where HInterID=" + HInterID, "Sc_ICMOBillMain");
                 if (ds == null || ds.Tables[0].Rows.Count == 0)
                 {
@@ -1114,6 +1115,7 @@
                     return objJsonResult; ;
                 }
 
+                oCN.BeginTran();//寮�濮嬩簨鍔�
                 //鐢熶骇璁㈠崟鍒犻櫎鍥炲~閿�鍞鍗曞叧鑱旀暟閲�
                 oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToICMO_Delete " + HInterID);
 
@@ -1160,6 +1162,7 @@
             }
             catch (Exception e)
             {
+                oCN.RollBack();
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
                 objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString();
@@ -2290,5 +2293,42 @@
         }
         #endregion
 
+        #region 鐢熶骇璁㈠崟 鏍规嵁涓诲唴鐮佷笌瀛愬唴鐮佽幏鍙栫敓浜ц鍗曟暟鎹�
+        [Route("Sc_ICMOBill/loadSc_ICMOBill_Push")]
+        [HttpGet]
+        public object loadSc_ICMOBill_Push(long HInterID, long HSubID)
+        {
+            try
+            {
+
+                ds = oCN.RunProcReturn("select * from h_v_IF_ICMOBillList where hmainid =" + HInterID + " and hsubid = " + HSubID, "h_v_IF_ICMOBillList");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏈煡璇㈠埌婧愬崟淇℃伅锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "Sucess锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1