From 46c882f7b2d8522464522953f0a8afceeb69eb0c Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期五, 29 十二月 2023 09:06:51 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/生产管理/生产任务单/Sc_ICMOBillController.cs |   85 ++++++++++++++++++++++++++++++++++--------
 1 files changed, 69 insertions(+), 16 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 215f510..7540326 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"
@@ -464,12 +464,8 @@
                     ",'" + HSeOrderBillNo + "'," + HSeOrderInterID + "," + HSeOrderEntryID + "," + HEmpID + "," + HCusID +
                     "," + HCenterID + ",0,0,0,0," + HBomID + ",'',''" +
                     ",'"+ HIsStockQty + "','"+ HRemark3 + "') ");
+                    
 
-
-                    //鍙嶅啓閿�鍞鍗曟暟鎹�
-                    ClsSc_ICMOBillSub oSub = Newtonsoft.Json.JsonConvert.DeserializeObject<ClsSc_ICMOBillSub>(msg3);
-                    string sql = "update Xs_SeOrderBillSub set HRelationQty_ICMO = ISNULL(HRelationQty_ICMO,0) + " + (oSub.HQty == null ? 0 : oSub.HQty) + " where HInterID = " + mainList[0].HSeOrderInterID + " and HEntryID = "+ mainList[0].HSeOrderEntryID;
-                    oCN.RunProc(sql);
 
                     LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",鏂板鐢熶骇璁㈠崟鍗曟嵁:" + HBillNo);
                     oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "鏂板鐢熶骇璁㈠崟鍗曟嵁锛�" + HBillNo + "','LMES-鐢熶骇璁㈠崟妯″潡','" + DBUtility.ClsPub.IPAddress + "','鏂板鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
@@ -495,21 +491,28 @@
                     //鍒犻櫎瀛愯〃
                     oCN.RunProc("delete from Sc_ICMOBillSub where HInterID='" + HInterID + "' and HEntryID='" + HEntryID + "'");
 
-
-                    //鍙嶅啓閿�鍞鍗曟暟鎹�
-                    ClsSc_ICMOBillSub oSub = Newtonsoft.Json.JsonConvert.DeserializeObject<ClsSc_ICMOBillSub>(msg3);
-                    string sql = "update Xs_SeOrderBillSub set " +
-                        "HRelationQty_ICMO = ISNULL(HRelationQty_ICMO,0) - " + ds.Tables[0].Rows[0]["閿�鍞暟閲�"] + " +  " + (oSub.HQty == null ? 0 : oSub.HQty) + "" +
-                        " where HInterID = " + mainList[0].HSeOrderInterID + " and HEntryID = " + mainList[0].HSeOrderEntryID;
-                    oCN.RunProc(sql);
-
-
-
                     LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",淇敼鐢熶骇璁㈠崟鍗曟嵁:" + HBillNo);
                     oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "淇敼鐢熶骇璁㈠崟鍗曟嵁锛�" + HBillNo + "','LMES-鐢熶骇璁㈠崟妯″潡','" + DBUtility.ClsPub.IPAddress + "','淇敼鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
                 }
                 //淇濆瓨瀛愯〃
                 objJsonResult = AddBillSub_NoTable(msg3, HInterID, OperationType, HEntryID);
+
+
+                //鍙嶅啓婧愬崟-閿�鍞鍗曟暟鎹�
+                if ((OperationType == 1 || OperationType == 2 || OperationType == 4) && ds.Tables[0].Rows.Count == 0)
+                {
+                    //鐢熶骇璁㈠崟鏂板鍥炲~閿�鍞鍗曞叧鑱旀暟閲�
+                    oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToICMO_Add " + HInterID);
+                }
+                else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
+                {
+                    //鐢熶骇璁㈠崟鍒犻櫎鍥炲~閿�鍞鍗曞叧鑱旀暟閲�
+                    oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToICMO_Delete " + HInterID);
+                    //鐢熶骇璁㈠崟鏂板鍥炲~閿�鍞鍗曞叧鑱旀暟閲�
+                    oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToICMO_Add " + HInterID);
+                }
+
+
 
                 if (objJsonResult.code == "0")
                 {
@@ -592,7 +595,7 @@
                 ,'{(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}
-	                    ,0,0,'','',0,0
+	                    ,{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}')");
 
             objJsonResult.code = "1";
@@ -934,6 +937,8 @@
                     return objJsonResult; ;
                 }
 
+                //鐢熶骇璁㈠崟鍒犻櫎鍥炲~閿�鍞鍗曞叧鑱旀暟閲�
+                oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToICMO_Delete " + HInterID);
 
 
                 oCN.RunProc("delete from Sc_ICMOBillMain  where HInterID=" + HInterID);
@@ -2034,5 +2039,53 @@
         }
         #endregion
 
+        #region 涓鸿繘琛屾帓浜х殑鐢熶骇璁㈠崟 鍒楄〃
+        [Route("Sc_ICMOBill/NotInDayPlan")]
+        [HttpGet]
+        public object Sc_ICMOBillList_NotInDayPlan(string sWhere, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                ds = oCN.RunProcReturn("select * from  h_v_Sc_ICMOList_NotInDayPlan where 1 = 1" + sWhere , "h_v_Sc_ICMOList_NotInDayPlan");
+
+                if (ds == null && ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "Sucess锛佹病鏈夋煡璇㈠埌鐩稿叧鏁版嵁";
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+                else
+                {
+                    //娣诲姞鍒楀悕
+                    foreach (DataColumn col in ds.Tables[0].Columns)
+                    {
+                        Type dataType = col.DataType;
+                        string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                        columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                    }
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "Sucess锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    objJsonResult.list = columnNameList;
+                    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