From db054d938d008ea7f968eef47120b806bb476f98 Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期二, 18 十月 2022 14:25:57 +0800
Subject: [PATCH] 功能维护

---
 WebAPI/Controllers/SCGL/Sc_ComplementGoodBillController.cs         |  363 ++++++++++++++++++++++++++++++---------------------
 WebAPI/Controllers/SCGL/日计划管理/JIT_DayPlanPlatFormBillController.cs |   12 +
 WebAPI/Controllers/CJGL/Cj_CallGoodsBillMainController.cs          |    2 
 3 files changed, 224 insertions(+), 153 deletions(-)

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/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..5ab68bd 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)}'");

--
Gitblit v1.9.1