/// <summary> /// Register repair request instrument detail /// </summary> /// <param name="Con">Register condition object</param> /// <returns></returns> public ActionResult IVS110_cmdConfirm_Cont(IVS110ConfirmCond Con) { ObjectResultData res = new ObjectResultData(); try { IVS110_ScreenParameter prm = GetScreenObject <IVS110_ScreenParameter>(); if (prm.ElemInstrument == null) { prm.ElemInstrument = new List <IVS110INST>(); } using (TransactionScope scope = new TransactionScope()) { IInventoryHandler InvH = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler; #region Validating Slip Status List <doInventorySlip> lstInvenSlip = InvH.SearchInventorySlip(prm.SlipNo); if (lstInvenSlip.Count <= 0) { res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4001, null, new string[] { "SlipNo" }); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; return(Json(res)); } if (lstInvenSlip.Count > 0 && lstInvenSlip[0].TransferTypeCode != TransferType.C_INV_TRANSFERTYPE_REPAIR_REQUEST) { res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4018, null, new string[] { "SlipNo" }); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; return(Json(res)); } if (lstInvenSlip.Count > 0 && lstInvenSlip[0].SlipStatus == InventorySlipStatus.C_INV_SLIP_STATUS_COMPLETE) { res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4012, new string[] { prm.SlipNo }, new string[] { "SlipNo" }); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; return(Json(res)); } #endregion //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_REQUEST; i.DestinationLocationCode = InstrumentLocation.C_INV_LOC_REPAIRING; //4.6.3 InvH.UpdateAccountTransferNewInstrument(i, null); } } //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_REQUEST; i.DestinationLocationCode = InstrumentLocation.C_INV_LOC_REPAIRING; //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_REQUEST; i.DestinationLocationCode = InstrumentLocation.C_INV_LOC_REPAIRING; //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 IVS110_cmdConfirm(IVS110ConfirmCond Con) { ObjectResultData res = new ObjectResultData(); try { IVS110_ScreenParameter prm = GetScreenObject <IVS110_ScreenParameter>(); if (prm.ElemInstrument == null) { prm.ElemInstrument = new List <IVS110INST>(); } 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_REQUEST_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 (IVS110INST i in prm.ElemInstrument) { doCheckTransferQty chk = new doCheckTransferQty(); chk.OfficeCode = prm.office.OfficeCode; chk.LocationCode = InstrumentLocation.C_INV_LOC_REPAIR_REQUEST; 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)); } }