From 477f5038d6969bb2a0918a2d0f74fc176a50d54d Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期四, 27 六月 2024 09:55:08 +0800
Subject: [PATCH] 称重入库:称重获取到的数据保留一位小数

---
 DAL/仓库管理/ClsKf_MoveStockBill.cs |  100 ++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 89 insertions(+), 11 deletions(-)

diff --git "a/DAL/\344\273\223\345\272\223\347\256\241\347\220\206/ClsKf_MoveStockBill.cs" "b/DAL/\344\273\223\345\272\223\347\256\241\347\220\206/ClsKf_MoveStockBill.cs"
index 6072206..9a4511d 100644
--- "a/DAL/\344\273\223\345\272\223\347\256\241\347\220\206/ClsKf_MoveStockBill.cs"
+++ "b/DAL/\344\273\223\345\272\223\347\256\241\347\220\206/ClsKf_MoveStockBill.cs"
@@ -37,6 +37,22 @@
         {
             try
             {
+
+                //淇濆瓨鍓嶆帶鍒�=========================================
+                string HBillNote = "";
+                DataSet ds = oCn.RunProcReturn("Exec h_p_Kf_MoveStockBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',1 ", "h_p_Kf_MoveStockBill_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();
                 //鏇存柊涓昏〃
@@ -65,30 +81,36 @@
                 ",HLinkPhone='" + omodel.HLinkPhone + "'" +
                 ",HExplanation='" + omodel.HExplanation + "'" +
                 ",HInnerBillNo='" + omodel.HInnerBillNo + "'" +
+                ",HInvoiceBillNo='" + omodel.HInvoiceBillNo + "'" +
+                ",HProjectID='" + omodel.HProjectID + "'" +
                 ",HRedBlueFlag=" + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) +
                 " where HInterID=" + lngBillKey.ToString());
                 //鍒犻櫎鍏宠仈
                 DeleteRelation(ref sReturn, lngBillKey);
+
+                //鐩存帴璋冩嫧鍗� 淇敼 鎾ら攢 鍥炲~ 璋冩嫧鐢宠鍗� 鍏宠仈鏁伴噺
+                oCn.RunProc("exec h_p_Kf_UpDateRelation_MoveStockRequestToPOStockIn_Del " + omodel.HInterID.ToString());
+
                 //鍒犻櫎瀛愯〃
                 DeleteBillSub(lngBillKey);
                 //鎻掑叆瀛愯〃
-                omodel.HInterID = lngBillKey;
+               // omodel.HInterID = lngBillKey;
                 foreach (Model.ClsKf_MoveStockBillSub oSub in DetailColl)
                 {
                     oCn.RunProc("Insert into Kf_ICStockBillSub " +
-                      " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
+                      " (HInterID,HEntryID,HCloseMan,HCloseType,HRemark" +
                       ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                       ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" +
                       ",HQty,HPrice,HMoney,HWHID,HSCWHID" +
-                      ",HSPID,HSCSPID,HBatchNo" +
+                      ",HSPID,HSCSPID,HBatchNo,HOutPrice,HOutMoney" +
                       ",HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo" +
                       ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" +
                       ") values("
-                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
+                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
                       "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                       "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQtyMust.ToString() +
                       "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() +
-                      "," + oSub.HSPID.ToString() + "," + oSub.HSCSPID.ToString() + ",'" + oSub.HBatchNo + "'" +
+                      "," + oSub.HSPID.ToString() + "," + oSub.HSCSPID.ToString() + ",'" + oSub.HBatchNo + "','" + oSub.HOutPrice + "','" + oSub.HOutMoney + "'" +
                       "," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'" +
                       "," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" +
                       ") ");
@@ -105,6 +127,26 @@
                 //        return false;
                 //    }
                 //}
+
+                //=========================淇濆瓨鍚庢帶鍒�  
+                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Kf_MoveStockBill_AfterSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "',1 ", "h_p_Kf_MoveStockBill_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;
+                }
+                //============================
+
+                //鐩存帴璋冩嫧鍗� 淇敼 鍥炲~ 璋冩嫧鐢宠鍗� 鍏宠仈鏁伴噺
+                oCn.RunProc("exec h_p_Kf_UpDateRelation_MoveStockRequestToPOStockIn_Add " + omodel.HInterID.ToString());
+
                 sReturn = "淇敼鍗曟嵁鎴愬姛锛�";
                 oCn.Commit();
                 return true;
@@ -133,6 +175,22 @@
                 {
                     omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                 }
+
+                //淇濆瓨鍓嶆帶鍒�=========================================
+                string HBillNote = "";
+                DataSet ds = oCn.RunProcReturn("Exec h_p_Kf_MoveStockBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',1 ", "h_p_Kf_MoveStockBill_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();
                 //涓昏〃
@@ -142,32 +200,32 @@
                 ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                 ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" +
                 ",HAddress,HLinkMan,HLinkPhone" +
-                ",HConveyCompID,HConveyTypeID,HConveyMoney" +
+                ",HConveyCompID,HConveyTypeID,HConveyMoney,HInvoiceBillNo,HProjectID" +
                 ") " +
                 " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" +
                 ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" +
                 ", " + omodel.HSupID.ToString() + "," + omodel.HWHID.ToString() + "," + omodel.HSCWHID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HSecManagerID.ToString() +
                 ", " + omodel.HKeeperID.ToString() + "," + omodel.HDeptID.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) +
                 ",'" + omodel.HAddress + "','" + omodel.HLinkMan + "','" + omodel.HLinkPhone + "'" +
-                "," + omodel.HConveyCompID.ToString() + "," + omodel.HConveyTypeID.ToString() + "," + omodel.HConveyMoney.ToString() +
+                "," + omodel.HConveyCompID.ToString() + "," + omodel.HConveyTypeID.ToString() + "," + omodel.HConveyMoney.ToString() + ",'" + omodel.HInvoiceBillNo + "'," + omodel.HProjectID.ToString() +
                 ") ");
                 //鎻掑叆瀛愯〃
                 foreach (Model.ClsKf_MoveStockBillSub oSub in DetailColl)
                 {
                     oCn.RunProc("Insert into Kf_ICStockBillSub " +
-                      " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
+                      " (HInterID,HEntryID,HCloseMan,HCloseType,HRemark" +
                       ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                       ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" +
                       ",HQty,HPrice,HMoney,HWHID,HSCWHID" +
-                      ",HSPID,HSCSPID,HBatchNo" +
+                      ",HSPID,HSCSPID,HBatchNo,HOutPrice,HOutMoney" +
                       ",HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo" +
                       ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" +
                       ") values("
-                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
+                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
                       "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                       "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQtyMust.ToString() +
                       "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() +
-                      "," + oSub.HSPID.ToString() + "," + oSub.HSCSPID.ToString() + ",'" + oSub.HBatchNo + "'" +
+                      "," + oSub.HSPID.ToString() + "," + oSub.HSCSPID.ToString() + ",'" + oSub.HBatchNo + "','" + oSub.HOutPrice + "','" + oSub.HOutMoney + "'" +
                       "," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'" +
                       "," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" +
                       ") ");
@@ -185,6 +243,26 @@
                 //    }
                 //}
                 //
+
+                //=========================淇濆瓨鍚庢帶鍒�  
+                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Kf_MoveStockBill_AfterSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "',1 ", "h_p_Kf_MoveStockBill_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;
+                }
+                //============================
+
+                //鐩存帴璋冩嫧鍗� 淇敼 鍥炲~ 璋冩嫧鐢宠鍗� 鍏宠仈鏁伴噺
+                oCn.RunProc("exec h_p_Kf_UpDateRelation_MoveStockRequestToPOStockIn_Add " + omodel.HInterID.ToString());
+
                 sReturn = "鏂板鍗曟嵁鎴愬姛锛�";
                 oCn.Commit();
                 return true;

--
Gitblit v1.9.1