From 58b8a83a4f30d44d1c17ef9b67b594b90f90281f Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期五, 19 一月 2024 17:27:58 +0800
Subject: [PATCH] 获取收料通知单,采购入库单的源单类型

---
 WebAPI/Controllers/XSGL/Xs_SeOrderChangeBillController.cs |   52 ++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 36 insertions(+), 16 deletions(-)

diff --git a/WebAPI/Controllers/XSGL/Xs_SeOrderChangeBillController.cs b/WebAPI/Controllers/XSGL/Xs_SeOrderChangeBillController.cs
index 2d87c4e..1d424a4 100644
--- a/WebAPI/Controllers/XSGL/Xs_SeOrderChangeBillController.cs
+++ b/WebAPI/Controllers/XSGL/Xs_SeOrderChangeBillController.cs
@@ -37,14 +37,14 @@
             {
                 List<object> columnNameList = new List<object>();
                 //鏌ョ湅鏉冮檺
-                //if (!DBUtility.ClsPub.Security_Log("Gy_ProjectStage_Query", 1, false, user))
-                //{
-                //    objJsonResult.code = "0";
-                //    objJsonResult.count = 0;
-                //    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
-                //    objJsonResult.data = null;
-                //    return objJsonResult;
-                //}
+                if (!DBUtility.ClsPub.Security_Log("Xs_SeOrderChangeBill_Query", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
 
                 if (sWhere == null || sWhere.Equals(""))
                 {
@@ -473,15 +473,28 @@
                     DateTime today = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));                   //褰撴棩鏃ユ湡
                     foreach (Model.ClsXs_SeOrderChangeBillSub oSub in oBill.DetailColl)
                     {
-                        //鍒ゆ柇鏂版暟閲忔槸鍚﹀皬浜庡崟鎹叧鑱旀暟閲�
-                        if(oSub.HQty_New < oSub.HRelationQty)                                             
+                        string sqlCheck = "select * from Xs_SeOrderBillSub where HInterID = " + oSub.HSourceInterID + " and HEntryID = " + oSub.HSourceEntryID;
+                        ds = oCN.RunProcReturn(sqlCheck, "Xs_SeOrderBillSub");
+                        if (ds.Tables[0].Rows.Count == 0)
                         {
-                            errorMessage += "绗�" + oSub.HEntryID + "琛岀墿鏂欐柊鏁伴噺灏忎簬鍗曟嵁琚叧鑱旀暟閲�!";
-                        } 
-                        //鍒ゆ柇鏂颁氦璐ф棩鏈熸槸鍚︽棭浜庡綋鏃�
-                        if ( oSub.HDate_New.CompareTo(today) < 0 ) 
+                            errorMessage += "绗�" + oSub.HEntryID + "琛岀墿鏂欏湪婧愬崟-閿�鍞鍗曚腑涓嶅瓨鍦�!";
+                        }
+                        else
                         {
-                            errorMessage +=  "绗�" + oSub.HEntryID + "琛屾柊浜よ揣鏃ユ湡鏃╀簬褰撴棩!";
+                            double HRelationQty = 0;
+                            //鑾峰彇閿�鍞鍗曞彉鏇村崟涓搴旂墿鏂欏湪婧愬崟-閿�鍞鍗曚腑鐨勫叧鑱旀暟閲�
+                            HRelationQty = double.Parse(ds.Tables[0].Rows[0]["HRelationQty"].ToString());
+
+                            //鍒ゆ柇鐗╂枡鏂版暟閲忔槸鍚﹀皬浜庢簮鍗曞崟鎹腑瀵瑰簲鐗╂枡鐨勫叧鑱旀暟閲�
+                            if (oSub.HQty_New < HRelationQty)
+                            {
+                                errorMessage += "绗�" + oSub.HEntryID + "琛岀墿鏂欐柊鏁伴噺灏忎簬婧愬崟-閿�鍞鍗曡鍏宠仈鏁伴噺!";
+                            }
+                            //鍒ゆ柇鏂颁氦璐ф棩鏈熸槸鍚︽棭浜庡綋鏃�
+                            if (oSub.HDate_New.CompareTo(today) < 0)
+                            {
+                                errorMessage += "绗�" + oSub.HEntryID + "琛屾柊浜よ揣鏃ユ湡鏃╀簬褰撴棩!";
+                            }
                         }
                     }
                     if(errorMessage != "")
@@ -505,6 +518,13 @@
                         objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:婧愬崟涓嶅瓨鍦�!";
                         objJsonResult.data = null;
                         return objJsonResult;
+                    }else if(ds.Tables[0].Rows[0]["HBillStatus"].ToString() != "2")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:婧愬崟鏈浜庡鏍哥姸鎬�!";
+                        objJsonResult.data = null;
+                        return objJsonResult;
                     }
 
                     oCN.BeginTran();
@@ -512,7 +532,7 @@
                     sql = "exec h_p_IF_SeOrderBill_ReWriteBySeOrderChangeBill " + oBill.omodel.HInterID;
                     oCN.RunProcReturn(sql, "h_p_IF_SeOrderBill_ReWriteBySeOrderChangeBill");
                     //淇$敤鎺у埗
-                    sql = "exec h_p_Kf_CheckSeOrderBill_CrediControl " + oBill.omodel.HMainSourceInterID;
+                    sql = "exec h_p_Kf_CheckSeOrderChangeBill_CrediControl " + oBill.omodel.HMainSourceInterID;
                     ds = oCN.RunProcReturn(sql, "h_p_Kf_CheckSeOrderBill_CrediControl");
                     if (ds.Tables[0].Rows[0]["HBack"].ToString() == "1")
                     {

--
Gitblit v1.9.1