From 67b97c8ad2592c6e4afbfe8d34167b7ee696bdef Mon Sep 17 00:00:00 2001
From: yxj <1qaz@123>
Date: 星期四, 20 十月 2022 10:50:43 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Models/StationBill.cs                                       |    2 
 WebAPI/Controllers/SCGL/Sc_ComplementGoodBillController.cs         |  363 +++++++++++++++----------
 WebAPI/Controllers/BLL/Xt_UserController.cs                        |  250 +++++++++++++++++
 WebAPI/Models/Gy_UserCustomer.cs                                   |   14 +
 WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs             |    4 
 WebAPI/Controllers/CJGL/Cj_StationInBillController.cs              |    4 
 WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs      |    4 
 WebAPI/Controllers/SCGL/日计划管理/JIT_ICMOSortBillController.cs        |   37 ++
 WebAPI/ListModels.cs                                               |   36 ++
 WebAPI/Models/Gy_UserMater.cs                                      |   14 +
 WebAPI/Controllers/SCGL/日计划管理/JIT_DayPlanPlatFormBillController.cs |   44 ++
 WebAPI/Controllers/CJGL/Cj_CallGoodsBillMainController.cs          |    2 
 WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs       |   16 
 WebAPI/Models/Gy_UserUser.cs                                       |   14 +
 WebAPI/WebAPI.csproj                                               |    3 
 15 files changed, 638 insertions(+), 169 deletions(-)

diff --git a/WebAPI/Controllers/BLL/Xt_UserController.cs b/WebAPI/Controllers/BLL/Xt_UserController.cs
index 38d1af4..2ffba78 100644
--- a/WebAPI/Controllers/BLL/Xt_UserController.cs
+++ b/WebAPI/Controllers/BLL/Xt_UserController.cs
@@ -852,5 +852,255 @@
             }
         }
         #endregion
+
+        #region  鏍规嵁鐢ㄦ埛缂栫爜鏌ユ壘宸插垎閰嶇敤鎴峰垪琛�
+        [Route("Xt_User/UserPlaylist")]
+        [HttpGet]
+        public object UserPlaylist(string HUserID)
+        {
+            try
+            {
+
+                ds = oCN.RunProcReturn("select HUserID2,鐢ㄦ埛浠g爜 HUserNumber2,鐢ㄦ埛鍚嶇О HUserName2 from h_v_Gy_UserUserList where HUserID='" + HUserID + "' ", "h_v_Gy_UserUserList");
+                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
+
+        #region 鐢ㄦ埛鍏宠仈鐢ㄦ埛淇濆瓨
+        [Route("Xt_User/SaveUserUser")]
+        [HttpPost]
+        public object SaveUserUser([FromBody] JObject msg)
+        {
+            var _value = msg["msg"].ToString();
+            string msg1 = _value.ToString();
+            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg2 = sArray[0].ToString();
+            string msg3 = sArray[1].ToString();
+
+            ListModels oListModels = new ListModels();
+            try
+            {
+                List<Models.Gy_UserUser> lsmain = new List<Models.Gy_UserUser>();
+                msg2 = msg2.Substring(1, msg2.Length - 2);
+                msg2 = msg2.Replace("\\", "");
+                msg2 = msg2.Replace("\n", "");  //\n
+                lsmain = oListModels.getObjectByJson_Gy_UserUser(msg2);
+                oCN.BeginTran();
+                //鍒犻櫎宸茬粡鍏宠仈鐨勬暟鎹�
+                oCN.RunProc("Delete From Gy_UserByUserRelation  where HUserID='" + msg3.ToString() + "'");
+                foreach (Models.Gy_UserUser oItem in lsmain)
+                {
+                    //閲嶆柊鍐欏叆鍏宠仈鏁版嵁
+                    oCN.RunProc("insert into Gy_UserByUserRelation (HUserID2,HUserID,HBillType,HUseFlag) values ('" + oItem.HUserID2 + "','" + msg3.ToString() + "','" + "" + "','" + "" + "')");
+                }
+                oCN.Commit();
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+                //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
+                objJsonResult.data = 1;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+                objJsonResult.data = 1;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region  鏍规嵁鐢ㄦ埛缂栫爜鏌ユ壘宸插垎閰嶇墿鏂欏垪琛�
+        [Route("Xt_User/MaterPlaylist")]
+        [HttpGet]
+        public object MaterPlaylist(string HUserID)
+        {
+            try
+            {
+
+                ds = oCN.RunProcReturn("select HMaterID,鐗╂枡浠g爜 HMaterNumber,鐗╂枡鍚嶇О HMaterName from h_v_Gy_UserMaterList where HUserID='" + HUserID + "' ", "h_v_Gy_UserMaterList");
+                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
+
+        #region 鐢ㄦ埛鍏宠仈鐗╂枡淇濆瓨
+        [Route("Xt_User/SaveUserMater")]
+        [HttpPost]
+        public object SaveUserMater([FromBody] JObject msg)
+        {
+            var _value = msg["msg"].ToString();
+            string msg1 = _value.ToString();
+            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg2 = sArray[0].ToString();
+            string msg3 = sArray[1].ToString();
+
+            ListModels oListModels = new ListModels();
+            try
+            {
+                List<Models.Gy_UserMater> lsmain = new List<Models.Gy_UserMater>();
+                msg2 = msg2.Substring(1, msg2.Length - 2);
+                msg2 = msg2.Replace("\\", "");
+                msg2 = msg2.Replace("\n", "");  //\n
+                lsmain = oListModels.getObjectByJson_Gy_UserMater(msg2);
+                oCN.BeginTran();
+                //鍒犻櫎宸茬粡鍏宠仈鐨勬暟鎹�
+                oCN.RunProc("Delete From Gy_UserMaterRelation  where HUserID='" + msg3.ToString() + "'");
+                foreach (Models.Gy_UserMater oItem in lsmain)
+                {
+                    //閲嶆柊鍐欏叆鍏宠仈鏁版嵁
+                    oCN.RunProc("insert into Gy_UserMaterRelation (HMaterID,HUserID) values ('" + oItem.HMaterID + "','" + msg3.ToString() + "')");
+                }
+                oCN.Commit();
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+                //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
+                objJsonResult.data = 1;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+                objJsonResult.data = 1;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region  鏍规嵁鐢ㄦ埛缂栫爜鏌ユ壘宸插垎閰嶅鎴峰垪琛�
+        [Route("Xt_User/CustomerPlaylist")]
+        [HttpGet]
+        public object CustomerPlaylist(string HUserID)
+        {
+            try
+            {
+
+                ds = oCN.RunProcReturn("select HCusID,瀹㈡埛浠g爜 HCustomerNumber,瀹㈡埛鍚嶇О HCustomerName from h_v_Gy_UserCustomerList where HUserID='" + HUserID + "' ", "h_v_Gy_UserCustomerList");
+                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
+
+        #region 鐢ㄦ埛鍏宠仈鐗╂枡淇濆瓨
+        [Route("Xt_User/SaveUserCustomer")]
+        [HttpPost]
+        public object SaveUserCustomer([FromBody] JObject msg)
+        {
+            var _value = msg["msg"].ToString();
+            string msg1 = _value.ToString();
+            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg2 = sArray[0].ToString();
+            string msg3 = sArray[1].ToString();
+
+            ListModels oListModels = new ListModels();
+            try
+            {
+                List<Models.Gy_UserCustomer> lsmain = new List<Models.Gy_UserCustomer>();
+                msg2 = msg2.Substring(1, msg2.Length - 2);
+                msg2 = msg2.Replace("\\", "");
+                msg2 = msg2.Replace("\n", "");  //\n
+                lsmain = oListModels.getObjectByJson_Gy_UserCustomer(msg2);
+                oCN.BeginTran();
+                //鍒犻櫎宸茬粡鍏宠仈鐨勬暟鎹�
+                oCN.RunProc("Delete From Gy_UserCustomerRelation  where HUserID='" + msg3.ToString() + "'");
+                foreach (Models.Gy_UserCustomer oItem in lsmain)
+                {
+                    //閲嶆柊鍐欏叆鍏宠仈鏁版嵁
+                    oCN.RunProc("insert into Gy_UserCustomerRelation (HCusID,HUserID) values ('" + oItem.HCusID + "','" + msg3.ToString() + "')");
+                }
+                oCN.Commit();
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+                //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
+                objJsonResult.data = 1;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+                objJsonResult.data = 1;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
     }
 }
\ No newline at end of file
diff --git a/WebAPI/Controllers/CJGL/Cj_CallGoodsBillMainController.cs b/WebAPI/Controllers/CJGL/Cj_CallGoodsBillMainController.cs
index 86f7f43..1a1ca70 100644
--- a/WebAPI/Controllers/CJGL/Cj_CallGoodsBillMainController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_CallGoodsBillMainController.cs
@@ -31,7 +31,7 @@
                     return objJsonResult;
                 }
 
-                ds = oCN.RunProcReturn("select * from h_v_IF_JIT_CallGoodsBillList where 1=1 " + sWhere + " order by hmainid desc", "h_v_IF_JIT_CallGoodsBillList");
+                ds = oCN.RunProcReturn("select * from h_v_IF_JIT_CallGoodsBillList where 1=1 " + sWhere + " and 鍒跺崟浜�='"+user+"'  order by hmainid desc", "h_v_IF_JIT_CallGoodsBillList");
 
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
diff --git a/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs
index 4fce0da..c3752c1 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs
@@ -149,7 +149,7 @@
         {
             try
             {
-
+                List<object> columnNameList = new List<object>();
                 //寰楀埌淇℃伅
                 ds = oCN.RunProcReturn("exec h_p_Sc_ProcExchBilltransRelationQty " + HProcExchHinteID + "", "h_p_Sc_ProcExchBilltransRelationQty");
                 //鍐欏叆淇℃伅
@@ -161,10 +161,20 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
+
+                //娣诲姞鍒楀悕
+                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 = "0";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "Sucess锛�";
                 objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
                 return objJsonResult;
             }
             catch (Exception e)
@@ -233,7 +243,7 @@
                 double HMoney = list[0].HMoney;//閲戦
                 string HRemark = list[0].HRemark;//澶囨敞
                 double HTaxRate = list[0].HTaxRate;//绋庣巼
-                long HProcNo = list[0].HProcNo;//娴佹按鍙�
+                string HProcNo = list[0].HProcNo;//娴佹按鍙�
                 string HOrderProcNO = list[0].HOrderProcNO;//璁㈠崟璺熻釜鍙�
                 int HWWWorkOrderInterID = 0;//濮斿宸ュ崟鍙峰瓙鍐呯爜
                 int HWWWorkOrderEntryID = 0;//濮斿宸ュ崟鍙蜂富鍐呭悧
@@ -263,7 +273,7 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-                if (HProcNo <= 0)
+                if (HProcNo == "")
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
diff --git a/WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs
index 046411a..a661bf0 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs
@@ -144,7 +144,7 @@
                 double HMoney = list[0].HMoney;//閲戦
                 string HRemark = list[0].HRemark;//澶囨敞
                 double HTaxRate = list[0].HTaxRate;//绋庣巼
-                long HProcNo = list[0].HProcNo;//娴佹按鍙�
+                string HProcNo = list[0].HProcNo;//娴佹按鍙�
                 string HOrderProcNO = list[0].HOrderProcNO;//璁㈠崟璺熻釜鍙�
                 int HWWWorkOrderInterID = 0;//濮斿宸ュ崟鍙峰瓙鍐呯爜
                 int HWWWorkOrderEntryID = 0;//濮斿宸ュ崟鍙蜂富鍐呭悧
@@ -186,7 +186,7 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-                if (HProcNo <= 0)
+                if (HProcNo == "")
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
diff --git a/WebAPI/Controllers/CJGL/Cj_StationInBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationInBillController.cs
index 9820ef3..9656f57 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationInBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationInBillController.cs
@@ -72,8 +72,8 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-                long HProcNo = list[0].HProcNo;//娴佹按鍙�
-                if (HProcNo <= 0)
+                string HProcNo = list[0].HProcNo;//娴佹按鍙�
+                if (HProcNo == "")
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
diff --git a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
index dab03e3..c5f6cea 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
@@ -100,7 +100,7 @@
                 double HMoney = 0;
                 double HBadCount = list[0].HBadCount;//涓嶈壇鏁伴噺
                 long HCenterID = list[0].HCenterID;//宸ヤ綔涓績ID
-                long HProcNo = list[0].HProcNo;//娴佹按鍙�
+                string HProcNo = list[0].HProcNo;//娴佹按鍙�
                 string HOrderProcNO = list[0].HOrderProcNO;//璁㈠崟璺熻釜鍙�
                 string HSourceNameList = list[0].HSourceNameList;//璁惧娓呭崟
                 long HMainSourceInterID = list[0].HInterID;//閫掑叆type寰楀埌鐨勫崟鎹甀D
@@ -134,7 +134,7 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-                if (HProcNo <= 0)
+                if (HProcNo == "")
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
diff --git a/WebAPI/Controllers/SCGL/Sc_ComplementGoodBillController.cs b/WebAPI/Controllers/SCGL/Sc_ComplementGoodBillController.cs
index cb4170a..dad1384 100644
--- a/WebAPI/Controllers/SCGL/Sc_ComplementGoodBillController.cs
+++ b/WebAPI/Controllers/SCGL/Sc_ComplementGoodBillController.cs
@@ -105,6 +105,7 @@
             public long HSTOCKID = 0;//HSTOCKID
             public string 閫�鏂欏師鍥� { get; set; }//閫�鏂欏師鍥�
             public int HMaterialID = 0; //HMaterialIDCol
+            public string 鐗╂枡浠g爜 = ""; 
             public string HSourceBillNo { get; set; }//HSourceBillNoCol
             public int 璋冨嚭浠撳簱鍙敤搴撳瓨鏁伴噺 = 0;//HKFQtyKYCol
             public int 璋冨嚭浠撳簱搴撳瓨鏁伴噺 = 0;//HKFQtySCol
@@ -188,6 +189,33 @@
                 {
                     if (listCa[i].HMaterialID != 0 && listCa[i].鍙枡鏁伴噺 > 0)
                     {
+                        var Hqty = 0.0;
+                        var TuiHqty = 0.0;
+                        //褰撳墠鍗曟嵁宸插彨鏂� 鍜� 宸查��鏂欐暟閲�
+                        ds = oCN.RunProcReturn($@"
+                                               select isnull(a.HQty,0) 宸插彨鏂欐暟閲�,isnull(b.HQty,0) 宸查��鏂欑敵璇锋暟閲� from (
+                                                select sum(b.HQty) HQty,c.HNumber ,b.HSourceBillNo
+                                                from JIT_CallGoodsBillMain a
+                                                join JIT_CallGoodsBillSub b on a.HInterID=b.HInterID
+                                                left join Gy_Material c on b.HMaterID=c.HItemID
+                                                where b.HSourceBillNo='{listCa[i].HSourceBillNo}'
+                                                group by c.HNumber,b.HSourceBillNo
+                                                ) a
+                                                left join (
+                                                select sum(b.HQty) HQty,c.HNumber,b.HSourceBillNo
+                                                from JIT_CallGoodsBackRequestBillMain a
+                                                inner join JIT_CallGoodsBackRequestBillSub b on a.HInterID=b.HInterID
+                                                left join Gy_Material c on b.HMaterID=c.HItemID
+                                                where b.HSourceBillNo='{listCa[i].HSourceBillNo}'
+                                                group by c.HNumber,b.HSourceBillNo
+                                                ) b  on a.HNumber=b.HNumber and a.HSourceBillNo=b.HSourceBillNo where a.HNumber='{listCa[i].鐗╂枡浠g爜}'", "JIT_CallGoodsBillMain");
+
+                        if (ds.Tables[0].Rows.Count > 0)
+                        {
+                            Hqty = double.Parse(ds.Tables[0].Rows[0]["宸插彨鏂欐暟閲�"].ToString());
+                            TuiHqty = double.Parse(ds.Tables[0].Rows[0]["宸查��鏂欑敵璇锋暟閲�"].ToString());
+                        }
+
                         if (listCa[i].鍙枡鏁伴噺 > listCa[i].璁″垝鍙戞枡鏁伴噺)
                         {
                             objJsonResult.code = "0";
@@ -197,7 +225,20 @@
                             return objJsonResult;
                         }
 
-                        if (listCa[i].搴撳瓨鏁伴噺 == 0 && listCa[i].鍙枡鏁伴噺 > 0)
+                        if((listCa[i].鍙枡鏁伴噺 + Hqty - TuiHqty)> listCa[i].璁″垝鍙戞枡鏁伴噺)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍙枡鎬绘暟閲忓ぇ浜庤鍒掑彂鏂欐暟閲�!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+
+                        ds = oCN.RunProcReturn("select * from h_v_JIT_WarehouseList where 浠撳簱ID=" + listCa[i].璋冨嚭浠撳簱id + "  and  鐗╂枡缂栫爜 = '" + listCa[i].鐗╂枡浠g爜 + "' and 搴撳瓨缁勭粐=" + listCa[i].HOutOrgID, "h_v_JIT_WarehouseList");
+
+                        var HSCWHIDCount= double.Parse(ds.Tables[0].Rows[0]["璋冨嚭浠撳簱鍙敤搴撳瓨鏁伴噺"].ToString());
+
+                        if (HSCWHIDCount == 0 && listCa[i].鍙枡鏁伴噺 > 0)
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
@@ -206,7 +247,7 @@
                             return objJsonResult;
                         }
 
-                        if (listCa[i].鍙枡鏁伴噺 > listCa[i].搴撳瓨鏁伴噺)
+                        if (listCa[i].鍙枡鏁伴噺 > HSCWHIDCount)
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
@@ -241,15 +282,6 @@
                             objJsonResult.data = null;
                             return objJsonResult;
                         }
-
-                        //if (listCa[i].璋冨嚭浠撳簱鍙敤搴撳瓨鏁伴噺 == 0)
-                        //{
-                        //    objJsonResult.code = "0";
-                        //    objJsonResult.count = 0;
-                        //    objJsonResult.Message = "璋冨嚭浠撳簱鍙敤搴撳瓨鏁伴噺涓�0!";
-                        //    objJsonResult.data = null;
-                        //    return objJsonResult;
-                        //}
 
                         j = 1;
 
@@ -401,7 +433,7 @@
             string msg2 = sArray[0].ToString();
             DBUtility.ClsPub.CurUserName = sArray[1].ToString();
             string HOrgID = sArray[2].ToString();
-            bool flag = false;
+            json flag =new json();
 
             try
             {
@@ -425,47 +457,17 @@
                 {
                     if (listCa[i].閫�鏂欐暟閲� > 0)
                     {
-                        if (listCa[i].閫�鏂欐暟閲� > listCa[i].宸查厤閫佹暟閲�&& listCa[i].宸查厤閫佹暟閲�>0)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "閫�鏂欐暟閲忓ぇ浜庡凡閰嶉�佹暟閲�!";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-
-                        ds = oCN.RunProcReturn("select isnull(sum(d.HQty),0) HQty from JIT_CallGoodsBackRequestBillSub c inner join JIT_CallGoodsBackBillSub d on c.HInterID = d.HSourceInterID and c.HEntryID = d.HSourceEntryID and c.HMaterID = d.HMaterID " +
-                   $"where c.HSourceInterID={listCa[i].HSouceInterID} and c.HSourceEntryID ={listCa[i].HSourceEntryID} and c.HSourceBillNo = '{listCa[i].HSourceBillNo}' and c.HMaterID={listCa[i].HMaterialID}", "JIT_CallGoodsBackRequestBillSub");
-
-                        if ((double.Parse(ds.Tables[0].Rows[0][0].ToString()==""?"0": ds.Tables[0].Rows[0][0].ToString()) +listCa[i].閫�鏂欐暟閲�) > listCa[i].宸插彨鏂欐暟閲�)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = $"宸茬粡閫�鏂欐暟閲�:{double.Parse(ds.Tables[0].Rows[0][0].ToString())},鍙��鏂欐暟閲忎负:{(listCa[i].宸插彨鏂欐暟閲� - double.Parse(ds.Tables[0].Rows[0][0].ToString()))}!";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-
-                        if (listCa[i].璋冨叆浠撳簱id == 0)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "璇烽�夋嫨璋冨叆浠撳簱!";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-
-                        if (listCa[i].璋冨嚭浠撳簱id == 0)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "璇烽�夋嫨璋冨嚭浠撳簱!";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-
-                        flag = AddICStockTuiBill(listCa[i], "666601", "涓嶈壇鍝侀��鏂�", HOrgID, ref DBUtility.ClsPub.sExeReturnInfo);
+                        flag = (json)AddICStockTuiBill(listCa[i], "666601", "涓嶈壇鍝侀��鏂�", HOrgID);
                         j = 1;
+
+                        if (flag.code == "0")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = objJsonResult.Message;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
                     }
                 }
                 if (j == 0)
@@ -477,22 +479,11 @@
                     return objJsonResult;
                 }
 
-                if (flag)
-                {
-                    objJsonResult.code = "1";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "涓嶈壇鍝侀��鏂欐垚鍔�!";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-                else
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "涓嶈壇鍝侀��鏂欏け璐�!";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "涓嶈壇鍝侀��鏂欐垚鍔�!";
+                objJsonResult.data = null;
+                return objJsonResult;
             }
             catch (Exception e)
             {
@@ -505,10 +496,62 @@
         }
 
         //鏂板
-        public bool AddICStockTuiBill(CallGoodsBill listCa,string HBillType,string HBackType,string HOrgID, ref string sReturn)
+        public object AddICStockTuiBill(CallGoodsBill listCa,string HBillType,string HBackType,string HOrgID)
         {
             try
             {
+              
+
+                if (listCa.閫�鏂欐暟閲� > listCa.宸查厤閫佹暟閲� && listCa.宸查厤閫佹暟閲� > 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "閫�鏂欐暟閲忓ぇ浜庡凡閰嶉�佹暟閲�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (listCa.璋冨叆浠撳簱id == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "璇烽�夋嫨璋冨叆浠撳簱!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (listCa.璋冨嚭浠撳簱id == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "璇烽�夋嫨璋冨嚭浠撳簱!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                var THqty = 0.0;
+                ds = oCN.RunProcReturn($@"
+                                    select sum(b.HQty) HQty,c.HNumber,b.HSourceBillNo
+                                    from JIT_CallGoodsBackRequestBillMain a
+                                    inner join JIT_CallGoodsBackRequestBillSub b on a.HInterID=b.HInterID
+                                    left join Gy_Material c on b.HMaterID=c.HItemID
+                                    where c.HNumber='{listCa.鐗╂枡浠g爜}' and b.HSourceBillNo='{listCa.HSourceBillNo}'
+                                    group by c.HNumber,b.HSourceBillNo
+                                  ", "JIT_CallGoodsBackRequestBillMain");
+
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    THqty = double.Parse(ds.Tables[0].Rows[0]["HQty"].ToString());
+                }
+
+                if ((listCa.閫�鏂欐暟閲� + THqty) > listCa.宸查厤閫佹暟閲�)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "绱閫�鏂欐暟閲忓ぇ浜庡凡閰嶉�佹暟閲�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
                 Int64 lngBillKey = listCa.HSouceInterID == 0 ? 0 : listCa.HSouceInterID;
                 Int64 lngBillKeyEntry = listCa.HSourceEntryID == 0 ? 0 : listCa.HSourceEntryID;
                 double HQty = (double)(listCa.閫�鏂欐暟閲� == 0 ? 0 : listCa.閫�鏂欐暟閲�);
@@ -534,13 +577,17 @@
                        $" '{HBillType}','{DateTime.Now}','{HBillNo}',{HOrgID},'{ DBUtility.ClsPub.CurUserName}','{DateTime.Now}','','',0,0,0,''," +
                        $" 0, 0, {listCa.HOutOrgID}, {HOrgID}, 0,'{HBackType}')");
                  
-                sReturn = "鏂板鍗曟嵁鎴愬姛锛�";
                 oCN.Commit();
-                return true;
+
+                objJsonResult.code = "1";
+                objJsonResult.Message = "鏂板鍗曟嵁鎴愬姛锛�";
+                return objJsonResult;
             }
             catch (Exception e)
             {
-                sReturn = e.Message;
+                objJsonResult.code = "0";
+                objJsonResult.Message = e.Message; ;
+                return objJsonResult;
                 throw (e);
             }
         }
@@ -573,36 +620,23 @@
                 List<CallGoodsBill> listCa = new List<CallGoodsBill>();
                 //鑾峰彇琛ㄦ牸鏁版嵁闆嗗悎
                 listCa = JsonConvert.DeserializeObject<List<CallGoodsBill>>(msg2.ToString());
-                bool flag = false;
+                json flag = new json();
 
                 int j = 0;
                 for (int i = 0; i < listCa.Count; i++)
                 {
                     if (listCa[i].閫�鏂欐暟閲� > 0)
                     {
-                        if (listCa[i].閫�鏂欐暟閲� > listCa[i].宸查厤閫佹暟閲� && listCa[i].宸查厤閫佹暟閲� > 0)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "閫�鏂欐暟閲忓ぇ浜庡凡閰嶉�佹暟閲�!";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-
-                        ds = oCN.RunProcReturn("select sum(d.HQty) HQty from JIT_CallGoodsBackRequestBillSub c inner join JIT_CallGoodsBackBillSub d on c.HInterID = d.HSourceInterID and c.HEntryID = d.HSourceEntryID and c.HMaterID = d.HMaterID " +
-                   $"where c.HSourceInterID={listCa[i].HSouceInterID} and c.HSourceEntryID ={listCa[i].HSourceEntryID} and c.HSourceBillNo = '{listCa[i].HSourceBillNo}' and c.HMaterID={listCa[i].HMaterialID}", "JIT_CallGoodsBackRequestBillSub");
-
-                        if ((double.Parse(ds.Tables[0].Rows[0][0].ToString() == "" ? "0" : ds.Tables[0].Rows[0][0].ToString()) + listCa[i].閫�鏂欐暟閲�) > listCa[i].宸插彨鏂欐暟閲�)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = $"宸茬粡閫�鏂欐暟閲�:{double.Parse(ds.Tables[0].Rows[0][0].ToString())},鍙��鏂欐暟閲忎负:{(listCa[i].宸插彨鏂欐暟閲� - double.Parse(ds.Tables[0].Rows[0][0].ToString()))}!";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-
-                        flag = AddICStockTuiBill(listCa[i], "666602", " 浣欓噺閫�鏂�", HOrgID, ref DBUtility.ClsPub.sExeReturnInfo);
+                        flag =(json)AddICStockTuiBill(listCa[i], "666602", " 浣欓噺閫�鏂�", HOrgID);
                         j = 1;
+                        if (flag.code == "0")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = objJsonResult.Message;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
                     }
                 }
                 if (j == 0)
@@ -614,23 +648,11 @@
                     return objJsonResult;
                 }
 
-                if (flag)
-                {
-                    objJsonResult.code = "1";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "浣欓噺閫�鏂欐垚鍔�!";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-                else
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "浣欓噺閫�鏂欏け璐�!";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-             
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "浣欓噺閫�鏂欐垚鍔�!";
+                objJsonResult.data = null;
+                return objJsonResult;
             }
             catch (Exception e)
             {
@@ -671,35 +693,22 @@
                 //鑾峰彇琛ㄦ牸鏁版嵁闆嗗悎
                 listCa = JsonConvert.DeserializeObject<List<CallGoodsBill>>(msg2.ToString());
 
-                bool flag = false;
+                json flag = new json();
                 int j = 0;
                 for (int i = 0; i < listCa.Count; i++)
                 {
                     if (listCa[i].閫�鏂欐暟閲� > 0)
                     {
-                        if (listCa[i].閫�鏂欐暟閲� > listCa[i].宸查厤閫佹暟閲� && listCa[i].宸查厤閫佹暟閲� > 0)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "閫�鏂欐暟閲忓ぇ浜庡凡閰嶉�佹暟閲�!";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-
-                        ds = oCN.RunProcReturn("select sum(d.HQty) HQty from JIT_CallGoodsBackRequestBillSub c inner join JIT_CallGoodsBackBillSub d on c.HInterID = d.HSourceInterID and c.HEntryID = d.HSourceEntryID and c.HMaterID = d.HMaterID " +
-                   $"where c.HSourceInterID={listCa[i].HSouceInterID} and c.HSourceEntryID ={listCa[i].HSourceEntryID} and c.HSourceBillNo = '{listCa[i].HSourceBillNo}' and c.HMaterID={listCa[i].HMaterialID}", "JIT_CallGoodsBackRequestBillSub");
-
-                        if ((double.Parse(ds.Tables[0].Rows[0][0].ToString() == "" ? "0" : ds.Tables[0].Rows[0][0].ToString()) + listCa[i].閫�鏂欐暟閲�) > listCa[i].宸插彨鏂欐暟閲�)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = $"宸茬粡閫�鏂欐暟閲�:{double.Parse(ds.Tables[0].Rows[0][0].ToString())},鍙��鏂欐暟閲忎负:{(listCa[i].宸插彨鏂欐暟閲� - double.Parse(ds.Tables[0].Rows[0][0].ToString()))}!";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-
-                        flag = AddICStockTuiBill(listCa[i], "666603", "鎶ュ簾閫�鏂�", HOrgID, ref DBUtility.ClsPub.sExeReturnInfo);
+                        flag =(json) AddICStockTuiBill(listCa[i], "666603", "鎶ュ簾閫�鏂�", HOrgID);
                         j = 1;
+                        if (flag.code == "0")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = objJsonResult.Message;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
                     }
                 }
                 if (j == 0)
@@ -711,22 +720,11 @@
                     return objJsonResult;
                 }
 
-                if (flag)
-                {
-                    objJsonResult.code = "1";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "鎶ュ簾閫�鏂欐垚鍔�!";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-                else
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鎶ュ簾閫�鏂欏け璐�!";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鎶ュ簾閫�鏂欐垚鍔�!";
+                objJsonResult.data = null;
+                return objJsonResult;
             }
             catch (Exception e)
             {
@@ -946,5 +944,68 @@
         }
         #endregion
 
+        #region 鐢熶骇鍙枡骞冲彴  浠撳簱搴撳瓨鍒楄〃
+
+        [Route("Sc_ComplementGoodBill/GetWarehouseList_JIT")]
+        [HttpGet]
+        public object GetWarehouseList_JIT(string sWhere)
+        {
+            try
+            {
+                ds = oCN.RunProcReturn("select * from h_v_JIT_WarehouseList where 1=1 "+ sWhere, "h_v_JIT_WarehouseList"); 
+
+                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
+
+        #region 鐢熶骇鍙枡骞冲彴  鏈敓鎴愭嫞鏂欑敵璇峰崟  鏈敓鎴愰��鏂欏崟
+        [Route("Sc_ComplementGoodBill/NotGeneratedMaterialList")]
+        [HttpGet]
+        public object NotGeneratedMaterialList(string sWhere, string user)
+        {
+            try
+            {
+                //鏌ヨ鍙枡鍗� 鏈敓鎴� 鎷f枡鍗� 鐨勬潯鏁�
+                //鏌ヨ閫�鏂欑敵璇峰崟  鏈敓鎴� 閫�鏂欏崟鐨� 鏉℃暟
+                ds = oCN.RunProcReturn($@"select count(*) 鏈敓鎴�	from JIT_CallGoodsBackRequestBillMain as a
+                                        inner join JIT_CallGoodsBackRequestBillSub as b on a.HInterID=b.HInterID
+                                         where  a.HISCheck =0   and a.HOrgID={sWhere} 
+                                        and a.HMaker = '{user}'
+	                                        union all
+                                        select count(*) 鏈敓鎴�  from JIT_CallGoodsBillMain a
+                                        join JIT_CallGoodsBillSub b on a.HInterID=b.HInterID
+                                         where b.HPSQty=0  and a.HOrgID={sWhere} 
+                                        and a.HMaker = '{user}'", "JIT_CallGoodsBackRequestBillMain");
+
+                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
diff --git "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormBillController.cs" "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormBillController.cs"
index d2d7dee..563f79c 100644
--- "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormBillController.cs"
+++ "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormBillController.cs"
@@ -236,12 +236,22 @@
                         var HICMOBillNo = list[i]["鐢熶骇璁㈠崟鍙�"].ToString();
                         var HICMOEntrySEQ = list[i]["鐢熶骇璁㈠崟鏄庣粏琛屽彿"].ToString();
                         var HSourceID = list[i]["HSourceID"].ToString();
+                        var HYX = list[i]["浼樺厛绾�"].ToString();
 
                         if (HSourceID == "" || HSourceID == "0")
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
                             objJsonResult.Message = $"绗瑊i + 1}琛岀敓浜ц祫婧愪笉鑳戒负绌�!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        var str = 0;
+                        if (!int.TryParse(HYX, out str))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = $"绗瑊i + 1}琛屼紭鍏堢骇:{HYX},璇疯緭鍏ユ暟瀛�!";
                             objJsonResult.data = null;
                             return objJsonResult;
                         }
@@ -258,7 +268,7 @@
                             return objJsonResult;
                         }
 
-                        oCN.RunProc($"update Sc_WorkBillSortBillMain set HSourceID={(HSourceID == "" ? 0.ToString() : HSourceID)} where HInterID={list[i]["hmainid"].ToString()} and HBillNo='{list[i]["鍗曟嵁鍙�"].ToString()}'");
+                        oCN.RunProc($"update Sc_WorkBillSortBillMain set HSourceID={(HSourceID == "" ? 0.ToString() : HSourceID)},HYX={HYX} where HInterID={list[i]["hmainid"].ToString()} and HBillNo='{list[i]["鍗曟嵁鍙�"].ToString()}'");
                     }
 
                     oCN.RunProc($"update Sc_WorkBillSortBillMain set HDayPlanSumQty={list[i]["鏃ヨ鍒掓暟閲忔�婚噺"].ToString()} where HInterID={(HInterID==0?int.Parse(list[i]["hmainid"].ToString()):HInterID)} and HBillNo='{(HBillNo==""?list[i]["鍗曟嵁鍙�"].ToString(): HBillNo)}'");
@@ -514,6 +524,14 @@
             /// 浠撳簱缂栫爜
             /// </summary>
             public string FStockNumber { get; set; }
+            /// <summary>
+            /// 鎵瑰彿
+            /// </summary>
+            public string HLOT { get; set; }
+            /// <summary>
+            /// id
+            /// </summary>
+            public string HInventoryFID { get; set; }
         }
         #endregion
 
@@ -677,6 +695,9 @@
             public string FStock { get; set; }
             //杞﹂棿
             public string FWorkShop { get; set; }
+            //鎵瑰彿
+            public string HLOT { get; set; }
+            public string HInventoryFID { get; set; }
 
         }
         #endregion
@@ -736,10 +757,11 @@
 
                 //鑾峰彇褰撳墠鍗虫椂搴撳瓨 搴撳瓨鏁伴噺+搴撳瓨缁勭粐+鐗╂枡+璐т富+浠撳簱   
                 ds = oCN.RunProcReturn(@" 
-select distinct isnull(a.FBASEQTY,0) FBASEQTY,b.FNumber,a.FOwnerTypeId,a.FOwnerId,c.FNUMBER as FOwnerNumber,a.FSTOCKID,d.FNUMBER as FStockNumber from 
+select distinct isnull(a.FBASEQTY,0) FBASEQTY,b.FNumber,a.FOwnerTypeId,a.FOwnerId,c.FNUMBER as FOwnerNumber,a.FSTOCKID,d.FNUMBER as FStockNumber ,a.FLOT HLOT,a.FID HInventoryFID 
+from 
 (
-select distinct a.HProdORGID FStockOrgId,T2.FMATERIALID,FNumber from SC_WORKBILLSORTBILLMAIN a
-join SC_WORKBILLSORTBILLSub b on a.HInterID = b.HInterID
+select distinct a.HProdORGID FStockOrgId,T2.FMATERIALID,FNumber from Sc_WorkBillSortBillMain a
+join Sc_WorkBillSortBillSub b on a.HInterID = b.HInterID
 join AIS20210811135644..T_PRD_PPBOM T1 on a.HICMOInterID_Sec = t1.FMoId and a.HICMOEntryID_Sec = t1.FMOENTRYID
 LEFT JOIN  AIS20210811135644..T_PRD_PPBOMENTRY T2 on T1.FID = t2.FID
 join  AIS20210811135644..T_BD_MATERIAL T3 on T2.FMATERIALID = T3.FMATERIALID
@@ -954,7 +976,9 @@
                                             FComPlete = jskcQty >= need ? "榻愬" : "鏈綈濂�",
                                             FPlanDate = item.HMasterDate, // 鏃ヨ鍒掓棩鏈�
                                             FStock = Inventory.FSTOCKID,//浠撳簱
-                                            FWorkShop = _item.HWorkShopID //杞﹂棿
+                                            FWorkShop = _item.HWorkShopID, //杞﹂棿
+                                            HLOT = Inventory.HLOT, //鎵瑰彿
+                                            HInventoryFID = Inventory.HInventoryFID //id
                                         });
                                         //鎵e噺鎬诲簱瀛樻暟閲�
                                         jskcQty = jskcQty >= fCompleteCount ? jskcQty - fCompleteCount : 0;
@@ -1033,6 +1057,8 @@
                 insertDT.Columns.Add("FWORKSHOPID", typeof(long));
                 insertDT.Columns.Add("FSTOCKID", typeof(long));
                 insertDT.Columns.Add("FOCCUPYPICKEDCOUNT", typeof(decimal));
+                insertDT.Columns.Add("HLOT", typeof(long));
+                insertDT.Columns.Add("HInventoryFID", typeof(string));
                 int jdtmmm = 1;
                 ds = oCN.RunProcReturn("select max(HInterID)FID FROM  JIT_MOMaterReadysBill", "JIT_MOMaterReadysBill");
                 int maxFid = int.Parse(ds.Tables[0].Rows[0][0].ToString() == "" ? "0" : ds.Tables[0].Rows[0][0].ToString());
@@ -1065,6 +1091,8 @@
                     dr["FWORKSHOPID"] = item.FWorkShop == null ? "0" : item.FWorkShop;
                     dr["FSTOCKID"] = item.FStock == null ? "0" : item.FStock;
                     dr["FOCCUPYPICKEDCOUNT"] = item.FOccupyPickedCount;
+                    dr["HLOT"] = item.HLOT == null? "0" : item.HLOT;
+                    dr["HInventoryFID"] = item.HInventoryFID == null ? "0" : item.HInventoryFID;
                     insertDT.Rows.Add(dr);
                     jdtmmm++;
                 }
@@ -1080,12 +1108,14 @@
                             ", HICMOEntryID, HMaterID, HStockORGID, HStockQty, HLeftQty" +
                             ", HProdORGID, HUnitDosage, HSumPlanQty, HICMOBillNo, HOwnerID" +
                             ", HOwnerTypeID, HPlanDate, HComplete, HLackQty, HOccupyQty" +
-                            ", HCompleteQty1, HErpClsID, HWorkShopID, HWHID, HOccupyPickedQTY,HMainICMOBillNo)values" +
+                            ", HCompleteQty1, HErpClsID, HWorkShopID, HWHID, HOccupyPickedQTY,HMainICMOBillNo" +
+                            ",HLOT,HInventoryFID)values" +
                              $"({item["FID"].ToString()}, 1, {item["FHMAINICMOINTERIDR"].ToString()}, {item["FHMAINICMOENTRYID"].ToString()}, {item["FHICMOINTERID"].ToString()}" +
                              $", {item["FHICMOENTRYID"].ToString()}, {item["FHMATERID"].ToString()}, {item["FHSTOCKORGID"].ToString()}, {item["FHSTOCKQTY"].ToString()}, {item["FHLEFTQTY"].ToString()}" +
                              $" , {item["FHPRDORGID"].ToString()}, {item["FUNITDOSAGE"].ToString()}, {item["FSUMPLANCOUNT"].ToString()}, '{item["FPRDBILLNO"].ToString()}', {item["FOWNERID"].ToString()}" +
                              $", '{item["FOWNERTYPEID"].ToString()}', '{item["FPLANDATE"].ToString()}','{item["FCOMPLETE"].ToString()}', {item["FLACKCOUNT"].ToString()}, {item["FOCCUPYCOUNT"].ToString()}" +
-                             $", {item["FCOMPLETECOUNT1"].ToString()}, {item["FERPCLSID"].ToString()}, {item["FWORKSHOPID"].ToString()}, {item["FSTOCKID"].ToString()}, {item["FOCCUPYPICKEDCOUNT"].ToString()}, '{item["HMainICMOBillNo"].ToString()}')");
+                             $", {item["FCOMPLETECOUNT1"].ToString()}, {item["FERPCLSID"].ToString()}, {item["FWORKSHOPID"].ToString()}, {item["FSTOCKID"].ToString()}, {item["FOCCUPYPICKEDCOUNT"].ToString()}, '{item["HMainICMOBillNo"].ToString()}'" +
+                             $",{item["HLOT"].ToString()},'{item["HInventoryFID"].ToString()}')");
                 }
                 LogService.Write("鎵归噺鎻掑叆鍒版暟鎹簱鐢ㄦ椂锛�" + sw.Elapsed);
                 //鎵ц瀹屾垚鍚� 鏇存柊鏃ヨ鍒掑伐鍗曠姸鎬�
diff --git "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_ICMOSortBillController.cs" "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_ICMOSortBillController.cs"
index c1b29f4..7e0c476 100644
--- "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_ICMOSortBillController.cs"
+++ "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_ICMOSortBillController.cs"
@@ -78,5 +78,42 @@
             }
         }
         #endregion
+
+        #region 鐢熶骇鏃ヨ鍒� 杞﹂棿鎵ц纭  鎾ら攢杞﹂棿鎵ц纭
+        [Route("JIT_ICMOSortBill/JIT_ICMOSortBillWorkShopTure")]
+        [HttpGet]
+        public object JIT_ICMOSortBillWorkShopTure(string HSourceID, string HICMOInterID, DateTime HDate, int HStatus, string user)
+        {
+            try
+            {
+                ds = oCN.RunProcReturn($"select * from Sc_ICMOBillStatus_Tmp_Extend where HSourceID = {HSourceID} and HSourceInterID = {HICMOInterID} and HDate = '{HDate.ToString("yyyy-MM-dd HH:mm:ss.fff")}' ", "Sc_ICMOBillStatus_Tmp_Extend");
+
+                if (ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "浠撳簱鏈‘璁�,涓嶈兘杩涜杞﹂棿纭锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                oCN.RunProc("exec h_p_Sc_SetICMOStatus_ReadyStart " + HSourceID.ToString() + "," + HICMOInterID.ToString() + ",'" + HDate.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'," + HStatus.ToString() + ",'" + user + "'");
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鎵ц鎴愬姛锛�";
+                objJsonResult.data = null;
+                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
diff --git a/WebAPI/ListModels.cs b/WebAPI/ListModels.cs
index 96bdf0b..2733854 100644
--- a/WebAPI/ListModels.cs
+++ b/WebAPI/ListModels.cs
@@ -1794,6 +1794,42 @@
         }
 
         /// <summary>
+        /// 鐢ㄦ埛-鐢ㄦ埛鍏崇郴淇℃伅琛ㄧ殑json
+        /// </summary>
+        /// <param name="jsonString"></param>
+        /// <returns></returns>
+        public List<Models.Gy_UserUser> getObjectByJson_Gy_UserUser(string jsonString)
+        {
+            jsonString = "[" + jsonString.ToString() + "]";
+            List<Models.Gy_UserUser> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.Gy_UserUser>>(jsonString);
+            return list;
+        }
+
+        /// <summary>
+        /// 鐢ㄦ埛鐗╂枡鍏崇郴淇℃伅琛ㄧ殑json
+        /// </summary>
+        /// <param name="jsonString"></param>
+        /// <returns></returns>
+        public List<Models.Gy_UserMater> getObjectByJson_Gy_UserMater(string jsonString)
+        {
+            jsonString = "[" + jsonString.ToString() + "]";
+            List<Models.Gy_UserMater> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.Gy_UserMater>>(jsonString);
+            return list;
+        }
+
+        /// <summary>
+        /// 鐢ㄦ埛瀹㈡埛鍏崇郴淇℃伅琛ㄧ殑json
+        /// </summary>
+        /// <param name="jsonString"></param>
+        /// <returns></returns>
+        public List<Models.Gy_UserCustomer> getObjectByJson_Gy_UserCustomer(string jsonString)
+        {
+            jsonString = "[" + jsonString.ToString() + "]";
+            List<Models.Gy_UserCustomer> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.Gy_UserCustomer>>(jsonString);
+            return list;
+        }
+
+        /// <summary>
         /// 鐢ㄦ埛缁勭粐鍏崇郴淇℃伅琛ㄧ殑json
         /// </summary>
         /// <param name="jsonString"></param>
diff --git a/WebAPI/Models/Gy_UserCustomer.cs b/WebAPI/Models/Gy_UserCustomer.cs
new file mode 100644
index 0000000..a1abffa
--- /dev/null
+++ b/WebAPI/Models/Gy_UserCustomer.cs
@@ -0,0 +1,14 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace WebAPI.Models
+{
+    public class Gy_UserCustomer
+    {
+        public int HCusID { get; set; }
+        public string HCustomerNumber { get; set; }
+        public string HCustomerName { get; set; }
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/Models/Gy_UserMater.cs b/WebAPI/Models/Gy_UserMater.cs
new file mode 100644
index 0000000..0accfa1
--- /dev/null
+++ b/WebAPI/Models/Gy_UserMater.cs
@@ -0,0 +1,14 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace WebAPI.Models
+{
+    public class Gy_UserMater
+    {
+        public int HMaterID { get; set; }
+        public string HMaterNumber { get; set; }
+        public string HMaterName { get; set; }
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/Models/Gy_UserUser.cs b/WebAPI/Models/Gy_UserUser.cs
new file mode 100644
index 0000000..35daf64
--- /dev/null
+++ b/WebAPI/Models/Gy_UserUser.cs
@@ -0,0 +1,14 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace WebAPI.Models
+{
+    public class Gy_UserUser
+    {
+        public int HUserID2 { get; set; }
+        public string HUserNumber2 { get; set; }
+        public string HUserName2 { get; set; }
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/Models/StationBill.cs b/WebAPI/Models/StationBill.cs
index a42176b..79db468 100644
--- a/WebAPI/Models/StationBill.cs
+++ b/WebAPI/Models/StationBill.cs
@@ -33,7 +33,7 @@
         public double HMoney { get; set; }
         public string HRemark { get; set; }
         public double HTaxRate { get; set; }
-        public long HProcNo { get; set; }
+        public string HProcNo { get; set; }
         public string HOrderProcNO { get; set; }
         public long HWWWorkOrderInterID { get; set; }
         public long HWWWorkOrderEntryID { get; set; }
diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj
index 7652f0c..d6a79a9 100644
--- a/WebAPI/WebAPI.csproj
+++ b/WebAPI/WebAPI.csproj
@@ -560,6 +560,9 @@
     <Compile Include="Models\ClsSc_AssemblyBillMain.cs" />
     <Compile Include="Models\ClsSc_AssemblyBillSub.cs" />
     <Compile Include="Models\Employee.cs" />
+    <Compile Include="Models\Gy_UserCustomer.cs" />
+    <Compile Include="Models\Gy_UserMater.cs" />
+    <Compile Include="Models\Gy_UserUser.cs" />
     <Compile Include="Models\JIT_Cg_PODemandPlanBillMain.cs" />
     <Compile Include="Models\JIT_Cg_PODemandPlanBillSub.cs" />
     <Compile Include="Models\Cg_PODemandPlanConfigBillSub.cs" />

--
Gitblit v1.9.1