/// <summary> /// Register repair request instrument detail /// </summary> /// <param name="Con">Register condition object</param> /// <returns></returns> public ActionResult IVS130_cmdConfirm_Cont(IVS130ConfirmCond Con) { ObjectResultData res = new ObjectResultData(); try { IVS130_ScreenParameter prm = GetScreenObject <IVS130_ScreenParameter>(); if (prm.ElemInstrument == null) { prm.ElemInstrument = new List <IVS130INST>(); } using (TransactionScope scope = new TransactionScope()) { IInventoryHandler InvH = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler; //4.5 InvH.RegisterReceiveInstrument(prm.SlipNo, string.Empty); //4.6 if (InvH.CheckNewInstrument(prm.SlipNo) == 1) { //4.6.1 List <doGroupNewInstrument> lstGroupNewInstrument = InvH.GetGroupNewInstrument(prm.SlipNo); //4.6.2 foreach (doGroupNewInstrument i in lstGroupNewInstrument) { i.SourceLocationCode = InstrumentLocation.C_INV_LOC_REPAIR_RETURN; i.DestinationLocationCode = InstrumentLocation.C_INV_LOC_RETURNED; //4.6.3 #region Monthly Price @ 2015 //decimal decMovingAveragePrice = InvH.CalculateMovingAveragePrice(i); var slip = InvH.GetTbt_InventorySlip(prm.SlipNo); decimal decMovingAveragePrice = InvH.GetMonthlyAveragePrice(i.Instrumentcode, (slip == null || slip.Count <= 0 ? null : slip[0].SlipIssueDate), InventoryAccountCode.C_INV_ACCOUNT_CODE_INSTOCK, SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_LOCAL, SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US); #endregion InvH.UpdateAccountTransferNewInstrument(i, Convert.ToDecimal(decMovingAveragePrice)); } } //4.7 if (InvH.CheckSecondhandInstrument(prm.SlipNo) == 1) { //4.7.1 List <doGroupSecondhandInstrument> lstGroupSecondhandInstrument = InvH.GetGroupSecondhandInstrument(prm.SlipNo); //4.7.2 foreach (doGroupSecondhandInstrument i in lstGroupSecondhandInstrument) { i.SourceLocationCode = InstrumentLocation.C_INV_LOC_REPAIR_RETURN; i.DestinationLocationCode = InstrumentLocation.C_INV_LOC_RETURNED; //4.7.2.1 InvH.UpdateAccountTransferSecondhandInstrument(i); } } //4.8 if (InvH.CheckSampleInstrument(prm.SlipNo) == 1) { //4.8.1 List <doGroupSampleInstrument> lstGroupSampleInstrument = InvH.GetGroupSampleInstrument(prm.SlipNo); //4.8.2 foreach (doGroupSampleInstrument i in lstGroupSampleInstrument) { i.SourceLocationCode = InstrumentLocation.C_INV_LOC_REPAIR_RETURN; i.DestinationLocationCode = InstrumentLocation.C_INV_LOC_RETURNED; //4.8.2.1 InvH.UpdateAccountTransferSampleInstrument(i, null); } } scope.Complete(); } res.ResultData = MessageUtil.GetMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4019); return(Json(res)); } catch (Exception ex) { res.AddErrorMessage(ex); return(Json(res)); } }
/// <summary> /// Validate Register repair request instrument detail /// </summary> /// <param name="Con">Register condition object</param> /// <returns></returns> public ActionResult IVS130_cmdConfirm(IVS130ConfirmCond Con) { ObjectResultData res = new ObjectResultData(); try { IVS130_ScreenParameter prm = GetScreenObject <IVS130_ScreenParameter>(); if (prm.ElemInstrument == null) { prm.ElemInstrument = new List <IVS130INST>(); } prm.ElemInstrument = Con.StockInInstrument; //4.1 ICommonHandler ComH = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; if (ComH.IsSystemSuspending()) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); res.ResultData = true; return(Json(res)); } if (!CheckUserPermission(ScreenID.C_INV_SCREEN_ID_REPAIR_RETURN_RECEIVE, FunctionID.C_FUNC_ID_OPERATE)) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); res.ResultData = true; return(Json(res)); } IInventoryHandler InvH = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler; //4.2.1 List <tbt_InventorySlip> lstInventorySlip = InvH.GetTbt_InventorySlip(prm.SlipNo); //4.2.2 if (lstInventorySlip.Count > 0 && lstInventorySlip[0].SlipStatus == InventorySlipStatus.C_INV_SLIP_STATUS_COMPLETE) { res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4012, new string[] { prm.SlipNo }); res.ResultData = true; return(Json(res)); } //4.2.3 foreach (IVS130INST i in prm.ElemInstrument) { doCheckTransferQty chk = new doCheckTransferQty(); chk.OfficeCode = prm.office.OfficeCode; chk.LocationCode = InstrumentLocation.C_INV_LOC_REPAIR_RETURN; chk.AreaCode = i.DestinationAreaCode; chk.ShelfNo = i.DestinationShelfNo; chk.InstrumentCode = i.InstrumentCode; chk.TransferQty = i.TransferQty == null ? 0 : Convert.ToInt32(i.TransferQty); doCheckTransferQtyResult TransferQtyResult = InvH.CheckTransferQty(chk); //4.2.3 if (TransferQtyResult.OverQtyFlag == null) { res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4009, new string[] { i.InstrumentCode }); res.ResultData = i.row_id; i.IsError = true; return(Json(res)); } else if (TransferQtyResult.OverQtyFlag == true) { res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4008, new string[] { i.InstrumentCode }); res.ResultData = i.row_id; i.IsError = true; return(Json(res)); } } return(Json(res)); } catch (Exception ex) { res.AddErrorMessage(ex); return(Json(res)); } }