From 8481ea364c5a827f0c2cc73c7bf521b358d97ea6 Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期一, 17 六月 2024 14:30:45 +0800
Subject: [PATCH] 带出当前设备的点检规程

---
 DAL/销售管理/ClsXs_SeOrderBill.cs |  135 ++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 121 insertions(+), 14 deletions(-)

diff --git "a/DAL/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderBill.cs" "b/DAL/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderBill.cs"
index 5095ea9..1c0e78f 100644
--- "a/DAL/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderBill.cs"
+++ "b/DAL/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderBill.cs"
@@ -62,10 +62,25 @@
                 //",HInnerBillNo='" + omodel.HInnerBillNo + "'" +
                 //" where HInterID=" + lngBillKey.ToString());
 
+                //淇濆瓨鍓嶆帶鍒�=========================================
+                string HBillNote = "";
+                DataSet ds = oCn.RunProcReturn("Exec h_p_Xs_SeOrderBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',1 ", "h_p_Xs_SeOrderBill_BeforeSaveCtrl");
+                if (ds == null)
+                {
+                    sReturn = "淇濆瓨鍓嶅垽鏂け璐ワ紒";
+                    return false;
+                }
+                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
+                {
+                    sReturn = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                    return false;
+                }
+                //=========================================================
 
                 oCn.BeginTran();
                 string mainSql = "UpDate Xs_SeOrderBillMain set  " +
-                " HBillNo='" + omodel.HBillNo + "'" +  //鍥哄畾璧嬪��===============
+                " HBillSubType='" + omodel.HBillSubType + "'" +
+                ",HBillNo='" + omodel.HBillNo + "'" +  //鍥哄畾璧嬪��===============
                 ",HDate='" + omodel.HDate + "'" +
                 ",HYear='" + omodel.HYear.ToString() + "'" +
                 ",HPeriod='" + omodel.HPeriod.ToString() + "'" +
@@ -80,6 +95,7 @@
                 ",HEmpID=" + omodel.HEmpID.ToString() +
                 ",HCurID=" + omodel.HCurID.ToString() +
                 ",HExRate=" + omodel.HExRate.ToString() +
+                ",HEarnestRate=" + omodel.HEarnestRate.ToString() +
                 ",HManagerID=" + omodel.HManagerID.ToString() +
                 ",HSellSID=" + omodel.HSellSID.ToString() +
                 ",HSSID=" + omodel.HSSID.ToString() +
@@ -87,6 +103,8 @@
                 ",HPayCusID=" + omodel.HPayCusID +
                 ",HExplanation='" + omodel.HExplanation + "'" +
                 ",HLinkMan='" + omodel.HLinkMan + "'" +
+                ",HWHID='" + omodel.HWHID + "'" +
+                ",HProjectID='" + omodel.HProjectID + "'" +
                 ",HLinkPhone='" + omodel.HLinkPhone + "'" +
                 " where HInterID=" + lngBillKey.ToString();
 
@@ -114,8 +132,9 @@
                     //  ") ");
 
                     string subSql = "Insert into Xs_SeOrderBillSub" +
-                        "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney,HMaterID,HUnitID,HQty,HPrice,HTaxPrice,HMoney" +
-                        ",HDiscountRate,HRelTaxPrice,HTaxRate,HTaxMoney,HlineTotal,HlineTotalBB,HDate,HOutStockQty,HInvoiceQty,HRemark,HOrderLevID ) " +
+                        "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationQty_SellOutCheck,HRelationMoney_SellOutCheck,HRelationQty_ICMO,HRelationQty_SellBack,HRelationQty_SellBackCheck,HRelationMoney,HMaterID,HUnitID,HQty,HPrice,HTaxPrice,HMoney" +
+                        ",HDiscountRate,HRelTaxPrice,HTaxRate,HTaxMoney,HlineTotal,HlineTotalBB,HDate,HOutStockQty,HInvoiceQty,HRemark,HOrderLevID" +
+                        ",HCusMaterNumber,HCusModel,HCusMaterName,HisStockGoods,HWHID,HRemark_TL,HRemark_SJG) " +
                         "values(" +
                         "" + omodel.HInterID +
                         "," + oSub.HEntryID +
@@ -124,6 +143,11 @@
                         ",'" + (oSub.HSourceBillNo == null ? "" : oSub.HSourceBillNo) +
                         "','" + (oSub.HSourceBillType == null ? "" : oSub.HSourceBillType) +
                         "'," + oSub.HRelationQty +
+                        "," + oSub.HRelationQty_SellOutCheck +
+                        "," + oSub.HRelationMoney_SellOutCheck +
+                        "," + oSub.HRelationQty_ICMO +
+                        "," + oSub.HRelationQty_SellBack +
+                        "," + oSub.HRelationQty_SellBackCheck +
                         "," + oSub.HRelationMoney +
                         "," + oSub.HMaterID +
                         "," + oSub.HUnitID +
@@ -142,9 +166,33 @@
                         "," + oSub.HInvoiceQty + 
                         ",'" + oSub.HRemark +
                         "','" + oSub.HOrderLevID +
-                        "')";
+                        "','" + oSub.HCusMaterNumber +
+                        "','" + oSub.HCusModel +
+                        "','" + oSub.HCusMaterName +
+                        "'," + (oSub.HisStockGoods?1:0) +
+                         ",'" + oSub.HWhID + "'" +
+                         ",'" + oSub.HRemark_TL + "'" +
+                         ",'" + oSub.HRemark_SJG + "'" +
+                        ")";
                     oCn.RunProc(subSql);
                 }
+
+                //=========================淇濆瓨鍚庢帶鍒�  
+                DataSet ds2 = oCn.RunProcReturn("h_p_Xs_SeOrderBill_AfterSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "',1 ", "h_p_Xs_SeOrderBill_AfterSaveCtrl");
+                if (ds2 == null)
+                {
+                    sReturn = "淇濆瓨鍚庢帶鍒跺垽鏂け璐ワ紒";
+                    oCn.RollBack();
+                    return false;
+                }
+                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
+                {
+                    sReturn = "淇濆瓨澶辫触2锛�" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
+                    oCn.RollBack();
+                    return false;
+                }
+                //============================
+
                 //
                 //foreach (Model.ClsXs_SeOrderBillSub oSub in DetailColl)
                 //{
@@ -173,7 +221,20 @@
         {
             try
             {
-                DataSet ds;
+                //淇濆瓨鍓嶆帶鍒�=========================================
+                string HBillNote = "";
+                DataSet ds = oCn.RunProcReturn("Exec h_p_Xs_SeOrderBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',1 ", "h_p_Xs_SeOrderBill_BeforeSaveCtrl");
+                if (ds == null)
+                {
+                    sReturn = "淇濆瓨鍓嶅垽鏂け璐ワ紒";
+                    return false;
+                }
+                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
+                {
+                    sReturn = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                    return false;
+                }
+                //=========================================================
 
                 ////寰楀埌mainid
                 //omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
@@ -221,13 +282,13 @@
                 //鎻掑叆涓昏〃
                 string mainSql = "Insert Into Xs_SeOrderBillMain" +
                     "(HYear,HPeriod,HBillType,HBillSubType,HBillStatus,HExplanation" +
-                    ",HInterID,HBillNo,HDate,HInnerBillNo,HAddress,HDeptID,HCusID,HEmpID,HCurID,HExRate,HManagerID,HSellSID,HSSID,HSSDate,HPayCusID,HRemark,HOrgID,HMaker,HMakeDate,HLinkMan,HLinkPhone" +
-                    ",HERPInterID,HERPBillType,HSALEORGID,HSALEGROUPID,HRECEIVEID,HSETTLEID,HCHARGEID,HHEADLOCID,HRECCONTACTID,HCORRESPONDORGID,HBUSINESSTYPE) " +
+                    ",HInterID,HBillNo,HDate,HInnerBillNo,HAddress,HDeptID,HCusID,HEmpID,HCurID,HExRate,HEarnestRate,HManagerID,HSellSID,HSSID,HSSDate,HPayCusID,HRemark,HOrgID,HMaker,HMakeDate,HLinkMan,HLinkPhone" +
+                    ",HERPInterID,HERPBillType,HSALEORGID,HSALEGROUPID,HRECEIVEID,HSETTLEID,HCHARGEID,HHEADLOCID,HRECCONTACTID,HCORRESPONDORGID,HBUSINESSTYPE,HProjectID,HWHID) " +
                     "values(" +
                     "" + omodel.HYear +
                     "," + omodel.HPeriod +
                     ",'" + this.BillType +
-                    "','" + this.HBillSubType +
+                    "','" + omodel.HBillSubType +
                     "'," + omodel.HBillStatus +
                     ",'" + omodel.HExplanation +
 
@@ -241,6 +302,7 @@
                     "," + omodel.HEmpID +
                     "," + omodel.HCurID +
                     "," + omodel.HExRate +
+                    "," + omodel.HEarnestRate +
                     "," + omodel.HManagerID +
                     "," + omodel.HSellSID +
                     "," + omodel.HSSID +
@@ -249,9 +311,9 @@
                     ",'" + omodel.HRemark +
                     "'," + omodel.HOrgID +
                     ",'" + omodel.HMaker +
-                    "','" + omodel.HMakeDate +
+                    "',getdate()" +
 
-                    "','" + omodel.HLinkMan +
+                    ",'" + omodel.HLinkMan +
                     "','" + omodel.HLinkPhone +
 
                     "'," + omodel.HERPInterID +
@@ -265,6 +327,9 @@
                     "," + omodel.HRECCONTACTID +
                     "," + omodel.HCORRESPONDORGID +
                     ",'" + omodel.HBUSINESSTYPE +
+
+                    "','" + omodel.HProjectID +
+                    "','" + omodel.HWHID +
                     "')";
                     
                 oCn.RunProc(mainSql);
@@ -285,8 +350,9 @@
                     //  "," + oSub.HTaxPrice.ToString() + "," + oSub.HDiscountRate.ToString() + "," + oSub.HRelTaxPrice.ToString() + "," + oSub.HOutStockQty.ToString() + "," + oSub.HInvoiceQty.ToString() +
                     //  ") ");
                     string subSql = "Insert into Xs_SeOrderBillSub" +
-                        "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney,HMaterID,HUnitID,HQty,HPrice,HTaxPrice,HMoney" +
-                        ",HDiscountRate,HRelTaxPrice,HTaxRate,HTaxMoney,HlineTotal,HlineTotalBB,HDate,HOutStockQty,HInvoiceQty,HRemark,HOrderLevID) " +
+                        "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationQty_SellOutCheck,HRelationMoney_SellOutCheck,HRelationQty_ICMO,HRelationQty_SellBack,HRelationQty_SellBackCheck,HRelationMoney,HMaterID,HUnitID,HQty,HPrice,HTaxPrice,HMoney" +
+                        ",HDiscountRate,HRelTaxPrice,HTaxRate,HTaxMoney,HlineTotal,HlineTotalBB,HDate,HOutStockQty,HInvoiceQty,HRemark,HOrderLevID" +
+                        ",HCusMaterNumber,HCusModel,HCusMaterName,HisStockGoods,HWHID,HRemark_TL,HRemark_SJG) " +
                         "values(" +
                         "" + omodel.HInterID +
                         "," + oSub.HEntryID +
@@ -295,6 +361,11 @@
                         ",'" + (oSub.HSourceBillNo==null?"":oSub.HSourceBillNo) +
                         "','" + (oSub.HSourceBillType==null?"":oSub.HSourceBillType) +
                         "'," + oSub.HRelationQty +
+                        "," + oSub.HRelationQty_SellOutCheck +
+                        "," + oSub.HRelationMoney_SellOutCheck +
+                        "," + oSub.HRelationQty_ICMO +
+                        "," + oSub.HRelationQty_SellBack +
+                        "," + oSub.HRelationQty_SellBackCheck +
                         "," + oSub.HRelationMoney +
                         "," + oSub.HMaterID +
                         "," + oSub.HUnitID +
@@ -313,9 +384,34 @@
                         "," + oSub.HInvoiceQty +
                         ",'" + oSub.HRemark +
                         "','" + oSub.HOrderLevID +
-                        "')";
+                        "','" + oSub.HCusMaterNumber +
+                        "','" + oSub.HCusModel +
+                        "','" + oSub.HCusMaterName +
+                        "'," + (oSub.HisStockGoods?1:0) +
+                        ",'" + oSub.HWhID + "'" +
+                        ",'" + oSub.HRemark_TL + "'" +
+                        ",'" + oSub.HRemark_SJG + "'" +
+                        ")";
                     oCn.RunProc(subSql);
                 }
+
+                //=========================淇濆瓨鍚庢帶鍒�  
+                DataSet ds2 = oCn.RunProcReturn("h_p_Xs_SeOrderBill_AfterSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "',1 ", "h_p_Xs_SeOrderBill_AfterSaveCtrl");
+                if (ds2 == null)
+                {
+                    sReturn = "淇濆瓨鍚庢帶鍒跺垽鏂け璐ワ紒";
+                    oCn.RollBack();
+                    return false;
+                }
+                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
+                {
+                    sReturn = "淇濆瓨澶辫触2锛�" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
+                    oCn.RollBack();
+                    return false;
+                }
+                //============================
+
+
                 //
                 //foreach (Model.ClsXs_SeOrderBillSub oSub in DetailColl)
                 //{
@@ -388,6 +484,7 @@
                 omodel.HCusID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCusID"]);
                 omodel.HCurID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCurID"]);
                 omodel.HExRate = DBUtility.ClsPub.isSingle(Ds.Tables[0].Rows[0]["HExRate"]);
+                omodel.HEarnestRate = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HEarnestRate"]);
                 omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"]);
                 omodel.HManagerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HManagerID"]);
                 omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"]);
@@ -422,6 +519,12 @@
                     oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HEntryCloseDate"]);
                     oSub.HRemark = DsSub.Tables[0].Rows[i]["HRemark"].ToString().Trim();
                     //===================================================
+                    oSub.HRelationQty_SellOutCheck = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationQty_SellOutCheck"]);
+                    oSub.HRelationMoney_SellOutCheck = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationMoney_SellOutCheck"]);
+                    oSub.HRelationQty_ICMO = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationQty_ICMO"]);
+                    oSub.HRelationQty_SellBack = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationQty_SellBack"]);
+                    oSub.HRelationQty_SellBackCheck = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationQty_SellBackCheck"]);
+                    //===================================================
                     oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"]);
                     oSub.HUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HUnitID"]);
                     oSub.HQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQty"]);
@@ -437,7 +540,11 @@
                     oSub.HRelTaxPrice = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelTaxPrice"]);
                     oSub.HOutStockQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HOutStockQty"]);
                     oSub.HInvoiceQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HInvoiceQty"]);
-                    
+                    oSub.HisStockGoods = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HisStockGoods"]) == 1 ? true : false;
+
+                    oSub.HRemark_TL = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[0]["HRemark_TL"]);
+                    oSub.HRemark_SJG = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[0]["HRemark_SJG"]);
+
                     DetailColl.Add(oSub);
                 }
                 sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�";

--
Gitblit v1.9.1