From edbb3dfdc024641c81829b3ddb4af13dbcf9d9ba Mon Sep 17 00:00:00 2001 From: lan <lan@DESKTOP-MG88OFJ> Date: 星期四, 23 五月 2024 15:31:43 +0800 Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API --- DAL/生产管理/模具管理/ClsSc_MouldRepairOutBill.cs | 5 DAL/生产管理/模具管理/ClsSc_MouldOtherOutBill.cs | 262 ++++-- DAL/生产管理/模具管理/ClsSc_MouldOtherInBill.cs | 287 +++++-- DAL/生产管理/模具管理/ClsSc_MouldScrapOutBill.cs | 255 ++++-- DAL/生产管理/模具管理/ClsSc_MouldRepairInBill.cs | 260 ++++-- DAL/生产管理/模具管理/ClsSc_MouldScrapInBill.cs | 283 ++++--- WebAPI/Controllers/条码管理/MouldController.cs | 795 ++++++++++++++++++++++ 7 files changed, 1,666 insertions(+), 481 deletions(-) diff --git "a/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsSc_MouldOtherInBill.cs" "b/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsSc_MouldOtherInBill.cs" index b483b94..552a468 100644 --- "a/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsSc_MouldOtherInBill.cs" +++ "b/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsSc_MouldOtherInBill.cs" @@ -29,8 +29,63 @@ { DetailColl = null; } - + #endregion 鑷畾涔夋柟娉� + + //淇濆瓨鍓嶆帶鍒� + public bool BeforeSave(Int64 HInterID, string HBillNo, Int64 HSecManagerID, Int64 HKeeperID, Int64 HSupID, Int64 OperationType, ref string sReturn) + { + try + { + DataSet Ds = oCn.RunProcReturn("Exec h_p_Sc_MouldOtherInBill_BeforeSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + HSecManagerID.ToString() + "," + HKeeperID.ToString() + "," + HSupID.ToString() + "," + OperationType.ToString(), "h_p_Sc_MouldOtherInBill_BeforeSaveCtrl"); + if (Ds == null || Ds.Tables[0].Rows.Count == 0) + { + sReturn = "淇濆瓨鍓嶅垽鏂け璐ワ紒"; + return false; + } + else + { + if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBack"]) == 1) + { + sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]); + return false; + } + } + return true; + } + catch (Exception e) + { + throw (e); + } + } + + //淇濆瓨鍚庢帶鍒� + public bool AfterSave(Int64 HInterID, string HBillNo, Int64 OperationType, ref string sReturn) + { + try + { + DataSet Ds = oCn.RunProcReturn("Exec h_p_Sc_MouldOtherInBill_AfterSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Sc_MouldOtherInBill_AfterSaveCtrl"); + if (Ds == null || Ds.Tables[0].Rows.Count == 0) + { + sReturn = "淇濆瓨鍚庡垽鏂け璐ワ紒"; + return false; + } + else + { + if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBack"]) == 1) + { + sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]); + return false; + } + } + return true; + } + catch (Exception e) + { + throw (e); + } + } + //淇敼鍗曟嵁 public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) { @@ -38,6 +93,12 @@ { // oCn.BeginTran(); + //淇濆瓨鍓嶆帶鍒� + if (!BeforeSave(lngBillKey, omodel.HBillNo, omodel.HSecManagerID, omodel.HKeeperID, omodel.HSupID, 2, ref sReturn)) + { + oCn.RollBack(); + return false; + } //鏇存柊涓昏〃 oCn.RunProc("UpDate Sc_MouldStockBillMain set " + " HBillNo='" + omodel.HBillNo + "'" + //鍥哄畾璧嬪��=============== @@ -49,17 +110,17 @@ ",HUpDateDate=getdate()" + //======================================== ",HSupID=" + omodel.HSupID.ToString() + - ",HWHID=" + omodel.HWHID.ToString() + - ",HSCWHID=" + omodel.HSCWHID.ToString() + ",HEmpID=" + omodel.HEmpID.ToString() + ",HManagerID=" + omodel.HManagerID.ToString() + ",HSecManagerID=" + omodel.HSecManagerID.ToString() + ",HKeeperID=" + omodel.HKeeperID.ToString() + ",HDeptID=" + omodel.HDeptID.ToString() + - ",HExplanation='" + omodel.HExplanation + "'" + - ",HInnerBillNo='" + omodel.HInnerBillNo + "'" + + ",HWHID=" + omodel.HWHID.ToString() + + ",HSCWHID=" + omodel.HSCWHID.ToString() + + ",HExplanation='" + omodel.HExplanation + "'" + + ",HInnerBillNo='" + omodel.HInnerBillNo + "'" + ",HRedBlueFlag=" + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) + - + ",HStockOrgID=" + omodel.HSTOCKORGID.ToString() + " where HInterID=" + lngBillKey.ToString()); //鍒犻櫎鍏宠仈 DeleteRelation(ref sReturn, lngBillKey); @@ -70,28 +131,29 @@ foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl) { oCn.RunProc("Insert into Sc_MouldStockBillSub " + - " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + - ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + - ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" + - ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" + - ",HDesignLife,HLeaveLife,HUseLife,HUseLifeQty" + - ",HSCSPID,HSPGroupID,HBatchNo" + - ",HNewModel,HWallThickness,HHardness,HLastProdModel,HDiameter,HBackFlag" + - ",HQtyRel,HNewLifeQty,HNowModel,HNowLife" + - ",HMouldType,HInitModel,HInitDesignLife,HLifeUnitID" + - ") values(" - + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + 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.HDesignLife.ToString() + "," + oSub.HLeaveLife.ToString() + "," + oSub.HUseLife.ToString() + "," + oSub.HUseLifeQty.ToString() + - "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBatchNo + "'" + - //"," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'" + - //"," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" + - ",'" + oSub.HNewModel + "','" + oSub.HWallThickness + "','" + oSub.HHardness + "','" + oSub.HLastProdModel + "','" + oSub.HDiameter + "','" + oSub.HBackFlag + "'" + - "," + 0 + "," + oSub.HNewLifeQty.ToString() + ",'" + oSub.HNowModel + "'," + oSub.HNowLife.ToString() + - "," + oSub.HMouldType.ToString() + ",'" + oSub.HInitModel + "'," + oSub.HInitDesignLife.ToString() + "," + oSub.HLifeUnitID.ToString() + - ") "); + " (HInterID,HEntryID,HRemark,HRelationQty,HRelationMoney" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" + + ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HBatchNo" + + ",HQtyMust,HQtyRel,HQty,HPrice,HMoney,HDesignLife" + + ",HLeaveLife,HUseLife,HUseLifeQty,HNewLifeQty,HWHID,HSCWHID" + + ",HSPID,HSCSPID,HSPGroupID,HBarCode,HCorrespondentTypeID,HCorrespondentID" + + ",HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" + + ",HStockOrgID,HOWNERID,HOtherOrgID,HOWNERTYPEID" + + ",HNowModel,HNowLife,HNewModel,HLastProdModel,HWallThickness,HHardness" + + ",HDiameter,HMouldType,HInitModel,HInitDesignLife,HLifeUnitID,HBackFlag" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HRemark + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'" + + "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + ",'" + oSub.HBatchNo + "'" + + "," + oSub.HQtyMust.ToString() + "," + oSub.HQtyRel.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HDesignLife.ToString() + + "," + oSub.HLeaveLife.ToString() + "," + oSub.HUseLife.ToString() + "," + oSub.HUseLifeQty.ToString() + "," + oSub.HNewLifeQty.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() + + "," + oSub.HSPID.ToString() + "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBarCode + "'," + oSub.HCorrespondentTypeID.ToString() + "," + oSub.HCorrespondentID.ToString() + + "," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" + + "," + oSub.HStockOrgID.ToString() + "," + oSub.HOWNERID.ToString() + "," + oSub.HOtherOrgID.ToString() + ",'" + oSub.HOWNERTYPEID + "'" + + ",'" + oSub.HNowModel + "'," + oSub.HNowLife.ToString() + ",'" + oSub.HNewModel + "','" + oSub.HLastProdModel + "','" + oSub.HWallThickness + "','" + oSub.HHardness + "'" + + ",'" + oSub.HDiameter + "'," + oSub.HMouldType.ToString() + ",'" + oSub.HInitModel + "'," + oSub.HInitDesignLife.ToString() + "," + oSub.HLifeUnitID.ToString() + ",'" + oSub.HBackFlag + "'" + + ") "); + if (oSub.HBackFlag == "鎶ュ簾鍏ュ簱") { oCn.RunProc("exec h_p_Sc_MouldFileChangeStatus " + oSub.HMaterID.ToString() + ",'" + oSub.HNewModel.ToString() + "'," + oSub.HNewLifeQty.ToString() + ",'鎶ュ簾'"); @@ -101,19 +163,6 @@ oCn.RunProc("exec h_p_Sc_MouldFileChangeStatus " + oSub.HMaterID.ToString() + ",'" + oSub.HNewModel.ToString() + "'," + oSub.HNewLifeQty.ToString() + ",'鍦ㄥ簱'"); } } - // - //oCn.RunProcReturn("exec h_p_Sc_MouldFileChangeStatus " + omodel.HInterID.ToString() + ",'鍦ㄥ簱'", "gy_czygl"); - //foreach (Model.ClsSc_MouldOtherInBillSub oSub in DetailColl) - //{ - // Ds = oCn.RunProcReturn("exec h_p_Sc_MouldOtherInBill_Qty " + oSub.HICMOInterID, ""); - // if (Ds.Tables[0].Rows.Count == 0) - // return; - // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") - // { - // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; - // return false; - // } - //} DataSet Ds; foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl) { @@ -130,7 +179,13 @@ return false; } } - sReturn = "淇敼鍗曟嵁鎴愬姛锛�"; + //淇濆瓨鍚庢帶鍒� + if (!AfterSave(lngBillKey, omodel.HBillNo, 2, ref sReturn)) + { + oCn.RollBack(); + return false; + } + sReturn = "鍗曟嵁鍙凤細" + omodel.HBillNo + " 淇敼鎴愬姛锛�"; oCn.Commit(); return true; } @@ -146,91 +201,115 @@ { try { + //鑾峰彇绯荤粺鍙傛暟 + Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); + if (oSystemParameter.ShowBillByOrgID(omodel.HSTOCKORGID, ref sReturn) == false) + { + sReturn = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sReturn; + return false; + } //寰楀埌mainid - omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); - //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + if (omodel.HInterID == 0) + { + omodel.HInterID = DBUtility.ClsPub.CreateBillID_Prod(BillType, ref DBUtility.ClsPub.sExeReturnInfo); + } + //淇濆瓨鍓嶆帶鍒� + if (!BeforeSave(omodel.HInterID, omodel.HBillNo, omodel.HSecManagerID, omodel.HKeeperID, omodel.HSupID, 1, ref sReturn)) + { + return false; + } + oCn.BeginTran(); //涓昏〃 oCn.RunProc("Insert Into Sc_MouldStockBillMain " + "(HBillType,HBillSubType,HInterID,HBillNo,HDate" + ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + - ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" + - ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" + + ",HSupID,HSupTypeID,HEmpID,HManagerID,HSecManagerID" + + ",HKeeperID,HDeptID,HWHID,HSCWHID,HRedBlueFlag" + + ",HExplanation,HInnerBillNo,HStockOrgID" + ") " + - " values('" + this.BillType + "','" + this.HBillSubType + "'," +omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" + - ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HMaker + "',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) + - + " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate.ToShortDateString() + "'" + + ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" + + ", " + omodel.HSupID.ToString() + "," + omodel.HSupTypeID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HSecManagerID.ToString() + + ", " + omodel.HKeeperID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HWHID.ToString() + "," + omodel.HSCWHID.ToString() + "," + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) + + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + omodel.HSTOCKORGID.ToString() + ") "); //鎻掑叆瀛愯〃 foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl) { oCn.RunProc("Insert into Sc_MouldStockBillSub " + - " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + - ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + - ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" + - ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" + - ",HDesignLife,HLeaveLife,HUseLife,HUseLifeQty" + - ",HSCSPID,HSPGroupID,HBatchNo"+ - ",HNewModel,HWallThickness,HHardness,HLastProdModel,HDiameter,HBackFlag" + - ",HQtyRel,HNewLifeQty,HNowModel,HNowLife" + - ",HMouldType,HInitModel,HInitDesignLife,HLifeUnitID,HBarCode" + - ") values(" - + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + 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.HDesignLife.ToString() + "," + oSub.HLeaveLife.ToString() + "," + oSub.HUseLife.ToString() + "," + oSub.HUseLifeQty.ToString() + - "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBatchNo + "'"+ - //"," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'" + - //"," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" + - ",'" + oSub.HNewModel + "','" + oSub.HWallThickness + "','" + oSub.HHardness + "','" + oSub.HLastProdModel + "','" + oSub.HDiameter + "','" + oSub.HBackFlag + "'" + - "," + 0 + "," + oSub.HNewLifeQty.ToString() + ",'" + oSub.HNowModel + "'," + oSub.HNowLife.ToString() + - "," + oSub.HMouldType.ToString() + ",'" + oSub.HInitModel + "'," + oSub.HInitDesignLife.ToString() + "," + oSub.HLifeUnitID.ToString() + ",'" + oSub.HBarCode.ToString() + "'" + + " (HInterID,HEntryID,HRemark,HRelationQty,HRelationMoney" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" + + ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HBatchNo" + + ",HQtyMust,HQtyRel,HQty,HPrice,HMoney,HDesignLife" + + ",HLeaveLife,HUseLife,HUseLifeQty,HNewLifeQty,HWHID,HSCWHID" + + ",HSPID,HSCSPID,HSPGroupID,HBarCode,HCorrespondentTypeID,HCorrespondentID" + + ",HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" + + ",HStockOrgID,HOWNERID,HOtherOrgID,HOWNERTYPEID" + + ",HNowModel,HNowLife,HNewModel,HLastProdModel,HWallThickness,HHardness" + + ",HDiameter,HMouldType,HInitModel,HInitDesignLife,HLifeUnitID" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HRemark + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'" + + "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + ",'" + oSub.HBatchNo + "'" + + "," + oSub.HQtyMust.ToString() + "," + oSub.HQtyRel.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HDesignLife.ToString() + + "," + oSub.HLeaveLife.ToString() + "," + oSub.HUseLife.ToString() + "," + oSub.HUseLifeQty.ToString() + "," + oSub.HNewLifeQty.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() + + "," + oSub.HSPID.ToString() + "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBarCode + "'," + oSub.HCorrespondentTypeID.ToString() + "," + oSub.HCorrespondentID.ToString() + + "," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" + + "," + oSub.HStockOrgID.ToString() + "," + oSub.HOWNERID.ToString() + "," + oSub.HOtherOrgID.ToString() + ",'" + oSub.HOWNERTYPEID + "'" + + ",'" + oSub.HNowModel + "'," + oSub.HNowLife.ToString() + ",'" + oSub.HNewModel + "','" + oSub.HLastProdModel + "','" + oSub.HWallThickness + "','" + oSub.HHardness + "'" + + ",'" + oSub.HDiameter + "'," + oSub.HMouldType.ToString() + ",'" + oSub.HInitModel + "'," + oSub.HInitDesignLife.ToString() + "," + oSub.HLifeUnitID.ToString() + ") "); - - // - if (oSub.HBackFlag == "鎶ュ簾鍏ュ簱") + if (oSub.HBarCode == "") { - oCn.RunProc("exec h_p_Sc_MouldFileChangeStatus " + oSub.HMaterID.ToString() + ",'" + oSub.HNewModel.ToString() + "'," + oSub.HNewLifeQty.ToString() + ",'鎶ュ簾'"); - } - else - { - oCn.RunProc("exec h_p_Sc_MouldFileChangeStatus " + oSub.HMaterID.ToString() + ",'" + oSub.HNewModel.ToString() + "'," + oSub.HNewLifeQty.ToString() + ",'鍦ㄥ簱'"); + if (oSub.HBackFlag == "鎶ュ簾鍏ュ簱") + { + oCn.RunProc("exec h_p_Sc_MouldFileChangeStatus " + oSub.HMaterID.ToString() + ",'" + oSub.HNewModel.ToString() + "'," + oSub.HNewLifeQty.ToString() + ",'鎶ュ簾'"); + } + else + { + oCn.RunProc("exec h_p_Sc_MouldFileChangeStatus " + oSub.HMaterID.ToString() + ",'" + oSub.HNewModel.ToString() + "'," + oSub.HNewLifeQty.ToString() + ",'鍦ㄥ簱'"); + } } } - // - //foreach (Model.ClsSc_MouldOtherInBillSub oSub in DetailColl) - //{ - // Ds = oCn.RunProcReturn("exec h_p_Sc_MouldOtherInBill_Qty " + oSub.HICMOInterID, ""); - // if (Ds.Tables[0].Rows.Count == 0) - // return; - // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") - // { - // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; - // return false; - // } - //} - // + DataSet Ds; foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl) { - Ds = oCn.RunProcReturn("exec h_p_Kf_ICStockBill_CheckKF " + omodel.HInterID + "," + oSub.HMaterID + "," + oSub.HWHID + "," + oSub.HSPID + ", 1", "gy_czygl"); - if (Ds.Tables[0].Rows.Count == 0) + if (oSub.HBarCode == "") { - oCn.RollBack(); - return false; - } - if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][0]) == "N") - { - sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][1]) + ", 涓嶅厑璁镐繚瀛橈紒"; - oCn.RollBack(); - return false; + Ds = oCn.RunProcReturn("exec h_p_Kf_ICStockBill_CheckKF " + omodel.HInterID + "," + oSub.HMaterID + "," + oSub.HWHID + "," + oSub.HSPID + ", 1", "gy_czygl"); + if (Ds.Tables[0].Rows.Count == 0) + { + oCn.RollBack(); + return false; + } + if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][0]) == "N") + { + sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][1]) + ", 涓嶅厑璁镐繚瀛橈紒"; + oCn.RollBack(); + return false; + } } } - sReturn = "鏂板鍗曟嵁鎴愬姛锛�"; + //淇濆瓨鍚庢帶鍒� + if (!AfterSave(omodel.HInterID, omodel.HBillNo, 1, ref sReturn)) + { + oCn.RollBack(); + return false; + } + + if (oSystemParameter.omodel.Sc_MouldOtherInBill_AutoCheck.ToUpper() == "Y") //绯荤粺鍙傛暟 鑷姩瀹℃牳 + { + //瀹℃牳鍗曟嵁 + oCn.RunProc("Update Sc_MouldStockBillMain Set HChecker='" + DBUtility.ClsPub.CurUserName + "',HCheckDate=getdate(),HBillStatus=2 where HInterID= " + omodel.HInterID.ToString()); + sReturn = "鍗曟嵁鍙凤細" + omodel.HBillNo + " 鏂板瀹℃牳鎴愬姛锛�"; + } + else + { + sReturn = "鍗曟嵁鍙凤細" + omodel.HBillNo + " 鏂板鎴愬姛锛�"; + } oCn.Commit(); return true; } diff --git "a/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsSc_MouldOtherOutBill.cs" "b/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsSc_MouldOtherOutBill.cs" index d4fb5a0..cfa5c09 100644 --- "a/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsSc_MouldOtherOutBill.cs" +++ "b/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsSc_MouldOtherOutBill.cs" @@ -29,8 +29,63 @@ { DetailColl = null; } - + #endregion 鑷畾涔夋柟娉� + + //淇濆瓨鍓嶆帶鍒� + public bool BeforeSave(Int64 HInterID, string HBillNo, Int64 HSecManagerID, Int64 HKeeperID, Int64 HSupID, Int64 OperationType, ref string sReturn) + { + try + { + DataSet Ds = oCn.RunProcReturn("Exec h_p_Sc_MouldOtherOutBill_BeforeSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + HSecManagerID.ToString() + "," + HKeeperID.ToString() + "," + HSupID.ToString() + "," + OperationType.ToString(), "h_p_Sc_MouldOtherOutBill_BeforeSaveCtrl"); + if (Ds == null || Ds.Tables[0].Rows.Count == 0) + { + sReturn = "淇濆瓨鍓嶅垽鏂け璐ワ紒"; + return false; + } + else + { + if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBack"]) == 1) + { + sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]); + return false; + } + } + return true; + } + catch (Exception e) + { + throw (e); + } + } + + //淇濆瓨鍚庢帶鍒� + public bool AfterSave(Int64 HInterID, string HBillNo, Int64 OperationType, ref string sReturn) + { + try + { + DataSet Ds = oCn.RunProcReturn("Exec h_p_Sc_MouldOtherOutBill_AfterSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Sc_MouldOtherOutBill_AfterSaveCtrl"); + if (Ds == null || Ds.Tables[0].Rows.Count == 0) + { + sReturn = "淇濆瓨鍚庡垽鏂け璐ワ紒"; + return false; + } + else + { + if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBack"]) == 1) + { + sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]); + return false; + } + } + return true; + } + catch (Exception e) + { + throw (e); + } + } + //淇敼鍗曟嵁 public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) { @@ -38,6 +93,12 @@ { // oCn.BeginTran(); + //淇濆瓨鍓嶆帶鍒� + if (!BeforeSave(lngBillKey, omodel.HBillNo, omodel.HSecManagerID, omodel.HKeeperID, omodel.HSupID, 2, ref sReturn)) + { + oCn.RollBack(); + return false; + } //鏇存柊涓昏〃 oCn.RunProc("UpDate Sc_MouldStockBillMain set " + " HBillNo='" + omodel.HBillNo + "'" + //鍥哄畾璧嬪��=============== @@ -49,16 +110,17 @@ ",HUpDateDate=getdate()" + //======================================== ",HSupID=" + omodel.HSupID.ToString() + - ",HWHID=" + omodel.HWHID.ToString() + - ",HSCWHID=" + omodel.HSCWHID.ToString() + ",HEmpID=" + omodel.HEmpID.ToString() + ",HManagerID=" + omodel.HManagerID.ToString() + ",HSecManagerID=" + omodel.HSecManagerID.ToString() + ",HKeeperID=" + omodel.HKeeperID.ToString() + ",HDeptID=" + omodel.HDeptID.ToString() + + ",HWHID=" + omodel.HWHID.ToString() + + ",HSCWHID=" + omodel.HSCWHID.ToString() + ",HExplanation='" + omodel.HExplanation + "'" + - ",HInnerBillNo='" + omodel.HInnerBillNo + "'" + + ",HInnerBillNo='" + omodel.HInnerBillNo + "'" + ",HRedBlueFlag=" + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) + + ",HStockOrgID=" + omodel.HSTOCKORGID.ToString() + " where HInterID=" + lngBillKey.ToString()); //鍒犻櫎鍏宠仈 DeleteRelation(ref sReturn, lngBillKey); @@ -69,38 +131,31 @@ foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl) { oCn.RunProc("Insert into Sc_MouldStockBillSub " + - " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + - ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + - ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" + - ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" + - ",HDesignLife,HLeaveLife,HUseLife,HNowModel,HNowLife" + - ",HSCSPID,HSPGroupID,HBatchNo" + - ",HMouldType,HInitModel,HInitDesignLife,HLifeUnitID" + - ") values(" - + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + 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.HDesignLife.ToString() + "," + oSub.HLeaveLife.ToString() + "," + oSub.HUseLife.ToString() + ",'" + oSub.HNowModel + "'," + oSub.HNowLife.ToString() + - "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBatchNo + "'" + + " (HInterID,HEntryID,HRemark,HRelationQty,HRelationMoney" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" + + ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HBatchNo" + + ",HQtyMust,HQtyRel,HQty,HPrice,HMoney,HDesignLife" + + ",HLeaveLife,HUseLife,HUseLifeQty,HNewLifeQty,HWHID,HSCWHID" + + ",HSPID,HSCSPID,HSPGroupID,HBarCode,HCorrespondentTypeID,HCorrespondentID" + + ",HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" + + ",HStockOrgID,HOWNERID,HOtherOrgID,HOWNERTYPEID" + + ",HNowModel,HNowLife,HNewModel,HLastProdModel,HWallThickness,HHardness" + + ",HDiameter,HMouldType,HInitModel,HInitDesignLife,HLifeUnitID,HBackFlag" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HRemark + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'" + + "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + ",'" + oSub.HBatchNo + "'" + + "," + oSub.HQtyMust.ToString() + "," + oSub.HQtyRel.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HDesignLife.ToString() + + "," + oSub.HLeaveLife.ToString() + "," + oSub.HUseLife.ToString() + "," + oSub.HUseLifeQty.ToString() + "," + oSub.HNewLifeQty.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() + + "," + oSub.HSPID.ToString() + "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBarCode + "'," + oSub.HCorrespondentTypeID.ToString() + "," + oSub.HCorrespondentID.ToString() + + "," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" + + "," + oSub.HStockOrgID.ToString() + "," + oSub.HOWNERID.ToString() + "," + oSub.HOtherOrgID.ToString() + ",'" + oSub.HOWNERTYPEID + "'" + + ",'" + oSub.HNowModel + "'," + oSub.HNowLife.ToString() + ",'" + oSub.HNewModel + "','" + oSub.HLastProdModel + "','" + oSub.HWallThickness + "','" + oSub.HHardness + "'" + + ",'" + oSub.HDiameter + "'," + oSub.HMouldType.ToString() + ",'" + oSub.HInitModel + "'," + oSub.HInitDesignLife.ToString() + "," + oSub.HLifeUnitID.ToString() + ",'" + oSub.HBackFlag + "'" + + ") "); - "," + oSub.HMouldType.ToString() + ",'" + oSub.HInitModel + "'," + oSub.HInitDesignLife.ToString() + "," + oSub.HLifeUnitID.ToString() + - ") "); oCn.RunProc("exec h_p_Sc_MouldFileChangeStatus " + oSub.HMaterID.ToString() + ",'" + DBUtility.ClsPub.isStrNull(oSub.HNowModel) + "'," + oSub.HNowLife.ToString() + ",'鐢熶骇涓�'"); } - // - //oCn.RunProcReturn("exec h_p_Sc_MouldFileChangeStatus " + omodel.HInterID.ToString() + ",'鐢熶骇涓�'", "gy_czygl"); - //foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl) - //{ - // Ds = oCn.RunProcReturn("exec h_p_Sc_MouldOtherOutBill_Qty " + oSub.HICMOInterID, ""); - // if (Ds.Tables[0].Rows.Count == 0) - // return; - // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") - // { - // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; - // return false; - // } - //} DataSet Ds; foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl) { @@ -117,7 +172,13 @@ return false; } } - sReturn = "淇敼鍗曟嵁鎴愬姛锛�"; + //淇濆瓨鍚庢帶鍒� + if (!AfterSave(lngBillKey, omodel.HBillNo, 2, ref sReturn)) + { + oCn.RollBack(); + return false; + } + sReturn = "鍗曟嵁鍙凤細" + omodel.HBillNo + " 淇敼鎴愬姛锛�"; oCn.Commit(); return true; } @@ -133,77 +194,108 @@ { try { + //鑾峰彇绯荤粺鍙傛暟 + Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); + if (oSystemParameter.ShowBillByOrgID(omodel.HSTOCKORGID, ref sReturn) == false) + { + sReturn = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sReturn; + return false; + } //寰楀埌mainid - omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); - //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + if (omodel.HInterID == 0) + { + omodel.HInterID = DBUtility.ClsPub.CreateBillID_Prod(BillType, ref DBUtility.ClsPub.sExeReturnInfo); + } + //淇濆瓨鍓嶆帶鍒� + if (!BeforeSave(omodel.HInterID, omodel.HBillNo, omodel.HSecManagerID, omodel.HKeeperID, omodel.HSupID, 1, ref sReturn)) + { + return false; + } + oCn.BeginTran(); //涓昏〃 oCn.RunProc("Insert Into Sc_MouldStockBillMain " + "(HBillType,HBillSubType,HInterID,HBillNo,HDate" + ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + - ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" + - ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" + - ""+ + ",HSupID,HSupTypeID,HEmpID,HManagerID,HSecManagerID" + + ",HKeeperID,HDeptID,HWHID,HSCWHID,HRedBlueFlag" + + ",HExplanation,HInnerBillNo,HStockOrgID" + ") " + - " values('" + this.BillType + "','" + this.HBillSubType + "'," +omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" + - ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HMaker + "',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) + + " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate.ToShortDateString() + "'" + + ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" + + ", " + omodel.HSupID.ToString() + "," + omodel.HSupTypeID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HSecManagerID.ToString() + + ", " + omodel.HKeeperID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HWHID.ToString() + "," + omodel.HSCWHID.ToString() + "," + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) + + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + omodel.HSTOCKORGID.ToString() + ") "); //鎻掑叆瀛愯〃 foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl) { oCn.RunProc("Insert into Sc_MouldStockBillSub " + - " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + - ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + - ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" + - ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" + - ",HDesignLife,HLeaveLife,HUseLife,HNowModel,HNowLife" + - ",HSCSPID,HSPGroupID,HBatchNo" + - ",HMouldType,HInitModel,HInitDesignLife,HLifeUnitID,HBarCode" + - ") values(" - + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + 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.HDesignLife.ToString() + "," + oSub.HLeaveLife.ToString() + "," + oSub.HUseLife.ToString() + ",'" + oSub.HNowModel + "'," + oSub.HNowLife.ToString() + - "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBatchNo + "' " + + " (HInterID,HEntryID,HRemark,HRelationQty,HRelationMoney" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" + + ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HBatchNo" + + ",HQtyMust,HQtyRel,HQty,HPrice,HMoney,HDesignLife" + + ",HLeaveLife,HUseLife,HUseLifeQty,HNewLifeQty,HWHID,HSCWHID" + + ",HSPID,HSCSPID,HSPGroupID,HBarCode,HCorrespondentTypeID,HCorrespondentID" + + ",HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" + + ",HStockOrgID,HOWNERID,HOtherOrgID,HOWNERTYPEID" + + ",HNowModel,HNowLife,HNewModel,HLastProdModel,HWallThickness,HHardness" + + ",HDiameter,HMouldType,HInitModel,HInitDesignLife,HLifeUnitID" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HRemark + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'" + + "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + ",'" + oSub.HBatchNo + "'" + + "," + oSub.HQtyMust.ToString() + "," + oSub.HQtyRel.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HDesignLife.ToString() + + "," + oSub.HLeaveLife.ToString() + "," + oSub.HUseLife.ToString() + "," + oSub.HUseLifeQty.ToString() + "," + oSub.HNewLifeQty.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() + + "," + oSub.HSPID.ToString() + "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBarCode + "'," + oSub.HCorrespondentTypeID.ToString() + "," + oSub.HCorrespondentID.ToString() + + "," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" + + "," + oSub.HStockOrgID.ToString() + "," + oSub.HOWNERID.ToString() + "," + oSub.HOtherOrgID.ToString() + ",'" + oSub.HOWNERTYPEID + "'" + + ",'" + oSub.HNowModel + "'," + oSub.HNowLife.ToString() + ",'" + oSub.HNewModel + "','" + oSub.HLastProdModel + "','" + oSub.HWallThickness + "','" + oSub.HHardness + "'" + + ",'" + oSub.HDiameter + "'," + oSub.HMouldType.ToString() + ",'" + oSub.HInitModel + "'," + oSub.HInitDesignLife.ToString() + "," + oSub.HLifeUnitID.ToString() + + ") "); - "," + oSub.HMouldType.ToString() + ",'" + oSub.HInitModel + "'," + oSub.HInitDesignLife.ToString() + "," + oSub.HLifeUnitID.ToString() + ",'" + oSub.HBarCode.ToString() + "'" + - ") "); - - oCn.RunProc("exec h_p_Sc_MouldFileChangeStatus " + oSub.HMaterID.ToString() + ",'" + DBUtility.ClsPub.isStrNull(oSub.HNowModel) + "'," + oSub.HNowLife.ToString() + ",'鐢熶骇涓�'"); + if (oSub.HBarCode == "") + { + oCn.RunProc("exec h_p_Sc_MouldFileChangeStatus " + oSub.HMaterID.ToString() + ",'" + DBUtility.ClsPub.isStrNull(oSub.HNowModel) + "'," + oSub.HNowLife.ToString() + ",'鐢熶骇涓�'"); + } } - // - //foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl) - //{ - // Ds = oCn.RunProcReturn("exec h_p_Sc_MouldOtherOutBill_Qty " + oSub.HICMOInterID, ""); - // if (Ds.Tables[0].Rows.Count == 0) - // return; - // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") - // { - // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; - // return false; - // } - //} + DataSet Ds; foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl) { - Ds = oCn.RunProcReturn("exec h_p_Kf_ICStockBill_CheckKF " + omodel.HInterID + "," + oSub.HMaterID + "," + oSub.HWHID + "," + oSub.HSPID + ", -1", "gy_czygl"); - if (Ds.Tables[0].Rows.Count == 0) + if (oSub.HBarCode == "") { - oCn.RollBack(); - return false; - } - if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][0]) == "N") - { - sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][1]) + ", 涓嶅厑璁镐繚瀛橈紒"; - oCn.RollBack(); - return false; + Ds = oCn.RunProcReturn("exec h_p_Kf_ICStockBill_CheckKF " + omodel.HInterID + "," + oSub.HMaterID + "," + oSub.HWHID + "," + oSub.HSPID + ", -1", "gy_czygl"); + if (Ds.Tables[0].Rows.Count == 0) + { + oCn.RollBack(); + return false; + } + if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][0]) == "N") + { + sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][1]) + ", 涓嶅厑璁镐繚瀛橈紒"; + oCn.RollBack(); + return false; + } } } - // - sReturn = "鏂板鍗曟嵁鎴愬姛锛�"; + //淇濆瓨鍚庢帶鍒� + if (!AfterSave(omodel.HInterID, omodel.HBillNo, 1, ref sReturn)) + { + oCn.RollBack(); + return false; + } + + if (oSystemParameter.omodel.Sc_MouldOtherOutBill_AutoCheck.ToUpper() == "Y") //绯荤粺鍙傛暟 鑷姩瀹℃牳 + { + //瀹℃牳鍗曟嵁 + oCn.RunProc("Update Sc_MouldStockBillMain Set HChecker='" + DBUtility.ClsPub.CurUserName + "',HCheckDate=getdate(),HBillStatus=2 where HInterID= " + omodel.HInterID.ToString()); + sReturn = "鍗曟嵁鍙凤細" + omodel.HBillNo + " 鏂板瀹℃牳鎴愬姛锛�"; + } + else + { + sReturn = "鍗曟嵁鍙凤細" + omodel.HBillNo + " 鏂板鎴愬姛锛�"; + } oCn.Commit(); return true; } diff --git "a/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsSc_MouldRepairInBill.cs" "b/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsSc_MouldRepairInBill.cs" index 858a7bd..47bf27f 100644 --- "a/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsSc_MouldRepairInBill.cs" +++ "b/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsSc_MouldRepairInBill.cs" @@ -29,8 +29,63 @@ { DetailColl = null; } - + #endregion 鑷畾涔夋柟娉� + + //淇濆瓨鍓嶆帶鍒� + public bool BeforeSave(Int64 HInterID, string HBillNo, Int64 HSecManagerID, Int64 HKeeperID, Int64 HSupID, Int64 OperationType, ref string sReturn) + { + try + { + DataSet Ds = oCn.RunProcReturn("Exec h_p_Sc_MouldRepairInBill_BeforeSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + HSecManagerID.ToString() + "," + HKeeperID.ToString() + "," + HSupID.ToString() + "," + OperationType.ToString(), "h_p_Sc_MouldRepairInBill_BeforeSaveCtrl"); + if (Ds == null || Ds.Tables[0].Rows.Count == 0) + { + sReturn = "淇濆瓨鍓嶅垽鏂け璐ワ紒"; + return false; + } + else + { + if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBack"]) == 1) + { + sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]); + return false; + } + } + return true; + } + catch (Exception e) + { + throw (e); + } + } + + //淇濆瓨鍚庢帶鍒� + public bool AfterSave(Int64 HInterID, string HBillNo, Int64 OperationType, ref string sReturn) + { + try + { + DataSet Ds = oCn.RunProcReturn("Exec h_p_Sc_MouldRepairInBill_AfterSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Sc_MouldRepairInBill_AfterSaveCtrl"); + if (Ds == null || Ds.Tables[0].Rows.Count == 0) + { + sReturn = "淇濆瓨鍚庡垽鏂け璐ワ紒"; + return false; + } + else + { + if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBack"]) == 1) + { + sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]); + return false; + } + } + return true; + } + catch (Exception e) + { + throw (e); + } + } + //淇敼鍗曟嵁 public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) { @@ -38,6 +93,12 @@ { // oCn.BeginTran(); + //淇濆瓨鍓嶆帶鍒� + if (!BeforeSave(lngBillKey, omodel.HBillNo, omodel.HSecManagerID, omodel.HKeeperID, omodel.HSupID, 2, ref sReturn)) + { + oCn.RollBack(); + return false; + } //鏇存柊涓昏〃 oCn.RunProc("UpDate Sc_MouldStockBillMain set " + " HBillNo='" + omodel.HBillNo + "'" + //鍥哄畾璧嬪��=============== @@ -49,16 +110,17 @@ ",HUpDateDate=getdate()" + //======================================== ",HSupID=" + omodel.HSupID.ToString() + - ",HWHID=" + omodel.HWHID.ToString() + - ",HSCWHID=" + omodel.HSCWHID.ToString() + ",HEmpID=" + omodel.HEmpID.ToString() + ",HManagerID=" + omodel.HManagerID.ToString() + ",HSecManagerID=" + omodel.HSecManagerID.ToString() + ",HKeeperID=" + omodel.HKeeperID.ToString() + ",HDeptID=" + omodel.HDeptID.ToString() + + ",HWHID=" + omodel.HWHID.ToString() + + ",HSCWHID=" + omodel.HSCWHID.ToString() + ",HExplanation='" + omodel.HExplanation + "'" + - ",HInnerBillNo='" + omodel.HInnerBillNo + "'" + + ",HInnerBillNo='" + omodel.HInnerBillNo + "'" + ",HRedBlueFlag=" + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) + + ",HStockOrgID=" + omodel.HSTOCKORGID.ToString() + " where HInterID=" + lngBillKey.ToString()); //鍒犻櫎鍏宠仈 DeleteRelation(ref sReturn, lngBillKey); @@ -69,39 +131,31 @@ foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl) { oCn.RunProc("Insert into Sc_MouldStockBillSub " + - " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + - ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + - ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" + - ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" + - ",HDesignLife,HLeaveLife,HUseLife,HNewLifeQty" + - ",HSCSPID,HSPGroupID,HBatchNo,HBackFlag,HNowModel,HNowLife" + - ",HNewModel,HLastProdModel,HWallThickness,HHardness,HDiameter,HQtyRel" + - ",HMouldType,HInitModel,HInitDesignLife,HLifeUnitID" + + " (HInterID,HEntryID,HRemark,HRelationQty,HRelationMoney" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" + + ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HBatchNo" + + ",HQtyMust,HQtyRel,HQty,HPrice,HMoney,HDesignLife" + + ",HLeaveLife,HUseLife,HUseLifeQty,HNewLifeQty,HWHID,HSCWHID" + + ",HSPID,HSCSPID,HSPGroupID,HBarCode,HCorrespondentTypeID,HCorrespondentID" + + ",HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" + + ",HStockOrgID,HOWNERID,HOtherOrgID,HOWNERTYPEID" + + ",HNowModel,HNowLife,HNewModel,HLastProdModel,HWallThickness,HHardness" + + ",HDiameter,HMouldType,HInitModel,HInitDesignLife,HLifeUnitID,HBackFlag" + ") values(" - + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + 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.HDesignLife.ToString() + "," + oSub.HLeaveLife.ToString() + "," + oSub.HUseLife.ToString() + "," + oSub.HNewLifeQty.ToString() + - "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBatchNo + "','" + oSub.HBackFlag + "','" + oSub.HNowModel + "'," + oSub.HNowLife.ToString() + - ",'" + oSub.HNewModel + "','" + oSub.HLastProdModel + "','" + oSub.HWallThickness + "','" + oSub.HHardness + "','" + oSub.HDiameter + "'," + oSub.HQtyRel.ToString() + - "," + oSub.HMouldType.ToString() + ",'" + oSub.HInitModel + "'," + oSub.HInitDesignLife.ToString() + "," + oSub.HLifeUnitID.ToString() + + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HRemark + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'" + + "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + ",'" + oSub.HBatchNo + "'" + + "," + oSub.HQtyMust.ToString() + "," + oSub.HQtyRel.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HDesignLife.ToString() + + "," + oSub.HLeaveLife.ToString() + "," + oSub.HUseLife.ToString() + "," + oSub.HUseLifeQty.ToString() + "," + oSub.HNewLifeQty.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() + + "," + oSub.HSPID.ToString() + "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBarCode + "'," + oSub.HCorrespondentTypeID.ToString() + "," + oSub.HCorrespondentID.ToString() + + "," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" + + "," + oSub.HStockOrgID.ToString() + "," + oSub.HOWNERID.ToString() + "," + oSub.HOtherOrgID.ToString() + ",'" + oSub.HOWNERTYPEID + "'" + + ",'" + oSub.HNowModel + "'," + oSub.HNowLife.ToString() + ",'" + oSub.HNewModel + "','" + oSub.HLastProdModel + "','" + oSub.HWallThickness + "','" + oSub.HHardness + "'" + + ",'" + oSub.HDiameter + "'," + oSub.HMouldType.ToString() + ",'" + oSub.HInitModel + "'," + oSub.HInitDesignLife.ToString() + "," + oSub.HLifeUnitID.ToString() + ",'" + oSub.HBackFlag + "'" + ") "); + oCn.RunProc("exec h_p_Sc_MouldFileChangeStatus " + oSub.HMaterID.ToString() + ",'" + oSub.HNewModel.ToString() + "'," + oSub.HNewLifeQty.ToString() + ",'鍦ㄥ簱'"); } - // - //oCn.RunProcReturn("exec h_p_Sc_MouldFileChangeStatus " + omodel.HInterID.ToString() + ",'鍦ㄥ簱'", "gy_czygl"); - //foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl) - //{ - // Ds = oCn.RunProcReturn("exec h_p_Sc_MouldRepairInBill_Qty " + oSub.HICMOInterID, ""); - // if (Ds.Tables[0].Rows.Count == 0) - // return; - // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") - // { - // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; - // return false; - // } - //} DataSet Ds; foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl) { @@ -118,7 +172,13 @@ return false; } } - sReturn = "淇敼鍗曟嵁鎴愬姛锛�"; + //淇濆瓨鍚庢帶鍒� + if (!AfterSave(lngBillKey, omodel.HBillNo, 2, ref sReturn)) + { + oCn.RollBack(); + return false; + } + sReturn = "鍗曟嵁鍙凤細" + omodel.HBillNo + " 淇敼鎴愬姛锛�"; oCn.Commit(); return true; } @@ -134,78 +194,108 @@ { try { + //鑾峰彇绯荤粺鍙傛暟 + Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); + if (oSystemParameter.ShowBillByOrgID(omodel.HSTOCKORGID, ref sReturn) == false) + { + sReturn = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sReturn; + return false; + } //寰楀埌mainid - omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); - //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + if (omodel.HInterID == 0) + { + omodel.HInterID = DBUtility.ClsPub.CreateBillID_Prod(BillType, ref DBUtility.ClsPub.sExeReturnInfo); + } + //淇濆瓨鍓嶆帶鍒� + if (!BeforeSave(omodel.HInterID, omodel.HBillNo, omodel.HSecManagerID, omodel.HKeeperID, omodel.HSupID, 1, ref sReturn)) + { + return false; + } + oCn.BeginTran(); //涓昏〃 oCn.RunProc("Insert Into Sc_MouldStockBillMain " + "(HBillType,HBillSubType,HInterID,HBillNo,HDate" + ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + - ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" + - ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" + - ""+ + ",HSupID,HSupTypeID,HEmpID,HManagerID,HSecManagerID" + + ",HKeeperID,HDeptID,HWHID,HSCWHID,HRedBlueFlag" + + ",HExplanation,HInnerBillNo,HStockOrgID" + ") " + - " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" + + " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate.ToShortDateString() + "'" + ", " + 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.HSupID.ToString() + "," + omodel.HSupTypeID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HSecManagerID.ToString() + + ", " + omodel.HKeeperID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HWHID.ToString() + "," + omodel.HSCWHID.ToString() + "," + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) + + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + omodel.HSTOCKORGID.ToString() + ") "); //鎻掑叆瀛愯〃 foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl) { oCn.RunProc("Insert into Sc_MouldStockBillSub " + - " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + - ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + - ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" + - ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" + - ",HDesignLife,HLeaveLife,HUseLife,HNewLifeQty" + - ",HSCSPID,HSPGroupID,HBatchNo,HBackFlag,HNowModel,HNowLife" + - ",HNewModel,HLastProdModel,HWallThickness,HHardness,HDiameter,HQtyRel" + - ",HMouldType,HInitModel,HInitDesignLife,HLifeUnitID" + - ") values(" - + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + 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.HDesignLife.ToString() + "," + oSub.HLeaveLife.ToString() + "," + oSub.HUseLife.ToString() + "," + oSub.HNewLifeQty.ToString() + - "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBatchNo + "','" + oSub.HBackFlag + "','" + oSub.HNowModel + "'," + oSub.HNowLife.ToString() + - ",'" + oSub.HNewModel + "','" + oSub.HLastProdModel + "','" + oSub.HWallThickness + "','" + oSub.HHardness + "','" + oSub.HDiameter + "'," + oSub.HQtyRel.ToString() + - "," + oSub.HMouldType.ToString() + ",'" + oSub.HInitModel + "'," + oSub.HInitDesignLife.ToString() + "," + oSub.HLifeUnitID.ToString() + - ") "); - oCn.RunProc("exec h_p_Sc_MouldFileChangeStatus " + oSub.HMaterID.ToString() + ",'" + oSub.HNewModel.ToString() + "'," + oSub.HNewLifeQty.ToString() + ",'鍦ㄥ簱'"); - } + " (HInterID,HEntryID,HRemark,HRelationQty,HRelationMoney" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" + + ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HBatchNo" + + ",HQtyMust,HQtyRel,HQty,HPrice,HMoney,HDesignLife" + + ",HLeaveLife,HUseLife,HUseLifeQty,HNewLifeQty,HWHID,HSCWHID" + + ",HSPID,HSCSPID,HSPGroupID,HBarCode,HCorrespondentTypeID,HCorrespondentID" + + ",HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" + + ",HStockOrgID,HOWNERID,HOtherOrgID,HOWNERTYPEID" + + ",HNowModel,HNowLife,HNewModel,HLastProdModel,HWallThickness,HHardness" + + ",HDiameter,HMouldType,HInitModel,HInitDesignLife,HLifeUnitID" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HRemark + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'" + + "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + ",'" + oSub.HBatchNo + "'" + + "," + oSub.HQtyMust.ToString() + "," + oSub.HQtyRel.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HDesignLife.ToString() + + "," + oSub.HLeaveLife.ToString() + "," + oSub.HUseLife.ToString() + "," + oSub.HUseLifeQty.ToString() + "," + oSub.HNewLifeQty.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() + + "," + oSub.HSPID.ToString() + "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBarCode + "'," + oSub.HCorrespondentTypeID.ToString() + "," + oSub.HCorrespondentID.ToString() + + "," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" + + "," + oSub.HStockOrgID.ToString() + "," + oSub.HOWNERID.ToString() + "," + oSub.HOtherOrgID.ToString() + ",'" + oSub.HOWNERTYPEID + "'" + + ",'" + oSub.HNowModel + "'," + oSub.HNowLife.ToString() + ",'" + oSub.HNewModel + "','" + oSub.HLastProdModel + "','" + oSub.HWallThickness + "','" + oSub.HHardness + "'" + + ",'" + oSub.HDiameter + "'," + oSub.HMouldType.ToString() + ",'" + oSub.HInitModel + "'," + oSub.HInitDesignLife.ToString() + "," + oSub.HLifeUnitID.ToString() + + ") "); + if (oSub.HBarCode == "") + { + oCn.RunProc("exec h_p_Sc_MouldFileChangeStatus " + oSub.HMaterID.ToString() + ",'" + oSub.HNewModel.ToString() + "'," + oSub.HNewLifeQty.ToString() + ",'鍦ㄥ簱'"); + } + } - //foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl) - //{ - // Ds = oCn.RunProcReturn("exec h_p_Sc_MouldRepairInBill_Qty " + oSub.HICMOInterID, ""); - // if (Ds.Tables[0].Rows.Count == 0) - // return; - // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") - // { - // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; - // return false; - // } - //} DataSet Ds; foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl) { - Ds = oCn.RunProcReturn("exec h_p_Kf_ICStockBill_CheckKF " + omodel.HInterID + "," + oSub.HMaterID + "," + oSub.HWHID + "," + oSub.HSPID + ", 1", "gy_czygl"); - if (Ds.Tables[0].Rows.Count == 0) + if (oSub.HBarCode == "") { - oCn.RollBack(); - return false; - } - if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][0]) == "N") - { - sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][1]) + ", 涓嶅厑璁镐繚瀛橈紒"; - oCn.RollBack(); - return false; + Ds = oCn.RunProcReturn("exec h_p_Kf_ICStockBill_CheckKF " + omodel.HInterID + "," + oSub.HMaterID + "," + oSub.HWHID + "," + oSub.HSPID + ", 1", "gy_czygl"); + if (Ds.Tables[0].Rows.Count == 0) + { + oCn.RollBack(); + return false; + } + if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][0]) == "N") + { + sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][1]) + ", 涓嶅厑璁镐繚瀛橈紒"; + oCn.RollBack(); + return false; + } } } - // - sReturn = "鏂板鍗曟嵁鎴愬姛锛�"; + //淇濆瓨鍚庢帶鍒� + if (!AfterSave(omodel.HInterID, omodel.HBillNo, 1, ref sReturn)) + { + oCn.RollBack(); + return false; + } + + if (oSystemParameter.omodel.Sc_MouldRepairInBill_AutoCheck.ToUpper() == "Y") //绯荤粺鍙傛暟 鑷姩瀹℃牳 + { + //瀹℃牳鍗曟嵁 + oCn.RunProc("Update Sc_MouldStockBillMain Set HChecker='" + DBUtility.ClsPub.CurUserName + "',HCheckDate=getdate(),HBillStatus=2 where HInterID= " + omodel.HInterID.ToString()); + sReturn = "鍗曟嵁鍙凤細" + omodel.HBillNo + " 鏂板瀹℃牳鎴愬姛锛�"; + } + else + { + sReturn = "鍗曟嵁鍙凤細" + omodel.HBillNo + " 鏂板鎴愬姛锛�"; + } oCn.Commit(); return true; } diff --git "a/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsSc_MouldRepairOutBill.cs" "b/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsSc_MouldRepairOutBill.cs" index f1edbfc..5f5f9e0 100644 --- "a/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsSc_MouldRepairOutBill.cs" +++ "b/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsSc_MouldRepairOutBill.cs" @@ -254,7 +254,10 @@ ",'" + oSub.HDiameter + "'," + oSub.HMouldType.ToString() + ",'" + oSub.HInitModel + "'," + oSub.HInitDesignLife.ToString() + "," + oSub.HLifeUnitID.ToString() + ") "); - oCn.RunProc("exec h_p_Sc_MouldFileChangeStatus " + oSub.HMaterID.ToString() + ",'" + oSub.HNowModel + "'," + oSub.HNowLife.ToString() + ",'鏀瑰埗涓�'"); + if (oSub.HBarCode == "") + { + oCn.RunProc("exec h_p_Sc_MouldFileChangeStatus " + oSub.HMaterID.ToString() + ",'" + oSub.HNowModel + "'," + oSub.HNowLife.ToString() + ",'鏀瑰埗涓�'"); + } } DataSet Ds; diff --git "a/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsSc_MouldScrapInBill.cs" "b/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsSc_MouldScrapInBill.cs" index 82486b7..7598dec 100644 --- "a/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsSc_MouldScrapInBill.cs" +++ "b/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsSc_MouldScrapInBill.cs" @@ -29,8 +29,63 @@ { DetailColl = null; } - + #endregion 鑷畾涔夋柟娉� + + //淇濆瓨鍓嶆帶鍒� + public bool BeforeSave(Int64 HInterID, string HBillNo, Int64 HSecManagerID, Int64 HKeeperID, Int64 HSupID, Int64 OperationType, ref string sReturn) + { + try + { + DataSet Ds = oCn.RunProcReturn("Exec h_p_Sc_MouldScrapInBill_BeforeSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + HSecManagerID.ToString() + "," + HKeeperID.ToString() + "," + HSupID.ToString() + "," + OperationType.ToString(), "h_p_Sc_MouldScrapInBill_BeforeSaveCtrl"); + if (Ds == null || Ds.Tables[0].Rows.Count == 0) + { + sReturn = "淇濆瓨鍓嶅垽鏂け璐ワ紒"; + return false; + } + else + { + if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBack"]) == 1) + { + sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]); + return false; + } + } + return true; + } + catch (Exception e) + { + throw (e); + } + } + + //淇濆瓨鍚庢帶鍒� + public bool AfterSave(Int64 HInterID, string HBillNo, Int64 OperationType, ref string sReturn) + { + try + { + DataSet Ds = oCn.RunProcReturn("Exec h_p_Sc_MouldScrapInBill_AfterSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Sc_MouldScrapInBill_AfterSaveCtrl"); + if (Ds == null || Ds.Tables[0].Rows.Count == 0) + { + sReturn = "淇濆瓨鍚庡垽鏂け璐ワ紒"; + return false; + } + else + { + if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBack"]) == 1) + { + sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]); + return false; + } + } + return true; + } + catch (Exception e) + { + throw (e); + } + } + //淇敼鍗曟嵁 public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) { @@ -38,6 +93,12 @@ { // oCn.BeginTran(); + //淇濆瓨鍓嶆帶鍒� + if (!BeforeSave(lngBillKey, omodel.HBillNo, omodel.HSecManagerID, omodel.HKeeperID, omodel.HSupID, 2, ref sReturn)) + { + oCn.RollBack(); + return false; + } //鏇存柊涓昏〃 oCn.RunProc("UpDate Sc_MouldStockBillMain set " + " HBillNo='" + omodel.HBillNo + "'" + //鍥哄畾璧嬪��=============== @@ -49,17 +110,17 @@ ",HUpDateDate=getdate()" + //======================================== ",HSupID=" + omodel.HSupID.ToString() + - ",HWHID=" + omodel.HWHID.ToString() + - ",HSCWHID=" + omodel.HSCWHID.ToString() + ",HEmpID=" + omodel.HEmpID.ToString() + ",HManagerID=" + omodel.HManagerID.ToString() + ",HSecManagerID=" + omodel.HSecManagerID.ToString() + ",HKeeperID=" + omodel.HKeeperID.ToString() + ",HDeptID=" + omodel.HDeptID.ToString() + - ",HExplanation='" + omodel.HExplanation + "'" + - ",HInnerBillNo='" + omodel.HInnerBillNo + "'" + + ",HWHID=" + omodel.HWHID.ToString() + + ",HSCWHID=" + omodel.HSCWHID.ToString() + + ",HExplanation='" + omodel.HExplanation + "'" + + ",HInnerBillNo='" + omodel.HInnerBillNo + "'" + ",HRedBlueFlag=" + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) + - + ",HStockOrgID=" + omodel.HSTOCKORGID.ToString() + " where HInterID=" + lngBillKey.ToString()); //鍒犻櫎鍏宠仈 DeleteRelation(ref sReturn, lngBillKey); @@ -70,52 +131,25 @@ foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl) { oCn.RunProc("Insert into Sc_MouldStockBillSub " + - " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + - ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + - ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" + - ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" + - ",HDesignLife,HLeaveLife,HUseLife" + - ",HSCSPID,HSPGroupID,HBatchNo" + - //",HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo" + - //",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" + - //",HNewModel,HWallThickness,HHardness,HLastProdModel,HDiameter,HBackFlag" + - //",HQtyRel,HNewLifeQty,HNowModel,HNowLife" + - //",HMouldType,HInitModel,HInitDesignLife,HLifeUnitID" + - ") values(" - + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + 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.HDesignLife.ToString() + "," + oSub.HLeaveLife.ToString() + "," + oSub.HUseLife.ToString() + - "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBatchNo + "'" + - //"," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'" + - //"," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" + - //",'" + oSub.HNewModel + "','" + oSub.HWallThickness + "','" + oSub.HHardness + "','" + oSub.HLastProdModel + "','" + oSub.HDiameter + "','" + oSub.HBackFlag + "'" + - //"," + 0 + "," + oSub.HNewLifeQty.ToString() + ",'" + oSub.HNowModel + "'," + oSub.HNowLife.ToString() + - //"," + oSub.HMouldType.ToString() + ",'" + oSub.HInitModel + "'," + oSub.HInitDesignLife.ToString() + "," + oSub.HLifeUnitID.ToString() + - ") "); - //if (oSub.HBackFlag == "鎶ュ簾鍏ュ簱") - //{ - // oCn.RunProc("exec h_p_Sc_MouldFileChangeStatus " + oSub.HMaterID.ToString() + ",'" + oSub.HNewModel.ToString() + "'," + oSub.HNewLifeQty.ToString() + ",'鎶ュ簾'"); - //} - //else - //{ - // oCn.RunProc("exec h_p_Sc_MouldFileChangeStatus " + oSub.HMaterID.ToString() + ",'" + oSub.HNewModel.ToString() + "'," + oSub.HNewLifeQty.ToString() + ",'鍦ㄥ簱'"); - //} + " (HInterID,HEntryID,HRemark,HRelationQty,HRelationMoney" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" + + ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HBatchNo" + + ",HQtyMust,HQtyRel,HQty,HPrice,HMoney,HDesignLife" + + ",HLeaveLife,HUseLife,HUseLifeQty,HNewLifeQty,HWHID,HSCWHID" + + ",HSPID,HSCSPID,HSPGroupID,HBarCode,HCorrespondentTypeID,HCorrespondentID" + + ",HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" + + ",HStockOrgID,HOWNERID,HOtherOrgID,HOWNERTYPEID" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HRemark + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'" + + "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + ",'" + oSub.HBatchNo + "'" + + "," + oSub.HQtyMust.ToString() + "," + oSub.HQtyRel.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HDesignLife.ToString() + + "," + oSub.HLeaveLife.ToString() + "," + oSub.HUseLife.ToString() + "," + oSub.HUseLifeQty.ToString() + "," + oSub.HNewLifeQty.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() + + "," + oSub.HSPID.ToString() + "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBarCode + "'," + oSub.HCorrespondentTypeID.ToString() + "," + oSub.HCorrespondentID.ToString() + + "," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" + + "," + oSub.HStockOrgID.ToString() + "," + oSub.HOWNERID.ToString() + "," + oSub.HOtherOrgID.ToString() + ",'" + oSub.HOWNERTYPEID + "'" + + ") "); } - // - //oCn.RunProcReturn("exec h_p_Sc_MouldFileChangeStatus " + omodel.HInterID.ToString() + ",'鍦ㄥ簱'", "gy_czygl"); - //foreach (Model.ClsSc_MouldScrapInBillSub oSub in DetailColl) - //{ - // Ds = oCn.RunProcReturn("exec h_p_Sc_MouldScrapInBill_Qty " + oSub.HICMOInterID, ""); - // if (Ds.Tables[0].Rows.Count == 0) - // return; - // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") - // { - // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; - // return false; - // } - //} DataSet Ds; foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl) { @@ -132,7 +166,13 @@ return false; } } - sReturn = "淇敼鍗曟嵁鎴愬姛锛�"; + //淇濆瓨鍚庢帶鍒� + if (!AfterSave(lngBillKey, omodel.HBillNo, 2, ref sReturn)) + { + oCn.RollBack(); + return false; + } + sReturn = "鍗曟嵁鍙凤細" + omodel.HBillNo + " 淇敼鎴愬姛锛�"; oCn.Commit(); return true; } @@ -148,92 +188,99 @@ { try { + //鑾峰彇绯荤粺鍙傛暟 + Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); + if (oSystemParameter.ShowBillByOrgID(omodel.HSTOCKORGID, ref sReturn) == false) + { + sReturn = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sReturn; + return false; + } //寰楀埌mainid - omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); - //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + if (omodel.HInterID == 0) + { + omodel.HInterID = DBUtility.ClsPub.CreateBillID_Prod(BillType, ref DBUtility.ClsPub.sExeReturnInfo); + } + //淇濆瓨鍓嶆帶鍒� + if (!BeforeSave(omodel.HInterID, omodel.HBillNo, omodel.HSecManagerID, omodel.HKeeperID, omodel.HSupID, 1, ref sReturn)) + { + return false; + } + oCn.BeginTran(); //涓昏〃 oCn.RunProc("Insert Into Sc_MouldStockBillMain " + "(HBillType,HBillSubType,HInterID,HBillNo,HDate" + ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + - ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" + - ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" + + ",HSupID,HSupTypeID,HEmpID,HManagerID,HSecManagerID" + + ",HKeeperID,HDeptID,HWHID,HSCWHID,HRedBlueFlag" + + ",HExplanation,HInnerBillNo,HStockOrgID" + ") " + - " values('" + this.BillType + "','" + this.HBillSubType + "'," +omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" + + " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate.ToShortDateString() + "'" + ", " + 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.HSupID.ToString() + "," + omodel.HSupTypeID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HSecManagerID.ToString() + + ", " + omodel.HKeeperID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HWHID.ToString() + "," + omodel.HSCWHID.ToString() + "," + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) + + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + omodel.HSTOCKORGID.ToString() + ") "); //鎻掑叆瀛愯〃 foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl) { - oCn.RunProc("Insert into Sc_MouldStockBillSub " + - " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + - ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + - ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" + - ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" + - ",HDesignLife,HLeaveLife,HUseLife" + - ",HSCSPID,HSPGroupID,HBatchNo" + - //",HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo" + - //",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" + - //",HNewModel,HWallThickness,HHardness,HLastProdModel,HDiameter,HBackFlag" + - //",HQtyRel,HNewLifeQty,HNowModel,HNowLife" + - //",HMouldType,HInitModel,HInitDesignLife,HLifeUnitID" + - ") values(" - + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + 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.HDesignLife.ToString() + "," + oSub.HLeaveLife.ToString() + "," + oSub.HUseLife.ToString() + - "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBatchNo + "'" + - //"," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'" + - //"," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" + - //",'" + oSub.HNewModel + "','" + oSub.HWallThickness + "','" + oSub.HHardness + "','" + oSub.HLastProdModel + "','" + oSub.HDiameter + "','" + oSub.HBackFlag + "'" + - //"," + 0 + "," + oSub.HNewLifeQty.ToString() + ",'" + oSub.HNowModel + "'," + oSub.HNowLife.ToString() + - //"," + oSub.HMouldType.ToString() + ",'" + oSub.HInitModel + "'," + oSub.HInitDesignLife.ToString() + "," + oSub.HLifeUnitID.ToString() + - ") "); - // - //if (oSub.HBackFlag == "鎶ュ簾鍏ュ簱") - //{ - // oCn.RunProc("exec h_p_Sc_MouldFileChangeStatus " + oSub.HMaterID.ToString() + ",'" + oSub.HNewModel.ToString() + "'," + oSub.HNewLifeQty.ToString() + ",'鎶ュ簾'"); - //} - //else - //{ - // oCn.RunProc("exec h_p_Sc_MouldFileChangeStatus " + oSub.HMaterID.ToString() + ",'" + oSub.HNewModel.ToString() + "'," + oSub.HNewLifeQty.ToString() + ",'鍦ㄥ簱'"); - //} + " (HInterID,HEntryID,HRemark,HRelationQty,HRelationMoney" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" + + ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HBatchNo" + + ",HQtyMust,HQtyRel,HQty,HPrice,HMoney,HDesignLife" + + ",HLeaveLife,HUseLife,HUseLifeQty,HNewLifeQty,HWHID,HSCWHID" + + ",HSPID,HSCSPID,HSPGroupID,HBarCode,HCorrespondentTypeID,HCorrespondentID" + + ",HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" + + ",HStockOrgID,HOWNERID,HOtherOrgID,HOWNERTYPEID" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HRemark + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'" + + "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + ",'" + oSub.HBatchNo + "'" + + "," + oSub.HQtyMust.ToString() + "," + oSub.HQtyRel.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HDesignLife.ToString() + + "," + oSub.HLeaveLife.ToString() + "," + oSub.HUseLife.ToString() + "," + oSub.HUseLifeQty.ToString() + "," + oSub.HNewLifeQty.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() + + "," + oSub.HSPID.ToString() + "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBarCode + "'," + oSub.HCorrespondentTypeID.ToString() + "," + oSub.HCorrespondentID.ToString() + + "," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" + + "," + oSub.HStockOrgID.ToString() + "," + oSub.HOWNERID.ToString() + "," + oSub.HOtherOrgID.ToString() + ",'" + oSub.HOWNERTYPEID + "'" + + ") "); } - // - //foreach (Model.ClsSc_MouldScrapInBillSub oSub in DetailColl) - //{ - // Ds = oCn.RunProcReturn("exec h_p_Sc_MouldScrapInBill_Qty " + oSub.HICMOInterID, ""); - // if (Ds.Tables[0].Rows.Count == 0) - // return; - // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") - // { - // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; - // return false; - // } - //} - // + DataSet Ds; foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl) { - Ds = oCn.RunProcReturn("exec h_p_Kf_ICStockBill_CheckKF " + omodel.HInterID + "," + oSub.HMaterID + "," + oSub.HWHID + "," + oSub.HSPID + ", 1", "gy_czygl"); - if (Ds.Tables[0].Rows.Count == 0) + if (oSub.HBarCode == "") { - oCn.RollBack(); - return false; - } - if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][0]) == "N") - { - sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][1]) + ", 涓嶅厑璁镐繚瀛橈紒"; - oCn.RollBack(); - return false; + Ds = oCn.RunProcReturn("exec h_p_Kf_ICStockBill_CheckKF " + omodel.HInterID + "," + oSub.HMaterID + "," + oSub.HWHID + "," + oSub.HSPID + ", 1", "gy_czygl"); + if (Ds.Tables[0].Rows.Count == 0) + { + oCn.RollBack(); + return false; + } + if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][0]) == "N") + { + sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][1]) + ", 涓嶅厑璁镐繚瀛橈紒"; + oCn.RollBack(); + return false; + } } } - sReturn = "鏂板鍗曟嵁鎴愬姛锛�"; + //淇濆瓨鍚庢帶鍒� + if (!AfterSave(omodel.HInterID, omodel.HBillNo, 1, ref sReturn)) + { + oCn.RollBack(); + return false; + } + + if (oSystemParameter.omodel.Sc_MouldScrapInBill_AutoCheck.ToUpper() == "Y") //绯荤粺鍙傛暟 鑷姩瀹℃牳 + { + //瀹℃牳鍗曟嵁 + oCn.RunProc("Update Sc_MouldStockBillMain Set HChecker='" + DBUtility.ClsPub.CurUserName + "',HCheckDate=getdate(),HBillStatus=2 where HInterID= " + omodel.HInterID.ToString()); + sReturn = "鍗曟嵁鍙凤細" + omodel.HBillNo + " 鏂板瀹℃牳鎴愬姛锛�"; + } + else + { + sReturn = "鍗曟嵁鍙凤細" + omodel.HBillNo + " 鏂板鎴愬姛锛�"; + } oCn.Commit(); return true; } diff --git "a/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsSc_MouldScrapOutBill.cs" "b/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsSc_MouldScrapOutBill.cs" index d60925b..981ab32 100644 --- "a/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsSc_MouldScrapOutBill.cs" +++ "b/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsSc_MouldScrapOutBill.cs" @@ -17,7 +17,7 @@ base.MvarItemKeySub3 = ""; base.MvarItemKeySub4 = ""; base.MvarItemKey="Sc_MouldStockBillMain"; - base.MvarReportTitle = "妯″叿澶勭悊鍑哄簱鍗�"; + base.MvarReportTitle = "妯″叿鎶ュ簾鍑哄簱鍗�"; base.BillType="3832"; base.HBillSubType = "3832"; @@ -29,8 +29,63 @@ { DetailColl = null; } - + #endregion 鑷畾涔夋柟娉� + + //淇濆瓨鍓嶆帶鍒� + public bool BeforeSave(Int64 HInterID, string HBillNo, Int64 HSecManagerID, Int64 HKeeperID, Int64 HSupID, Int64 OperationType, ref string sReturn) + { + try + { + DataSet Ds = oCn.RunProcReturn("Exec h_p_Sc_MouldScrapOutBill_BeforeSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + HSecManagerID.ToString() + "," + HKeeperID.ToString() + "," + HSupID.ToString() + "," + OperationType.ToString(), "h_p_Sc_MouldScrapOutBill_BeforeSaveCtrl"); + if (Ds == null || Ds.Tables[0].Rows.Count == 0) + { + sReturn = "淇濆瓨鍓嶅垽鏂け璐ワ紒"; + return false; + } + else + { + if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBack"]) == 1) + { + sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]); + return false; + } + } + return true; + } + catch (Exception e) + { + throw (e); + } + } + + //淇濆瓨鍚庢帶鍒� + public bool AfterSave(Int64 HInterID, string HBillNo, Int64 OperationType, ref string sReturn) + { + try + { + DataSet Ds = oCn.RunProcReturn("Exec h_p_Sc_MouldScrapOutBill_AfterSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Sc_MouldScrapOutBill_AfterSaveCtrl"); + if (Ds == null || Ds.Tables[0].Rows.Count == 0) + { + sReturn = "淇濆瓨鍚庡垽鏂け璐ワ紒"; + return false; + } + else + { + if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBack"]) == 1) + { + sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]); + return false; + } + } + return true; + } + catch (Exception e) + { + throw (e); + } + } + //淇敼鍗曟嵁 public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) { @@ -38,6 +93,12 @@ { // oCn.BeginTran(); + //淇濆瓨鍓嶆帶鍒� + if (!BeforeSave(lngBillKey, omodel.HBillNo, omodel.HSecManagerID, omodel.HKeeperID, omodel.HSupID, 2, ref sReturn)) + { + oCn.RollBack(); + return false; + } //鏇存柊涓昏〃 oCn.RunProc("UpDate Sc_MouldStockBillMain set " + " HBillNo='" + omodel.HBillNo + "'" + //鍥哄畾璧嬪��=============== @@ -49,16 +110,17 @@ ",HUpDateDate=getdate()" + //======================================== ",HSupID=" + omodel.HSupID.ToString() + - ",HWHID=" + omodel.HWHID.ToString() + - //",HSCWHID=" + omodel.HSCWHID.ToString() + - //",HEmpID=" + omodel.HEmpID.ToString() + + ",HEmpID=" + omodel.HEmpID.ToString() + ",HManagerID=" + omodel.HManagerID.ToString() + - //",HSecManagerID=" + omodel.HSecManagerID.ToString() + + ",HSecManagerID=" + omodel.HSecManagerID.ToString() + ",HKeeperID=" + omodel.HKeeperID.ToString() + ",HDeptID=" + omodel.HDeptID.ToString() + + ",HWHID=" + omodel.HWHID.ToString() + + ",HSCWHID=" + omodel.HSCWHID.ToString() + ",HExplanation='" + omodel.HExplanation + "'" + - ",HInnerBillNo='" + omodel.HInnerBillNo + "'" + + ",HInnerBillNo='" + omodel.HInnerBillNo + "'" + ",HRedBlueFlag=" + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) + + ",HStockOrgID=" + omodel.HSTOCKORGID.ToString() + " where HInterID=" + lngBillKey.ToString()); //鍒犻櫎鍏宠仈 DeleteRelation(ref sReturn, lngBillKey); @@ -68,39 +130,26 @@ omodel.HInterID = lngBillKey; foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl) { - oCn.RunProc("Insert into Sc_MouldStockBillSub " + - " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + - ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + - ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" + - ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" + - ",HDesignLife,HLeaveLife" + - ",HSCSPID,HSPGroupID,HBatchNo,HUseLife" + - ") values(" - + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + 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.HDesignLife.ToString() + "," + oSub.HLeaveLife.ToString() + - "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBatchNo + "'," + oSub.HUseLife.ToString() + - - ") "); - - //oCn.RunProc("exec h_p_Sc_MouldFileChangeStatus " + oSub.HMaterID.ToString() + ",'" + oSub.HNowModel.ToString() + "'," + oSub.HNowLife.ToString() + ",'鐢熶骇涓�'"); + " (HInterID,HEntryID,HRemark,HRelationQty,HRelationMoney" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" + + ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HBatchNo" + + ",HQtyMust,HQtyRel,HQty,HPrice,HMoney,HDesignLife" + + ",HLeaveLife,HUseLife,HUseLifeQty,HNewLifeQty,HWHID,HSCWHID" + + ",HSPID,HSCSPID,HSPGroupID,HBarCode,HCorrespondentTypeID,HCorrespondentID" + + ",HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" + + ",HStockOrgID,HOWNERID,HOtherOrgID,HOWNERTYPEID" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HRemark + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'" + + "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + ",'" + oSub.HBatchNo + "'" + + "," + oSub.HQtyMust.ToString() + "," + oSub.HQtyRel.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HDesignLife.ToString() + + "," + oSub.HLeaveLife.ToString() + "," + oSub.HUseLife.ToString() + "," + oSub.HUseLifeQty.ToString() + "," + oSub.HNewLifeQty.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() + + "," + oSub.HSPID.ToString() + "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBarCode + "'," + oSub.HCorrespondentTypeID.ToString() + "," + oSub.HCorrespondentID.ToString() + + "," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" + + "," + oSub.HStockOrgID.ToString() + "," + oSub.HOWNERID.ToString() + "," + oSub.HOtherOrgID.ToString() + ",'" + oSub.HOWNERTYPEID + "'" + + ") "); } - // - //oCn.RunProcReturn("exec h_p_Sc_MouldFileChangeStatus " + omodel.HInterID.ToString() + ",'鐢熶骇涓�'", "gy_czygl"); - //foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl) - //{ - // Ds = oCn.RunProcReturn("exec h_p_Sc_MouldScrapOutBill_Qty " + oSub.HICMOInterID, ""); - // if (Ds.Tables[0].Rows.Count == 0) - // return; - // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") - // { - // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; - // return false; - // } - //} DataSet Ds; foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl) { @@ -117,7 +166,13 @@ return false; } } - sReturn = "淇敼鍗曟嵁鎴愬姛锛�"; + //淇濆瓨鍚庢帶鍒� + if (!AfterSave(lngBillKey, omodel.HBillNo, 2, ref sReturn)) + { + oCn.RollBack(); + return false; + } + sReturn = "鍗曟嵁鍙凤細" + omodel.HBillNo + " 淇敼鎴愬姛锛�"; oCn.Commit(); return true; } @@ -133,75 +188,99 @@ { try { + //鑾峰彇绯荤粺鍙傛暟 + Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); + if (oSystemParameter.ShowBillByOrgID(omodel.HSTOCKORGID, ref sReturn) == false) + { + sReturn = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sReturn; + return false; + } //寰楀埌mainid - omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); - //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + if (omodel.HInterID == 0) + { + omodel.HInterID = DBUtility.ClsPub.CreateBillID_Prod(BillType, ref DBUtility.ClsPub.sExeReturnInfo); + } + //淇濆瓨鍓嶆帶鍒� + if (!BeforeSave(omodel.HInterID, omodel.HBillNo, omodel.HSecManagerID, omodel.HKeeperID, omodel.HSupID, 1, ref sReturn)) + { + return false; + } + oCn.BeginTran(); //涓昏〃 oCn.RunProc("Insert Into Sc_MouldStockBillMain " + "(HBillType,HBillSubType,HInterID,HBillNo,HDate" + ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + - ",HSupID,HWHID,HManagerID,HSCWHID,HEmpID,HSecManagerID" + - ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" + - ""+ + ",HSupID,HSupTypeID,HEmpID,HManagerID,HSecManagerID" + + ",HKeeperID,HDeptID,HWHID,HSCWHID,HRedBlueFlag" + + ",HExplanation,HInnerBillNo,HStockOrgID" + ") " + - " values('" + this.BillType + "','" + this.HBillSubType + "'," +omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" + + " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate.ToShortDateString() + "'" + ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" + - ", " + omodel.HSupID.ToString() + "," + omodel.HWHID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HSCWHID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HSecManagerID.ToString() + - ", " + omodel.HKeeperID.ToString() + "," + omodel.HDeptID.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) + + ", " + omodel.HSupID.ToString() + "," + omodel.HSupTypeID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HSecManagerID.ToString() + + ", " + omodel.HKeeperID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HWHID.ToString() + "," + omodel.HSCWHID.ToString() + "," + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) + + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + omodel.HSTOCKORGID.ToString() + ") "); //鎻掑叆瀛愯〃 foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl) { oCn.RunProc("Insert into Sc_MouldStockBillSub " + - " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + - ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + - ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" + - ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" + - ",HDesignLife,HLeaveLife" + - ",HSCSPID,HSPGroupID,HBatchNo,HUseLife" + - ") values(" - + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + 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.HDesignLife.ToString() + "," + oSub.HLeaveLife.ToString() + - "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBatchNo + "'," + oSub.HUseLife.ToString() + - - ") "); - - //oCn.RunProc("exec h_p_Sc_MouldFileChangeStatus " + oSub.HMaterID.ToString() + ",'" + oSub.HNowModel.ToString() + "'," + oSub.HNowLife.ToString() + ",'鐢熶骇涓�'"); + " (HInterID,HEntryID,HRemark,HRelationQty,HRelationMoney" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" + + ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HBatchNo" + + ",HQtyMust,HQtyRel,HQty,HPrice,HMoney,HDesignLife" + + ",HLeaveLife,HUseLife,HUseLifeQty,HNewLifeQty,HWHID,HSCWHID" + + ",HSPID,HSCSPID,HSPGroupID,HBarCode,HCorrespondentTypeID,HCorrespondentID" + + ",HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" + + ",HStockOrgID,HOWNERID,HOtherOrgID,HOWNERTYPEID" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HRemark + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'" + + "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + ",'" + oSub.HBatchNo + "'" + + "," + oSub.HQtyMust.ToString() + "," + oSub.HQtyRel.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HDesignLife.ToString() + + "," + oSub.HLeaveLife.ToString() + "," + oSub.HUseLife.ToString() + "," + oSub.HUseLifeQty.ToString() + "," + oSub.HNewLifeQty.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() + + "," + oSub.HSPID.ToString() + "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBarCode + "'," + oSub.HCorrespondentTypeID.ToString() + "," + oSub.HCorrespondentID.ToString() + + "," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" + + "," + oSub.HStockOrgID.ToString() + "," + oSub.HOWNERID.ToString() + "," + oSub.HOtherOrgID.ToString() + ",'" + oSub.HOWNERTYPEID + "'" + + ") "); } - // - //foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl) - //{ - // Ds = oCn.RunProcReturn("exec h_p_Sc_MouldScrapOutBill_Qty " + oSub.HICMOInterID, ""); - // if (Ds.Tables[0].Rows.Count == 0) - // return; - // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") - // { - // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; - // return false; - // } - //} + DataSet Ds; foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl) { - Ds = oCn.RunProcReturn("exec h_p_Kf_ICStockBill_CheckKF " + omodel.HInterID + "," + oSub.HMaterID + "," + oSub.HWHID + "," + oSub.HSPID + ", -1", "gy_czygl"); - if (Ds.Tables[0].Rows.Count == 0) + if (oSub.HBarCode == "") { - oCn.RollBack(); - return false; - } - if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][0]) == "N") - { - sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][1]) + ", 涓嶅厑璁镐繚瀛橈紒"; - oCn.RollBack(); - return false; + Ds = oCn.RunProcReturn("exec h_p_Kf_ICStockBill_CheckKF " + omodel.HInterID + "," + oSub.HMaterID + "," + oSub.HWHID + "," + oSub.HSPID + ", -1", "gy_czygl"); + if (Ds.Tables[0].Rows.Count == 0) + { + oCn.RollBack(); + return false; + } + if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][0]) == "N") + { + sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][1]) + ", 涓嶅厑璁镐繚瀛橈紒"; + oCn.RollBack(); + return false; + } } } - // - sReturn = "鏂板鍗曟嵁鎴愬姛锛�"; + //淇濆瓨鍚庢帶鍒� + if (!AfterSave(omodel.HInterID, omodel.HBillNo, 1, ref sReturn)) + { + oCn.RollBack(); + return false; + } + + if (oSystemParameter.omodel.Sc_MouldScrapOutBill_AutoCheck.ToUpper() == "Y") //绯荤粺鍙傛暟 鑷姩瀹℃牳 + { + //瀹℃牳鍗曟嵁 + oCn.RunProc("Update Sc_MouldStockBillMain Set HChecker='" + DBUtility.ClsPub.CurUserName + "',HCheckDate=getdate(),HBillStatus=2 where HInterID= " + omodel.HInterID.ToString()); + sReturn = "鍗曟嵁鍙凤細" + omodel.HBillNo + " 鏂板瀹℃牳鎴愬姛锛�"; + } + else + { + sReturn = "鍗曟嵁鍙凤細" + omodel.HBillNo + " 鏂板鎴愬姛锛�"; + } oCn.Commit(); return true; } diff --git "a/WebAPI/Controllers/\346\235\241\347\240\201\347\256\241\347\220\206/MouldController.cs" "b/WebAPI/Controllers/\346\235\241\347\240\201\347\256\241\347\220\206/MouldController.cs" index 7d46d68..9c86a81 100644 --- "a/WebAPI/Controllers/\346\235\241\347\240\201\347\256\241\347\220\206/MouldController.cs" +++ "b/WebAPI/Controllers/\346\235\241\347\240\201\347\256\241\347\220\206/MouldController.cs" @@ -863,6 +863,165 @@ #endregion + #region 妯″叿鏀瑰埗鍏ュ簱鍗� 涓婁紶鐢熷崟 + + /// <summary> + /// 妯″叿鏀瑰埗鍏ュ簱鍗曟柊澧炰笂浼� + /// </summary> + /// <returns></returns> + [Route("MouldController/set_SaveMouldRepairInBill_Json")] + [HttpPost] + public object set_SaveMouldRepairInBill_Json([FromBody] JObject oMain) + { + BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew; + DAL.ClsSc_MouldRepairInBill BillNew = new DAL.ClsSc_MouldRepairInBill(); + var _value = oMain["oMain"].ToString(); + string msg1 = _value.ToString(); + try + { + string sMainStr = "[" + msg1.ToString() + "]"; + List<Model.ClsSc_MouldRepairInBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldRepairInBillMain>>(sMainStr); + + //鍗曟嵁鍙锋槸鍚﹂噸澶� + if (BillNew.IsExistBillNo(ref ClsPub.sExeReturnInfo, mainList[0].HBillNo, BillStatus, mainList[0].HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒"; + objJsonResult.data = null; + return objJsonResult; + } + //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞� + string s = ""; + int sYear = 0; + int sPeriod = 0; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(mainList[0].HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = s; + objJsonResult.data = null; + return objJsonResult; + } + //鍥哄畾璧嬪��================================= + BillNew.omodel.HYear = sYear; + BillNew.omodel.HPeriod = sPeriod; + BillNew.omodel.HBillType = "3826"; + BillNew.omodel.HInterID = mainList[0].HInterID; + BillNew.omodel.HBillNo = mainList[0].HBillNo; + BillNew.omodel.HDate = mainList[0].HDate; + BillNew.omodel.HRemark = mainList[0].HRemark; + BillNew.omodel.HMaker = mainList[0].HMaker; + BillNew.omodel.HSTOCKORGID = mainList[0].HSTOCKORGID; + DBUtility.ClsPub.CurUserName = mainList[0].HMaker; + //==================================================== + BillNew.omodel.HSupID = mainList[0].HSupID; + BillNew.omodel.HSupTypeID = 1; //锛�1 渚涘簲鍟嗐��2 瀹㈡埛銆� 3 杞﹂棿閮ㄩ棬锛� + BillNew.omodel.HEmpID = mainList[0].HEmpID; + BillNew.omodel.HManagerID = mainList[0].HManagerID; + BillNew.omodel.HSecManagerID = mainList[0].HSecManagerID; + BillNew.omodel.HKeeperID = mainList[0].HKeeperID; + BillNew.omodel.HDeptID = mainList[0].HDeptID; + BillNew.omodel.HWHID = mainList[0].HWHID; + BillNew.omodel.HSCWHID = mainList[0].HSCWHID; + BillNew.omodel.HExplanation = mainList[0].HExplanation; + BillNew.omodel.HInnerBillNo = mainList[0].HInnerBillNo; + BillNew.omodel.HRedBlueFlag = mainList[0].HRedBlueFlag; + //瀛愯〃璧嬪�� + ds = oCn.RunProcReturn("exec h_p_Sc_GetMouldStockBill_Temp " + BillNew.omodel.HInterID.ToString() + ",'" + BillNew.omodel.HBillType + "'", "h_p_Sc_GetMouldStockBill_Temp"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鎵爜淇℃伅锛岃鍏堟壂鎻忔潯鐮侊紝纭鏃犺鍚庡啀鎻愪氦锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++) + { + Model.ClsSc_MouldStockBillSub oSub = new Model.ClsSc_MouldStockBillSub(); + //鍥哄畾璧嬪��======================================== + oSub.HEntryID = i + 1; + oSub.HRemark = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HRemark"]); + oSub.HSourceInterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSourceInterID"]); + oSub.HSourceEntryID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSourceEntryID"]); + oSub.HSourceBillType = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HSourceBillType"]); + oSub.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HSourceBillNo"]); + oSub.HRelationQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HRelationQty"]); + oSub.HRelationMoney = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HRelationMoney"]); + //============================= + oSub.HMaterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HMaterID"]); + oSub.HPropertyID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HAuxPropID"]); + oSub.HSecUnitID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSecUnitID"]); + oSub.HSecUnitRate = DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[i]["HSecUnitRate"]); + oSub.HUnitID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HUnitID"]); + oSub.HBatchNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HBatchNo"]); + oSub.HQtyMust = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HQtyMust"]); + oSub.HQtyRel = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HQtyRel"]); + oSub.HQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HQty"]); + oSub.HPrice = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HPrice"]); + oSub.HMoney = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HMoney"]); + oSub.HDesignLife = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HDesignLife"]); + oSub.HLeaveLife = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HLeaveLife"]); + oSub.HUseLife = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HUseLife"]); + oSub.HUseLifeQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HUseLifeQty"]); + oSub.HNewLifeQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HNewLifeQty"]); + oSub.HWHID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HWHID"]); + oSub.HSCWHID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSCWHID"]); + oSub.HSPID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSPID"]); + oSub.HSCSPID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSCSPID"]); + oSub.HSPGroupID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSPGroupID"]); + oSub.HBarCode = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HBarCode"]); + oSub.HCorrespondentTypeID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HCorrespondentTypeID"]); + oSub.HCorrespondentID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HCorrespondentID"]); + oSub.HPOOrderInterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HPOOrderInterID"]); + oSub.HPOOrderEntryID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HPOOrderEntryID"]); + oSub.HPOOrderBillNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HPOOrderBillNo"]); + oSub.HSeOrderInterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSeOrderInterID"]); + oSub.HSeOrderEntryID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSeOrderEntryID"]); + oSub.HSeOrderBillNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HSeOrderBillNo"]); + oSub.HStockOrgID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HStockOrgID"]); + oSub.HOWNERID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HOWNERID"]); + oSub.HOtherOrgID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HOtherOrgID"]); + oSub.HOWNERTYPEID = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HOWNERTYPEID"]); + BillNew.DetailColl.Add(oSub); + } + } + //淇濆瓨 + bool bResult; + bResult = BillNew.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; //鎴愬姛锛� + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "妯″叿鏀瑰埗鍏ュ簱鍗曚笂浼犲け璐ワ紒" + e.Message; + objJsonResult.data = null; + return objJsonResult; + } + } + + #endregion + #region 妯″叿鏀瑰埗鍑哄簱鍗� 涓婁紶鐢熷崟 /// <summary> @@ -1022,6 +1181,642 @@ #endregion + #region 妯″叿鍏朵粬鍏ュ簱鍗� 涓婁紶鐢熷崟 + + /// <summary> + /// 妯″叿鍏朵粬鍏ュ簱鍗曟柊澧炰笂浼� + /// </summary> + /// <returns></returns> + [Route("MouldController/set_SaveMouldOtherInBill_Json")] + [HttpPost] + public object set_SaveMouldOtherInBill_Json([FromBody] JObject oMain) + { + BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew; + DAL.ClsSc_MouldOtherInBill BillNew = new DAL.ClsSc_MouldOtherInBill(); + var _value = oMain["oMain"].ToString(); + string msg1 = _value.ToString(); + try + { + string sMainStr = "[" + msg1.ToString() + "]"; + List<Model.ClsSc_MouldOtherInBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldOtherInBillMain>>(sMainStr); + + //鍗曟嵁鍙锋槸鍚﹂噸澶� + if (BillNew.IsExistBillNo(ref ClsPub.sExeReturnInfo, mainList[0].HBillNo, BillStatus, mainList[0].HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒"; + objJsonResult.data = null; + return objJsonResult; + } + //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞� + string s = ""; + int sYear = 0; + int sPeriod = 0; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(mainList[0].HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = s; + objJsonResult.data = null; + return objJsonResult; + } + //鍥哄畾璧嬪��================================= + BillNew.omodel.HYear = sYear; + BillNew.omodel.HPeriod = sPeriod; + BillNew.omodel.HBillType = "3827"; + BillNew.omodel.HInterID = mainList[0].HInterID; + BillNew.omodel.HBillNo = mainList[0].HBillNo; + BillNew.omodel.HDate = mainList[0].HDate; + BillNew.omodel.HRemark = mainList[0].HRemark; + BillNew.omodel.HMaker = mainList[0].HMaker; + BillNew.omodel.HSTOCKORGID = mainList[0].HSTOCKORGID; + DBUtility.ClsPub.CurUserName = mainList[0].HMaker; + //==================================================== + BillNew.omodel.HSupID = mainList[0].HSupID; + BillNew.omodel.HSupTypeID = 1; //锛�1 渚涘簲鍟嗐��2 瀹㈡埛銆� 3 杞﹂棿閮ㄩ棬锛� + BillNew.omodel.HEmpID = mainList[0].HEmpID; + BillNew.omodel.HManagerID = mainList[0].HManagerID; + BillNew.omodel.HSecManagerID = mainList[0].HSecManagerID; + BillNew.omodel.HKeeperID = mainList[0].HKeeperID; + BillNew.omodel.HDeptID = mainList[0].HDeptID; + BillNew.omodel.HWHID = mainList[0].HWHID; + BillNew.omodel.HSCWHID = mainList[0].HSCWHID; + BillNew.omodel.HExplanation = mainList[0].HExplanation; + BillNew.omodel.HInnerBillNo = mainList[0].HInnerBillNo; + BillNew.omodel.HRedBlueFlag = mainList[0].HRedBlueFlag; + //瀛愯〃璧嬪�� + ds = oCn.RunProcReturn("exec h_p_Sc_GetMouldStockBill_Temp " + BillNew.omodel.HInterID.ToString() + ",'" + BillNew.omodel.HBillType + "'", "h_p_Sc_GetMouldStockBill_Temp"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鎵爜淇℃伅锛岃鍏堟壂鎻忔潯鐮侊紝纭鏃犺鍚庡啀鎻愪氦锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++) + { + Model.ClsSc_MouldStockBillSub oSub = new Model.ClsSc_MouldStockBillSub(); + //鍥哄畾璧嬪��======================================== + oSub.HEntryID = i + 1; + oSub.HRemark = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HRemark"]); + oSub.HSourceInterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSourceInterID"]); + oSub.HSourceEntryID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSourceEntryID"]); + oSub.HSourceBillType = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HSourceBillType"]); + oSub.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HSourceBillNo"]); + oSub.HRelationQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HRelationQty"]); + oSub.HRelationMoney = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HRelationMoney"]); + //============================= + oSub.HMaterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HMaterID"]); + oSub.HPropertyID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HAuxPropID"]); + oSub.HSecUnitID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSecUnitID"]); + oSub.HSecUnitRate = DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[i]["HSecUnitRate"]); + oSub.HUnitID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HUnitID"]); + oSub.HBatchNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HBatchNo"]); + oSub.HQtyMust = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HQtyMust"]); + oSub.HQtyRel = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HQtyRel"]); + oSub.HQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HQty"]); + oSub.HPrice = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HPrice"]); + oSub.HMoney = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HMoney"]); + oSub.HDesignLife = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HDesignLife"]); + oSub.HLeaveLife = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HLeaveLife"]); + oSub.HUseLife = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HUseLife"]); + oSub.HUseLifeQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HUseLifeQty"]); + oSub.HNewLifeQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HNewLifeQty"]); + oSub.HWHID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HWHID"]); + oSub.HSCWHID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSCWHID"]); + oSub.HSPID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSPID"]); + oSub.HSCSPID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSCSPID"]); + oSub.HSPGroupID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSPGroupID"]); + oSub.HBarCode = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HBarCode"]); + oSub.HCorrespondentTypeID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HCorrespondentTypeID"]); + oSub.HCorrespondentID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HCorrespondentID"]); + oSub.HPOOrderInterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HPOOrderInterID"]); + oSub.HPOOrderEntryID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HPOOrderEntryID"]); + oSub.HPOOrderBillNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HPOOrderBillNo"]); + oSub.HSeOrderInterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSeOrderInterID"]); + oSub.HSeOrderEntryID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSeOrderEntryID"]); + oSub.HSeOrderBillNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HSeOrderBillNo"]); + oSub.HStockOrgID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HStockOrgID"]); + oSub.HOWNERID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HOWNERID"]); + oSub.HOtherOrgID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HOtherOrgID"]); + oSub.HOWNERTYPEID = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HOWNERTYPEID"]); + BillNew.DetailColl.Add(oSub); + } + } + //淇濆瓨 + bool bResult; + bResult = BillNew.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; //鎴愬姛锛� + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "妯″叿鍏朵粬鍏ュ簱鍗曚笂浼犲け璐ワ紒" + e.Message; + objJsonResult.data = null; + return objJsonResult; + } + } + + #endregion + + #region 妯″叿鍏朵粬鍑哄簱鍗� 涓婁紶鐢熷崟 + + /// <summary> + /// 妯″叿鍏朵粬鍑哄簱鍗曟柊澧炰笂浼� + /// </summary> + /// <returns></returns> + [Route("MouldController/set_SaveMouldOtherOutBill_Json")] + [HttpPost] + public object set_SaveMouldOtherOutBill_Json([FromBody] JObject oMain) + { + BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew; + DAL.ClsSc_MouldOtherOutBill BillNew = new DAL.ClsSc_MouldOtherOutBill(); + var _value = oMain["oMain"].ToString(); + string msg1 = _value.ToString(); + try + { + string sMainStr = "[" + msg1.ToString() + "]"; + List<Model.ClsSc_MouldOtherOutBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldOtherOutBillMain>>(sMainStr); + + //鍗曟嵁鍙锋槸鍚﹂噸澶� + if (BillNew.IsExistBillNo(ref ClsPub.sExeReturnInfo, mainList[0].HBillNo, BillStatus, mainList[0].HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒"; + objJsonResult.data = null; + return objJsonResult; + } + //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞� + string s = ""; + int sYear = 0; + int sPeriod = 0; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(mainList[0].HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = s; + objJsonResult.data = null; + return objJsonResult; + } + //鍥哄畾璧嬪��================================= + BillNew.omodel.HYear = sYear; + BillNew.omodel.HPeriod = sPeriod; + BillNew.omodel.HBillType = "3828"; + BillNew.omodel.HInterID = mainList[0].HInterID; + BillNew.omodel.HBillNo = mainList[0].HBillNo; + BillNew.omodel.HDate = mainList[0].HDate; + BillNew.omodel.HRemark = mainList[0].HRemark; + BillNew.omodel.HMaker = mainList[0].HMaker; + BillNew.omodel.HSTOCKORGID = mainList[0].HSTOCKORGID; + DBUtility.ClsPub.CurUserName = mainList[0].HMaker; + //==================================================== + BillNew.omodel.HSupID = mainList[0].HSupID; + BillNew.omodel.HSupTypeID = 1; //锛�1 渚涘簲鍟嗐��2 瀹㈡埛銆� 3 杞﹂棿閮ㄩ棬锛� + BillNew.omodel.HEmpID = mainList[0].HEmpID; + BillNew.omodel.HManagerID = mainList[0].HManagerID; + BillNew.omodel.HSecManagerID = mainList[0].HSecManagerID; + BillNew.omodel.HKeeperID = mainList[0].HKeeperID; + BillNew.omodel.HDeptID = mainList[0].HDeptID; + BillNew.omodel.HWHID = mainList[0].HWHID; + BillNew.omodel.HSCWHID = mainList[0].HSCWHID; + BillNew.omodel.HExplanation = mainList[0].HExplanation; + BillNew.omodel.HInnerBillNo = mainList[0].HInnerBillNo; + BillNew.omodel.HRedBlueFlag = mainList[0].HRedBlueFlag; + //瀛愯〃璧嬪�� + ds = oCn.RunProcReturn("exec h_p_Sc_GetMouldStockBill_Temp " + BillNew.omodel.HInterID.ToString() + ",'" + BillNew.omodel.HBillType + "'", "h_p_Sc_GetMouldStockBill_Temp"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鎵爜淇℃伅锛岃鍏堟壂鎻忔潯鐮侊紝纭鏃犺鍚庡啀鎻愪氦锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++) + { + Model.ClsSc_MouldStockBillSub oSub = new Model.ClsSc_MouldStockBillSub(); + //鍥哄畾璧嬪��======================================== + oSub.HEntryID = i + 1; + oSub.HRemark = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HRemark"]); + oSub.HSourceInterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSourceInterID"]); + oSub.HSourceEntryID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSourceEntryID"]); + oSub.HSourceBillType = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HSourceBillType"]); + oSub.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HSourceBillNo"]); + oSub.HRelationQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HRelationQty"]); + oSub.HRelationMoney = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HRelationMoney"]); + //============================= + oSub.HMaterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HMaterID"]); + oSub.HPropertyID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HAuxPropID"]); + oSub.HSecUnitID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSecUnitID"]); + oSub.HSecUnitRate = DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[i]["HSecUnitRate"]); + oSub.HUnitID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HUnitID"]); + oSub.HBatchNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HBatchNo"]); + oSub.HQtyMust = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HQtyMust"]); + oSub.HQtyRel = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HQtyRel"]); + oSub.HQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HQty"]); + oSub.HPrice = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HPrice"]); + oSub.HMoney = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HMoney"]); + oSub.HDesignLife = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HDesignLife"]); + oSub.HLeaveLife = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HLeaveLife"]); + oSub.HUseLife = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HUseLife"]); + oSub.HUseLifeQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HUseLifeQty"]); + oSub.HNewLifeQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HNewLifeQty"]); + oSub.HWHID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HWHID"]); + oSub.HSCWHID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSCWHID"]); + oSub.HSPID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSPID"]); + oSub.HSCSPID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSCSPID"]); + oSub.HSPGroupID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSPGroupID"]); + oSub.HBarCode = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HBarCode"]); + oSub.HCorrespondentTypeID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HCorrespondentTypeID"]); + oSub.HCorrespondentID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HCorrespondentID"]); + oSub.HPOOrderInterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HPOOrderInterID"]); + oSub.HPOOrderEntryID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HPOOrderEntryID"]); + oSub.HPOOrderBillNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HPOOrderBillNo"]); + oSub.HSeOrderInterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSeOrderInterID"]); + oSub.HSeOrderEntryID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSeOrderEntryID"]); + oSub.HSeOrderBillNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HSeOrderBillNo"]); + oSub.HStockOrgID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HStockOrgID"]); + oSub.HOWNERID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HOWNERID"]); + oSub.HOtherOrgID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HOtherOrgID"]); + oSub.HOWNERTYPEID = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HOWNERTYPEID"]); + BillNew.DetailColl.Add(oSub); + } + } + //淇濆瓨 + bool bResult; + bResult = BillNew.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; //鎴愬姛锛� + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "妯″叿鍏朵粬鍑哄簱鍗曚笂浼犲け璐ワ紒" + e.Message; + objJsonResult.data = null; + return objJsonResult; + } + } + + #endregion + + #region 妯″叿鎶ュ簾鍏ュ簱鍗� 涓婁紶鐢熷崟 + + /// <summary> + /// 妯″叿鎶ュ簾鍏ュ簱鍗曟柊澧炰笂浼� + /// </summary> + /// <returns></returns> + [Route("MouldController/set_SaveMouldScrapInBill_Json")] + [HttpPost] + public object set_SaveMouldScrapInBill_Json([FromBody] JObject oMain) + { + BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew; + DAL.ClsSc_MouldScrapInBill BillNew = new DAL.ClsSc_MouldScrapInBill(); + var _value = oMain["oMain"].ToString(); + string msg1 = _value.ToString(); + try + { + string sMainStr = "[" + msg1.ToString() + "]"; + List<Model.ClsSc_MouldScrapInBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldScrapInBillMain>>(sMainStr); + + //鍗曟嵁鍙锋槸鍚﹂噸澶� + if (BillNew.IsExistBillNo(ref ClsPub.sExeReturnInfo, mainList[0].HBillNo, BillStatus, mainList[0].HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒"; + objJsonResult.data = null; + return objJsonResult; + } + //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞� + string s = ""; + int sYear = 0; + int sPeriod = 0; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(mainList[0].HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = s; + objJsonResult.data = null; + return objJsonResult; + } + //鍥哄畾璧嬪��================================= + BillNew.omodel.HYear = sYear; + BillNew.omodel.HPeriod = sPeriod; + BillNew.omodel.HBillType = "3831"; + BillNew.omodel.HInterID = mainList[0].HInterID; + BillNew.omodel.HBillNo = mainList[0].HBillNo; + BillNew.omodel.HDate = mainList[0].HDate; + BillNew.omodel.HRemark = mainList[0].HRemark; + BillNew.omodel.HMaker = mainList[0].HMaker; + BillNew.omodel.HSTOCKORGID = mainList[0].HSTOCKORGID; + DBUtility.ClsPub.CurUserName = mainList[0].HMaker; + //==================================================== + BillNew.omodel.HSupID = mainList[0].HSupID; + BillNew.omodel.HSupTypeID = 1; //锛�1 渚涘簲鍟嗐��2 瀹㈡埛銆� 3 杞﹂棿閮ㄩ棬锛� + BillNew.omodel.HEmpID = mainList[0].HEmpID; + BillNew.omodel.HManagerID = mainList[0].HManagerID; + BillNew.omodel.HSecManagerID = mainList[0].HSecManagerID; + BillNew.omodel.HKeeperID = mainList[0].HKeeperID; + BillNew.omodel.HDeptID = mainList[0].HDeptID; + BillNew.omodel.HWHID = mainList[0].HWHID; + BillNew.omodel.HSCWHID = mainList[0].HSCWHID; + BillNew.omodel.HExplanation = mainList[0].HExplanation; + BillNew.omodel.HInnerBillNo = mainList[0].HInnerBillNo; + BillNew.omodel.HRedBlueFlag = mainList[0].HRedBlueFlag; + //瀛愯〃璧嬪�� + ds = oCn.RunProcReturn("exec h_p_Sc_GetMouldStockBill_Temp " + BillNew.omodel.HInterID.ToString() + ",'" + BillNew.omodel.HBillType + "'", "h_p_Sc_GetMouldStockBill_Temp"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鎵爜淇℃伅锛岃鍏堟壂鎻忔潯鐮侊紝纭鏃犺鍚庡啀鎻愪氦锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++) + { + Model.ClsSc_MouldStockBillSub oSub = new Model.ClsSc_MouldStockBillSub(); + //鍥哄畾璧嬪��======================================== + oSub.HEntryID = i + 1; + oSub.HRemark = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HRemark"]); + oSub.HSourceInterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSourceInterID"]); + oSub.HSourceEntryID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSourceEntryID"]); + oSub.HSourceBillType = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HSourceBillType"]); + oSub.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HSourceBillNo"]); + oSub.HRelationQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HRelationQty"]); + oSub.HRelationMoney = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HRelationMoney"]); + //============================= + oSub.HMaterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HMaterID"]); + oSub.HPropertyID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HAuxPropID"]); + oSub.HSecUnitID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSecUnitID"]); + oSub.HSecUnitRate = DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[i]["HSecUnitRate"]); + oSub.HUnitID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HUnitID"]); + oSub.HBatchNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HBatchNo"]); + oSub.HQtyMust = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HQtyMust"]); + oSub.HQtyRel = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HQtyRel"]); + oSub.HQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HQty"]); + oSub.HPrice = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HPrice"]); + oSub.HMoney = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HMoney"]); + oSub.HDesignLife = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HDesignLife"]); + oSub.HLeaveLife = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HLeaveLife"]); + oSub.HUseLife = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HUseLife"]); + oSub.HUseLifeQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HUseLifeQty"]); + oSub.HNewLifeQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HNewLifeQty"]); + oSub.HWHID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HWHID"]); + oSub.HSCWHID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSCWHID"]); + oSub.HSPID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSPID"]); + oSub.HSCSPID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSCSPID"]); + oSub.HSPGroupID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSPGroupID"]); + oSub.HBarCode = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HBarCode"]); + oSub.HCorrespondentTypeID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HCorrespondentTypeID"]); + oSub.HCorrespondentID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HCorrespondentID"]); + oSub.HPOOrderInterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HPOOrderInterID"]); + oSub.HPOOrderEntryID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HPOOrderEntryID"]); + oSub.HPOOrderBillNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HPOOrderBillNo"]); + oSub.HSeOrderInterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSeOrderInterID"]); + oSub.HSeOrderEntryID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSeOrderEntryID"]); + oSub.HSeOrderBillNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HSeOrderBillNo"]); + oSub.HStockOrgID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HStockOrgID"]); + oSub.HOWNERID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HOWNERID"]); + oSub.HOtherOrgID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HOtherOrgID"]); + oSub.HOWNERTYPEID = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HOWNERTYPEID"]); + BillNew.DetailColl.Add(oSub); + } + } + //淇濆瓨 + bool bResult; + bResult = BillNew.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; //鎴愬姛锛� + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "妯″叿鎶ュ簾鍏ュ簱鍗曚笂浼犲け璐ワ紒" + e.Message; + objJsonResult.data = null; + return objJsonResult; + } + } + + #endregion + + #region 妯″叿鎶ュ簾鍑哄簱鍗� 涓婁紶鐢熷崟 + + /// <summary> + /// 妯″叿鎶ュ簾鍑哄簱鍗曟柊澧炰笂浼� + /// </summary> + /// <returns></returns> + [Route("MouldController/set_SaveMouldScrapOutBill_Json")] + [HttpPost] + public object set_SaveMouldScrapOutBill_Json([FromBody] JObject oMain) + { + BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew; + DAL.ClsSc_MouldScrapOutBill BillNew = new DAL.ClsSc_MouldScrapOutBill(); + var _value = oMain["oMain"].ToString(); + string msg1 = _value.ToString(); + try + { + string sMainStr = "[" + msg1.ToString() + "]"; + List<Model.ClsSc_MouldStockBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldStockBillMain>>(sMainStr); + + //鍗曟嵁鍙锋槸鍚﹂噸澶� + if (BillNew.IsExistBillNo(ref ClsPub.sExeReturnInfo, mainList[0].HBillNo, BillStatus, mainList[0].HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒"; + objJsonResult.data = null; + return objJsonResult; + } + //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞� + string s = ""; + int sYear = 0; + int sPeriod = 0; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(mainList[0].HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = s; + objJsonResult.data = null; + return objJsonResult; + } + //鍥哄畾璧嬪��================================= + BillNew.omodel.HYear = sYear; + BillNew.omodel.HPeriod = sPeriod; + BillNew.omodel.HBillType = "3832"; + BillNew.omodel.HInterID = mainList[0].HInterID; + BillNew.omodel.HBillNo = mainList[0].HBillNo; + BillNew.omodel.HDate = mainList[0].HDate; + BillNew.omodel.HRemark = mainList[0].HRemark; + BillNew.omodel.HMaker = mainList[0].HMaker; + BillNew.omodel.HSTOCKORGID = mainList[0].HSTOCKORGID; + DBUtility.ClsPub.CurUserName = mainList[0].HMaker; + //==================================================== + BillNew.omodel.HSupID = mainList[0].HSupID; + BillNew.omodel.HSupTypeID = 1; //锛�1 渚涘簲鍟嗐��2 瀹㈡埛銆� 3 杞﹂棿閮ㄩ棬锛� + BillNew.omodel.HEmpID = mainList[0].HEmpID; + BillNew.omodel.HManagerID = mainList[0].HManagerID; + BillNew.omodel.HSecManagerID = mainList[0].HSecManagerID; + BillNew.omodel.HKeeperID = mainList[0].HKeeperID; + BillNew.omodel.HDeptID = mainList[0].HDeptID; + BillNew.omodel.HWHID = mainList[0].HWHID; + BillNew.omodel.HSCWHID = mainList[0].HSCWHID; + BillNew.omodel.HExplanation = mainList[0].HExplanation; + BillNew.omodel.HInnerBillNo = mainList[0].HInnerBillNo; + BillNew.omodel.HRedBlueFlag = mainList[0].HRedBlueFlag; + //瀛愯〃璧嬪�� + ds = oCn.RunProcReturn("exec h_p_Sc_GetMouldStockBill_Temp " + BillNew.omodel.HInterID.ToString() + ",'" + BillNew.omodel.HBillType + "'", "h_p_Sc_GetMouldStockBill_Temp"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鎵爜淇℃伅锛岃鍏堟壂鎻忔潯鐮侊紝纭鏃犺鍚庡啀鎻愪氦锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++) + { + Model.ClsSc_MouldStockBillSub oSub = new Model.ClsSc_MouldStockBillSub(); + //鍥哄畾璧嬪��======================================== + oSub.HEntryID = i + 1; + oSub.HRemark = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HRemark"]); + oSub.HSourceInterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSourceInterID"]); + oSub.HSourceEntryID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSourceEntryID"]); + oSub.HSourceBillType = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HSourceBillType"]); + oSub.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HSourceBillNo"]); + oSub.HRelationQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HRelationQty"]); + oSub.HRelationMoney = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HRelationMoney"]); + //============================= + oSub.HMaterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HMaterID"]); + oSub.HPropertyID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HAuxPropID"]); + oSub.HSecUnitID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSecUnitID"]); + oSub.HSecUnitRate = DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[i]["HSecUnitRate"]); + oSub.HUnitID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HUnitID"]); + oSub.HBatchNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HBatchNo"]); + oSub.HQtyMust = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HQtyMust"]); + oSub.HQtyRel = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HQtyRel"]); + oSub.HQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HQty"]); + oSub.HPrice = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HPrice"]); + oSub.HMoney = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HMoney"]); + oSub.HDesignLife = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HDesignLife"]); + oSub.HLeaveLife = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HLeaveLife"]); + oSub.HUseLife = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HUseLife"]); + oSub.HUseLifeQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HUseLifeQty"]); + oSub.HNewLifeQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HNewLifeQty"]); + oSub.HWHID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HWHID"]); + oSub.HSCWHID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSCWHID"]); + oSub.HSPID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSPID"]); + oSub.HSCSPID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSCSPID"]); + oSub.HSPGroupID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSPGroupID"]); + oSub.HBarCode = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HBarCode"]); + oSub.HCorrespondentTypeID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HCorrespondentTypeID"]); + oSub.HCorrespondentID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HCorrespondentID"]); + oSub.HPOOrderInterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HPOOrderInterID"]); + oSub.HPOOrderEntryID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HPOOrderEntryID"]); + oSub.HPOOrderBillNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HPOOrderBillNo"]); + oSub.HSeOrderInterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSeOrderInterID"]); + oSub.HSeOrderEntryID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSeOrderEntryID"]); + oSub.HSeOrderBillNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HSeOrderBillNo"]); + oSub.HStockOrgID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HStockOrgID"]); + oSub.HOWNERID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HOWNERID"]); + oSub.HOtherOrgID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HOtherOrgID"]); + oSub.HOWNERTYPEID = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HOWNERTYPEID"]); + BillNew.DetailColl.Add(oSub); + } + } + //淇濆瓨 + bool bResult; + bResult = BillNew.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; //鎴愬姛锛� + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "妯″叿鎶ュ簾鍑哄簱鍗曚笂浼犲け璐ワ紒" + e.Message; + objJsonResult.data = null; + return objJsonResult; + } + } + + #endregion + #region 妯″叿璋冩嫧鍗� 涓婁紶鐢熷崟 /// <summary> -- Gitblit v1.9.1