From 55e565721ef588d7ae9f421b6d1fce63b51aa55f Mon Sep 17 00:00:00 2001 From: wtt <1985833171@qq.com> Date: 星期四, 01 八月 2024 15:56:43 +0800 Subject: [PATCH] 物料流水号新增 --- WebAPI/DLL/ClsSc_ICMOBillWorkQtyStatus_Tmp.cs | 143 +++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 130 insertions(+), 13 deletions(-) diff --git a/WebAPI/DLL/ClsSc_ICMOBillWorkQtyStatus_Tmp.cs b/WebAPI/DLL/ClsSc_ICMOBillWorkQtyStatus_Tmp.cs index 9e52002..e5890f5 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); @@ -77,30 +81,67 @@ 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" + ",HBillSubType,HBillNo,HICMOInterID,HICMOEntryID,HICMOBillNo" + ",HQty,HBadQty,HWasterQty,HBarCode,HAddr,HMaker,HMakeDate" + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSplitNO,HSourceBillType" + - ",HRelationInterID,HRelationEntryID,HRelationBillNo,HReportEntryID" + - ") " + + ",HRelationInterID,HRelationEntryID,HRelationBillNo,HReportEntryID,HBillStatus" + + ",HICMOReportInterID) " + " values(" + omodel.HInterID.ToString() + ",'" + BillType + "'," + omodel.HSourceID.ToString() + "," + omodel.HReportType.ToString() + "," + omodel.HPieceQty.ToString() + "," + omodel.HMaterID.ToString() + ",'" + omodel.HGroupID + "','" + omodel.HWorkManID + "','" + omodel.HWorkReportDate + "','" + omodel.HDate + "'" + ",'" + omodel.HBillSubType.ToString() + "','" + omodel.HBillNo + "','" + omodel.HICMOInterID + "','" + omodel.HICMOEntryID + "','" + omodel.HICMOBillNo + "'" + "," + omodel.HQty.ToString() + "," + omodel.HBadQty.ToString() + "," + omodel.HWasterQty.ToString() + ",'" + omodel.HBarCode + "','" + omodel.HAddr + "','" + omodel.HMaker+ "','" + omodel.HMakeDate + "'" + "," + omodel.HSourceInterID.ToString() + "," + omodel.HSourceEntryID.ToString() + ",'" + omodel.HSourceBillNo + "','" + omodel.HSplitNO + "','" + omodel.HSourceBillType + "'" + - "," + omodel.HRelationInterID.ToString() + "," + omodel.HRelationEntryID.ToString() + ",'" + omodel.HRelationBillNo + "'," + omodel.HReportEntryID.ToString() + - ") "); + "," + omodel.HRelationInterID.ToString() + "," + omodel.HRelationEntryID.ToString() + ",'" + omodel.HRelationBillNo + "'," + omodel.HReportEntryID.ToString() + "," + omodel.HBillStatus.ToString() + + ",'"+ omodel.HSourceInterID.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 + "' and HInterID="+ omodel.HSourceInterID.ToString()); - //根据源单主内码 设置 生产状态表 完工状态(设置本单对应得源单 为完工状态) - oCn.RunProcReturn("exec h_p_JIT_MESICMOReport_Status " + omodel.HSourceID.ToString() + "," + omodel.HSourceInterID.ToString() + "," + omodel.HSourceEntryID.ToString() + ",'" + omodel.HSourceBillNo.ToString() + "','" + omodel.HPlanQty + "'", "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 = "新增单据成功!"; - + //再次验证 保存是否 合理 + 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; + } + + //保存后控制========================================= + 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(); return true; } @@ -144,8 +185,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 +209,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