From f896cf78d10458574f50265c7d0ece09e15dc005 Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期五, 08 三月 2024 11:56:06 +0800
Subject: [PATCH] 销售出库单:取消手动审核、反审核反写销售订单数据

---
 WebAPI/DLL/ClsSc_ICMOBillWorkQtyStatus_Tmp.cs |   32 ++++++++++++++++++++++++++++----
 1 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/WebAPI/DLL/ClsSc_ICMOBillWorkQtyStatus_Tmp.cs b/WebAPI/DLL/ClsSc_ICMOBillWorkQtyStatus_Tmp.cs
index 18752d4..b288f48 100644
--- a/WebAPI/DLL/ClsSc_ICMOBillWorkQtyStatus_Tmp.cs
+++ b/WebAPI/DLL/ClsSc_ICMOBillWorkQtyStatus_Tmp.cs
@@ -81,8 +81,20 @@
                 omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                 //若MAINDI重复则重新获取
                 oCn.BeginTran();
-                //主表
+                DataSet ds;
 
+                //保存前控制=========================================
+                ds = oCn.RunProcReturn("exec h_p_Sc_ICMOBillWorkQtyStatus_BeforeSaveCtrl " + omodel.HInterID + "," + omodel.HSourceInterID + "," + omodel.HSourceEntryID + ",'" + omodel.HSourceBillNo + "'", "h_p_Sc_ICMOBillWorkQtyStatus_BeforeSaveCtrl");
+
+                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "1")
+                {
+                    sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                    oCn.RollBack();
+                    return false;
+                }
+                //=========================================================
+
+                //主表
                 oCn.RunProc("Insert Into Sc_ICMOBillWorkQtyStatus_Tmp   " +   
                "(HInterID,HBillType,HSourceID,HReportType,HPieceQty" +
                ",HMaterID,HGroupID,HWorkManID,HWorkReportDate,HDate" +
@@ -100,10 +112,10 @@
                 ") ");
                 double sumqty = omodel.HQty + omodel.HBadQty + omodel.HWasterQty;  //汇报数量+不良+报废
                 //回写生产状态临时表Sc_ICMOBillStatus_Tmp拆分汇报数量 HSplitRelationQty
-                oCn.RunProc("update Sc_ICMOBillStatus_Tmp set HSplitRelationQty=HSplitRelationQty+" + sumqty + "  where HICMOBillNo='" + omodel.HICMOBillNo + "'  and HSourceID='" + omodel.HSourceID + "' and  HICMOInterID='" + omodel.HICMOInterID + "' and HICMOEntryID='" + omodel.HICMOEntryID + "'");
+                oCn.RunProc("update Sc_ICMOBillStatus_Tmp set HSplitRelationQty=HSplitRelationQty+" + sumqty + "  where HICMOBillNo='" + omodel.HICMOBillNo + "'  and HSourceID='" + omodel.HSourceID + "' and  HICMOInterID='" + omodel.HICMOInterID + "' and HICMOEntryID='" + omodel.HICMOEntryID + "' and HInterID="+ omodel.HSourceInterID.ToString());
 
                 //再次验证 保存是否 合理
-                DataSet ds = oCn.RunProcReturn("exec h_p_JIT_ICMOBillWorkQtyStatus_SaveCtrl @HInterId=" + omodel.HInterID + "", "h_p_JIT_ICMOBillWorkQtyStatus_SaveCtrl");
+                ds = oCn.RunProcReturn("exec h_p_JIT_ICMOBillWorkQtyStatus_SaveCtrl @HInterId=" + omodel.HInterID + "", "h_p_JIT_ICMOBillWorkQtyStatus_SaveCtrl");
                 if (ds == null || ds.Tables[0].Rows.Count <= 0)
                 {
                     sReturn = "无验证数据!";
@@ -116,6 +128,18 @@
                     oCn.RollBack();
                     return false;
                 }
+
+                //保存后控制=========================================
+                ds = oCn.RunProcReturn("exec h_p_Sc_ICMOBillWorkQtyStatus_AfterSaveCtrl " + omodel.HInterID + "," + omodel.HSourceInterID + "," + omodel.HSourceEntryID + ",'" + omodel.HSourceBillNo + "'", "h_p_Sc_ICMOBillWorkQtyStatus_BeforeSaveCtrl");
+
+                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "1")
+                {
+                    sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                    oCn.RollBack();
+                    return false;
+                }
+                //=========================================================
+
                 sReturn = omodel.HInterID.ToString();
 
                 oCn.Commit();
@@ -200,7 +224,7 @@
                 //更新生产状态临时状态表数量
                 //oCn.RunProc("exec h_p_Sc_UpDateRelation_ICMOToICMOReport_Qty " + HICMOInterID.ToString() + "," + HICMOEntryID.ToString() + "");
                 //根据源单主内码 设置 生产状态表 完工状态(设置本单对应得源单 为完工状态) 更新生产状态临时状态表数量
-                oCn.RunProc("exec h_p_JIT_ICMOBillWorkQtyStatus_AddRelation " + HSourceID.ToString() + "," + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo.ToString() + "',"+ HICMOInterID.ToString() + ","+ HICMOEntryID.ToString()+ "");
+                oCn.RunProc("exec h_p_JIT_ICMOBillWorkQtyStatus_AddRelation " + HSourceID.ToString() + "," + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo.ToString() + "'," + HICMOInterID.ToString() + "," + HICMOEntryID.ToString() + "");
                 sReturn = "审核单据成功!";
                 oCn.Commit();
                 //生成调拨单

--
Gitblit v1.9.1