From 1886cbfd84e0172f993e408a69ebc2c84e94be1d Mon Sep 17 00:00:00 2001
From: YL <YL@LAPTOP-SE03PLUR>
Date: 星期一, 08 十一月 2021 09:20:58 +0800
Subject: [PATCH] 公告列表修改保存

---
 WebAPI/DLL/ClsSc_ICMOBillWorkQtyStatus_Tmp.cs |  111 +++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 103 insertions(+), 8 deletions(-)

diff --git a/WebAPI/DLL/ClsSc_ICMOBillWorkQtyStatus_Tmp.cs b/WebAPI/DLL/ClsSc_ICMOBillWorkQtyStatus_Tmp.cs
index 4f84403..f368353 100644
--- a/WebAPI/DLL/ClsSc_ICMOBillWorkQtyStatus_Tmp.cs
+++ b/WebAPI/DLL/ClsSc_ICMOBillWorkQtyStatus_Tmp.cs
@@ -53,6 +53,10 @@
                 ",HRelationEntryID=" + omodel.HRelationEntryID.ToString() +
                 ",HRelationBillNo='" + omodel.HRelationBillNo + "'" +
                 ",HReportEntryID=" + omodel.HReportEntryID.ToString() +
+                ",HGroupID=" + omodel.HGroupID.ToString() +
+                ",HWorkManID=" + omodel.HWorkManID.ToString() +
+                ",HBadQty=" + omodel.HBadQty.ToString() +
+                ",HWasterQty=" + omodel.HWasterQty.ToString() +
                 " where HInterID=" + lngBillKey.ToString());
                 //删除关联
                 DeleteRelation(ref sReturn, lngBillKey);
@@ -94,13 +98,28 @@
                 "," + omodel.HSourceInterID.ToString() + "," + omodel.HSourceEntryID.ToString() + ",'" + omodel.HSourceBillNo + "','" + omodel.HSplitNO + "','" + omodel.HSourceBillType + "'" +
                 "," + omodel.HRelationInterID.ToString() + "," + omodel.HRelationEntryID.ToString() + ",'" + omodel.HRelationBillNo + "'," + omodel.HReportEntryID.ToString() + 
                 ") ");
+                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.RunProcReturn("exec h_p_JIT_MESICMOReport_Status " + omodel.HSourceID.ToString() + "," + omodel.HSourceInterID.ToString() + "," + omodel.HSourceEntryID.ToString() + ",'" + omodel.HSourceBillNo.ToString() + "','" + omodel.HPlanQty + "','" + omodel.HQty + "','" + omodel.HBadQty + "','" + omodel.HWasterQty + "'", "h_p_JIT_MESICMOReport_Status");
-                //更新生产状态临时状态表数量
-                oCn.RunProcReturn("exec h_p_Sc_UpDateRelation_ICMOToICMOReport_Qty " + omodel.HICMOInterID.ToString() + "," + omodel.HICMOEntryID.ToString() + "", "h_p_Sc_UpDateRelation_ICMOToICMOReport_Qty");
-                sReturn = "新增单据成功!"; 
-             
+                //再次验证 保存是否 合理
+                DataSet 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 = "无验证数据!";
+                    oCn.RollBack();
+                    return false;
+                }
+                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "2")
+                {
+                    sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                    oCn.RollBack();
+                    return false;
+                }
+
+
+                sReturn = omodel.HInterID.ToString();
+
                 oCn.Commit();
                 return true;
             }
@@ -144,8 +163,19 @@
                 omodel.HRelationEntryID = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HRelationEntryID"]);
                 omodel.HRelationBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRelationBillNo"]);
                 omodel.HReportEntryID = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HReportEntryID"]);
-                
-                 
+                omodel.HMaker = Ds.Tables[0].Rows[0]["HMaker"].ToString().Trim();
+                omodel.HMakeDate = Ds.Tables[0].Rows[0]["HMakeDate"].ToString().Trim();
+                omodel.HUpDateDate = Ds.Tables[0].Rows[0]["HUpDateDate"].ToString().Trim();
+                omodel.HUpDater = Ds.Tables[0].Rows[0]["HUpDater"].ToString().Trim();
+                omodel.HBackDate = Ds.Tables[0].Rows[0]["HBackDate"].ToString().Trim();
+                omodel.HBacker = Ds.Tables[0].Rows[0]["HBacker"].ToString().Trim();
+                omodel.HCheckDate = Ds.Tables[0].Rows[0]["HCheckDate"].ToString().Trim();
+                omodel.HChecker = Ds.Tables[0].Rows[0]["HChecker"].ToString().Trim();
+                omodel.HCloseDate = Ds.Tables[0].Rows[0]["HCloseDate"].ToString().Trim();
+                omodel.HCloseMan = Ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim();
+                omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim();
+                omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim();
+
                 sReturn = "显示单据成功!";
                 return true;
             }
@@ -157,6 +187,71 @@
         }
 
 
+        //审核
+        public bool CheckBill(int HSourceID, int HSourceInterID, int HSourceEntryID, string HSourceBillNo, int HICMOInterID, int HICMOEntryID, Int64 lngBillKey, ref string sReturn)
+        {
+
+            try
+            {
+                string HChecker = DBUtility.ClsPub.CurUserName;
+                string HCheckDate = DBUtility.ClsPub.GetServerDate(-1);
+                oCn.BeginTran();
+                oCn.RunProc(" Update " + MvarItemKey + " set HBillStatus='2',HChecker='" + HChecker + "',HCheckDate='" + HCheckDate + "' Where HInterID=" + lngBillKey.ToString());
+                //根据源单主内码 设置 生产状态表 完工状态(设置本单对应得源单 为完工状态)
+                //oCn.RunProc("exec h_p_JIT_MESICMOReport_Status " + HSourceID.ToString() + "," + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo.ToString() + "','" + HPlanQty + "'");
+                //更新生产状态临时状态表数量
+                //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()+ "");
+                sReturn = "审核单据成功!";
+                oCn.Commit();
+                //生成调拨单
+                //得到调拨单 mainid 单据号
+                //long NewInterID = DBUtility.ClsPub.CreateBillID("1207", ref DBUtility.ClsPub.sExeReturnInfo);
+                //string NewBillNo = DBUtility.ClsPub.CreateBillCode("1207", ref DBUtility.ClsPub.sExeReturnInfo, true);//得到新单号
+                //oCn.RunProc("exec h_p_Kf_MoveStockBill_Add " + lngBillKey.ToString() + "," + NewInterID.ToString() + ",'" + NewBillNo + "','" + HChecker + "'");
+                //
+                sReturn = "";
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                throw (e);
+            }
+        }
+
+        //反审核
+        public bool AbandonCheck(int HSourceID, int HSourceInterID, int HSourceEntryID, string HSourceBillNo, int HICMOInterID, int HICMOEntryID, Int64 lngBillKey, ref string sReturn)
+        {
+
+            try
+            {
+                string HChecker = DBUtility.ClsPub.CurUserName;
+                string HCheckDate = DBUtility.ClsPub.GetServerDate(-1);
+                oCn.BeginTran();
+                //还原单据状态为未审核状态
+                oCn.RunProc(" Update " + MvarItemKey + " set HBillStatus='1',HChecker='',HCheckDate='' Where HInterID=" + lngBillKey.ToString());
+                //扣减生产状态表本工单的拆分汇报数、当日完工数量、更新生产状态表 单据状态(汇报数量扣减小于)
+                oCn.RunProc("exec h_p_JIT_ICMOBillWorkQtyStatus_DelRelation " + HSourceID.ToString() + "," + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo.ToString() + "'," + HICMOInterID.ToString() + "," + HICMOEntryID.ToString() + ","+ lngBillKey + "");
+                sReturn = "审核单据成功!";
+                oCn.Commit();
+                //生成调拨单
+                //得到调拨单 mainid 单据号
+                //long NewInterID = DBUtility.ClsPub.CreateBillID("1207", ref DBUtility.ClsPub.sExeReturnInfo);
+                //string NewBillNo = DBUtility.ClsPub.CreateBillCode("1207", ref DBUtility.ClsPub.sExeReturnInfo, true);//得到新单号
+                //oCn.RunProc("exec h_p_Kf_MoveStockBill_Add " + lngBillKey.ToString() + "," + NewInterID.ToString() + ",'" + NewBillNo + "','" + HChecker + "'");
+                //
+                sReturn = "";
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                throw (e);
+            }
+        }
+
         //判断是否完工
         public bool IsEnded(long HInterID, ref string sReturn)
         {

--
Gitblit v1.9.1