|  |  |  | 
|---|
|  |  |  | BillNew.omodel.HEmpID = 0; | 
|---|
|  |  |  | BillNew.omodel.HManagerID = mainList[0].HManagerID; | 
|---|
|  |  |  | BillNew.omodel.HSecManagerID = mainList[0].HSecManagerID; | 
|---|
|  |  |  | BillNew.omodel.HKeeperID = mainList[0].HSecManagerID; | 
|---|
|  |  |  | BillNew.omodel.HDeptID = mainList[0].HSecManagerID; | 
|---|
|  |  |  | BillNew.omodel.HKeeperID = mainList[0].HKeeperID; | 
|---|
|  |  |  | BillNew.omodel.HDeptID = mainList[0].HDeptID; | 
|---|
|  |  |  | BillNew.omodel.HExplanation = mainList[0].HExplanation; | 
|---|
|  |  |  | BillNew.omodel.HInnerBillNo = mainList[0].HInnerBillNo; | 
|---|
|  |  |  | BillNew.omodel.HRedBlueFlag = mainList[0].HRedBlueFlag; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region 模具寿命调整单 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region 模具寿命调整单保存 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | [Route("Sc_MouldLifeChangeBill/MouldLifeChangeBill_Save")] | 
|---|
|  |  |  | [HttpPost] | 
|---|
|  |  |  | public object MouldLifeChangeBill_Save([FromBody] JObject sMainSub) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var _value = sMainSub["sMainSub"].ToString(); | 
|---|
|  |  |  | string msg1 = _value.ToString(); | 
|---|
|  |  |  | return objJsonResult = MouldLifeChangeAddBill(msg1); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public json MouldLifeChangeAddBill(string msg1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | bool bResult; | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | msg1 = "[" + msg1.ToString() + "]"; | 
|---|
|  |  |  | DAL.ClsSc_MouldLifeChangeBill BillNew = new DAL.ClsSc_MouldLifeChangeBill(); | 
|---|
|  |  |  | List<Model.ClsSc_MouldLifeChangeBillMain> mainList = Newtonsoft | 
|---|
|  |  |  | .Json | 
|---|
|  |  |  | .JsonConvert | 
|---|
|  |  |  | .DeserializeObject<List<Model.ClsSc_MouldLifeChangeBillMain>>(msg1); | 
|---|
|  |  |  | List<Model.ClsSc_MouldLifeChangeBillSub> subList = Newtonsoft | 
|---|
|  |  |  | .Json | 
|---|
|  |  |  | .JsonConvert | 
|---|
|  |  |  | .DeserializeObject<List<Model.ClsSc_MouldLifeChangeBillSub>>(msg1); | 
|---|
|  |  |  | string s = ""; | 
|---|
|  |  |  | int sYear = 0; | 
|---|
|  |  |  | int sPeriod = 0; | 
|---|
|  |  |  | DateTime HDate = mainList[0].HDate; | 
|---|
|  |  |  | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(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.HBillNo = mainList[0].HBillNo.Trim(); | 
|---|
|  |  |  | BillNew.omodel.HMaker = mainList[0].HMaker; | 
|---|
|  |  |  | BillNew.omodel.HDate = HDate; | 
|---|
|  |  |  | BillNew.omodel.HRemark = mainList[0].HRemark; | 
|---|
|  |  |  | BillNew.omodel.HMangerID = mainList[0].HMangerID; | 
|---|
|  |  |  | BillNew.omodel.HEmpID = mainList[0].HEmpID; | 
|---|
|  |  |  | BillNew.omodel.HDeptID = mainList[0].HDeptID; | 
|---|
|  |  |  | BillNew.omodel.HReason = mainList[0].HReason; | 
|---|
|  |  |  | BillNew.omodel.HExplanation = mainList[0].HExplanation; | 
|---|
|  |  |  | BillNew.omodel.HInnerBillNo = mainList[0].HInnerBillNo; | 
|---|
|  |  |  | BillNew.DetailColl = new List<Model.ClsSc_MouldLifeChangeBillSub>(); | 
|---|
|  |  |  | Model.ClsSc_MouldLifeChangeBillSub oSub = new Model.ClsSc_MouldLifeChangeBillSub(); | 
|---|
|  |  |  | oSub.HEntryID = 1; | 
|---|
|  |  |  | oSub.HRemark = DBUtility.ClsPub.isStrNull(subList[0].HRemark); | 
|---|
|  |  |  | oSub.HSourceInterID = DBUtility.ClsPub.isLong(subList[0].HSourceInterID); | 
|---|
|  |  |  | oSub.HSourceEntryID = DBUtility.ClsPub.isLong(subList[0].HSourceEntryID); | 
|---|
|  |  |  | oSub.HSourceBillType = DBUtility.ClsPub.isStrNull(subList[0].HSourceBillType); | 
|---|
|  |  |  | oSub.HSourceBillNo = DBUtility.ClsPub.isStrNull(subList[0].HSourceBillNo); | 
|---|
|  |  |  | oSub.HRelationQty = DBUtility.ClsPub.isDoule(subList[0].HRelationQty); | 
|---|
|  |  |  | oSub.HRelationMoney = DBUtility.ClsPub.isDoule(subList[0].HRelationMoney); | 
|---|
|  |  |  | oSub.HCloseMan = DBUtility.ClsPub.isStrNull(subList[0].HCloseMan); | 
|---|
|  |  |  | oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(subList[0].HEntryCloseDate); | 
|---|
|  |  |  | oSub.HCloseType = DBUtility.ClsPub.isBool(subList[0].HCloseType); | 
|---|
|  |  |  | oSub.HMaterID = DBUtility.ClsPub.isLong(subList[0].HMaterID); | 
|---|
|  |  |  | oSub.HPropertyID = DBUtility.ClsPub.isLong(subList[0].HPropertyID); | 
|---|
|  |  |  | oSub.HSecUnitID = DBUtility.ClsPub.isLong(subList[0].HSecUnitID); | 
|---|
|  |  |  | oSub.HSecUnitRate = DBUtility.ClsPub.isSingle(subList[0].HSecUnitRate); | 
|---|
|  |  |  | oSub.HLeaveLife = DBUtility.ClsPub.isSingle(subList[0].HLeaveLife); | 
|---|
|  |  |  | oSub.HDesignLife = DBUtility.ClsPub.isSingle(subList[0].HDesignLife); | 
|---|
|  |  |  | oSub.HNewLeaveLife = DBUtility.ClsPub.isSingle(subList[0].HNewLeaveLife); | 
|---|
|  |  |  | if (oSub.HDesignLife < 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "设计寿命不能为0或者小于0"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (oSub.HLeaveLife < 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "剩余寿命不能为0或者小于0"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | oSub.HSourceInterID = DBUtility.ClsPub.isLong(subList[0].HSourceInterID); | 
|---|
|  |  |  | oSub.HSourceEntryID = DBUtility.ClsPub.isLong(subList[0].HSourceEntryID); | 
|---|
|  |  |  | oSub.HSourceBillNo = DBUtility.ClsPub.isStrNull(subList[0].HSourceBillNo); | 
|---|
|  |  |  | oSub.HSourceBillType = DBUtility.ClsPub.isStrNull(subList[0].HSourceBillType); | 
|---|
|  |  |  | oSub.HRelationQty = DBUtility.ClsPub.isDoule(subList[0].HRelationQty); | 
|---|
|  |  |  | oSub.HRelationMoney = DBUtility.ClsPub.isDoule(subList[0].HRelationMoney); | 
|---|
|  |  |  | BillNew.DetailColl.Add(oSub); | 
|---|
|  |  |  | bResult = BillNew.AddBill(ref ClsPub.sExeReturnInfo); | 
|---|
|  |  |  | if (bResult == true) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = ClsPub.sExeReturnInfo + "单据号:" + mainList[0].HBillNo.Trim(); | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "保存失败!原因:" + ClsPub.sExeReturnInfo; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "Exception!" + e.ToString(); | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|