protected void cmdSelect_ServerClick(object sender, System.EventArgs e) { if (_facade == null) { _facade = new MOFacade(base.DataProvider); } ArrayList array = this.gridHelper.GetCheckedRows(); if (array.Count > 0) { foreach (Infragistics.WebUI.UltraWebGrid.UltraGridRow row in array) { MO2Route mo2Route = new MO2Route(); mo2Route.RouteCode = row.Cells[1].Text; mo2Route.IsMainRoute = row.Cells[2].Text; mo2Route.RouteType = row.Cells[3].Text; mo2Route.MOCode = this.GetMOCode(); mo2Route.MaintainUser = this.GetUserCode(); // TODO:需要重做 mo2Route.OPBOMCode = "~"; mo2Route.OPBOMVersion = "~"; try { this._facade.AddMORoute(mo2Route); } catch { } } this.RequestData(); } }
// Added by Icyer 2006/12/15 // 检查工单 private Messages CheckMO(object act) { Messages msgs = new Messages(); BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider domainProvider = null; if ((act as IDCTClient).DBConnection != null) { domainProvider = (act as IDCTClient).DBConnection as BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider; } else { domainProvider = Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider() as BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider; (act as IDCTClient).DBConnection = domainProvider; } MOFacade moFacade = new MOFacade(domainProvider); MO mo = (MO)moFacade.GetMO(act.ToString().ToUpper()); if (mo == null) { msgs.Add(new UserControl.Message(MessageType.Error, "$CS_MO_NOT_EXIST")); ProcessBeforeReturn(this.Status, msgs); return(msgs); } if (mo.MOStatus != BenQGuru.eMES.Web.Helper.MOManufactureStatus.MOSTATUS_RELEASE && mo.MOStatus != BenQGuru.eMES.Web.Helper.MOManufactureStatus.MOSTATUS_OPEN) { msgs.Add(new UserControl.Message(MessageType.Error, "$Error_CS_MO_Should_be_Release_or_Open")); ProcessBeforeReturn(this.Status, msgs); return(msgs); } MO2Route route = (MO2Route)moFacade.GetMONormalRouteByMOCode(mo.MOCode); if (route == null) { msgs.Add(new UserControl.Message(MessageType.Error, "$CS_MOnotNormalRoute")); ProcessBeforeReturn(this.Status, msgs); return(msgs); } DataCollectFacade dataCollectFacade = new DataCollectFacade(domainProvider); ItemRoute2OP op = dataCollectFacade.GetMORouteFirstOP(mo.MOCode, route.RouteCode); BenQGuru.eMES.BaseSetting.BaseModelFacade dataModel = new BenQGuru.eMES.BaseSetting.BaseModelFacade(domainProvider); if (dataModel.GetOperation2Resource(op.OPCode, (act as IDCTClient).ResourceCode) == null) { msgs.Add(new UserControl.Message(MessageType.Error, "$CS_Route_Failed_FirstOP $Domain_MO =" + mo.MOCode)); ProcessBeforeReturn(this.Status, msgs); return(msgs); } ProcessBeforeReturn(this.Status, msgs); return(msgs); }
public Messages CheckIn(ActionEventArgs actionEventArgs) { ((GoToMOActionEventArgs)actionEventArgs).PassCheck = true; Messages messages = new Messages(); DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "GetIDInfo"); dataCollectDebug.WhenFunctionIn(messages); try { DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider); MOFacade moFacade = new MOFacade(this.DataProvider); MOLotFacade moLotFacade = new MOLotFacade(this.DataProvider); BaseModelFacade dataModel = new BaseModelFacade(this.DataProvider); ModelFacade mf = new ModelFacade(this.DataProvider); SystemSettingFacade systemFacade = new SystemSettingFacade(this.DataProvider); //AMOI MARK START 20050803 序号默认为初始,FOR 重工序列号重复 actionEventArgs.ProductInfo.NowSimulation.LotSeq = ActionOnLineHelper.StartSeq; //AMOI MARK END if (((GoToMOActionEventArgs)actionEventArgs).MOCode == null || ((GoToMOActionEventArgs)actionEventArgs).MOCode.Trim() == string.Empty) { throw new Exception("$CS_Sys_GoToMO_Lost_MOParam"); } #region 检查途程 MO mo = null; if (actionEventArgs.CurrentMO != null) { mo = actionEventArgs.CurrentMO; } else { mo = (MO)moFacade.GetMO(((GoToMOActionEventArgs)actionEventArgs).MOCode); actionEventArgs.CurrentMO = mo; } if (mo == null) { throw new Exception("$CS_MO_Not_Exit"); } MO2Route route = (MO2Route)moFacade.GetMONormalRouteByMOCode(mo.MOCode); if (route == null) { throw new Exception("$CS_MOnotNormalRoute"); } ItemRoute2OP op = dataCollectFacade.GetMORouteFirstOP(mo.MOCode, route.RouteCode); if (dataModel.GetOperation2Resource(op.OPCode, actionEventArgs.ResourceCode) == null) { throw new Exception("$CS_Route_Failed_FirstOP $Domain_MO =" + mo.MOCode); } #endregion #region 检查工单 //工单状态检查 if (!dataCollectFacade.CheckMO(mo)) { throw new Exception("$CS_MO_Status_Error $CS_Param_MOStatus=$" + mo.MOStatus); } /*1.Simulation 没有记录 * a. MO Running Card 没有重复 OK * b. MO Running Card 有重复 Exception * * 2. Simulation 有记录 * a. Simulation 工单 和 当前工单 一样 OK * b. Simulation 工单 和 当前工单 不一样 * b1. 当前工单 是重工工单 * b11. MO Running Card 没有重复 OK * b12. MO Running Card 有重复 Exception * b2. 当前工单不是重工工单 Exception * */ Parameter parameter = (Parameter)systemFacade.GetParameter(mo.MOType, BenQGuru.eMES.Web.Helper.MOType.GroupType); if (parameter == null) { throw new Exception("$CS_MOType_Lost"); } mo.MOType = parameter.ParameterValue; if (actionEventArgs.ProductInfo.LastSimulation != null) { //归属工单和归属工序相同也不允许 if ((mo.MOCode == actionEventArgs.ProductInfo.LastSimulation.MOCode)) { ((GoToMOActionEventArgs)actionEventArgs).PassCheck = false; return(messages); } //Laws Lu,2005/10/20,修改 Lucky的需求 CS112 //建议返工工单归属采集时增加判断条件,也就是说只有没有在制记录的或者已经拆解的产品序列号才能归属返工工单 if (actionEventArgs.ProductInfo.LastSimulation.IsComplete == "0") { throw new Exception("$CS_PRODUCT_STILL_INLINE_NOT_BELONG_MO ,$CS_Param_ID=" + actionEventArgs.LotCode); } } // 投入量检查 if (mo.IsControlInput == "1") // 客户在工单中勾选了“限制投入量”则检查工单可投入量,否则不检查 { if (mo.MOPlanQty - mo.MOInputQty + mo.MOScrapQty + mo.MOOffQty - mo.IDMergeRule < 0) { throw new Exception("$CS_MOInputOut $Domain_MO =" + mo.MOCode); } } #endregion #region 检查库房状态 if (System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"] != null && System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"].Trim() == "1") { Material.WarehouseFacade wFAC = new BenQGuru.eMES.Material.WarehouseFacade(DataProvider); //读资源对应的产线 BenQGuru.eMES.BaseSetting.BaseModelFacade facade = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider); object objResource = facade.GetResource(actionEventArgs.ResourceCode); string strSSCode = ((BenQGuru.eMES.Domain.BaseSetting.Resource)objResource).StepSequenceCode; object obj = wFAC.GetWarehouseByMoSS(mo.MOCode, strSSCode); if (obj != null) { Domain.Warehouse.Warehouse wh = obj as Domain.Warehouse.Warehouse; //Laws Lu,2006/02/20,修改/无需工段代码 string strStatus = wFAC.GetWarehouseStatus(wh.WarehouseCode, wh.FactoryCode); if (strStatus == Domain.Warehouse.Warehouse.WarehouseStatus_Cycle) { throw new Exception("$CS_LINE_IS_HOLD"); } } } #endregion #region 填写新SIMULATION 归属工单 批次数量从tblmo2lotlink 中获取 Domain.MOModel.MO2LotLink mo2lotlink = moLotFacade.GetMO2LotLink(actionEventArgs.LotCode, mo.MOCode) as Domain.MOModel.MO2LotLink; if (mo2lotlink != null) { if (mo2lotlink.LotStatus != LotStatusForMO2LotLink.LOTSTATUS_STOP) { mo2lotlink.LotStatus = LotStatusForMO2LotLink.LOTSTATUS_USE; moLotFacade.UpdateMO2LotLink(mo2lotlink); actionEventArgs.ProductInfo.NowSimulation.LotQty = mo2lotlink.LotQty; actionEventArgs.ProductInfo.NowSimulation.GoodQty = mo2lotlink.LotQty; actionEventArgs.ProductInfo.NowSimulation.NGQty = 0; } else { throw new Exception("$CS_Mo2LotLink_Error_Status"); } } else { throw new Exception("$CS_Mo2LotLink_Not_Exist"); } //messages.AddMessages( dataCollectFacade.WriteSimulation(id,actionType,resourceCode,userCode,product)); actionEventArgs.ProductInfo.NowSimulation.RouteCode = route.RouteCode; actionEventArgs.ProductInfo.NowSimulation.OPCode = op.OPCode; actionEventArgs.ProductInfo.NowSimulation.LotStatus = LotStatusForMO2LotLink.LOTSTATUS_USE; actionEventArgs.ProductInfo.NowSimulation.LastAction = ActionType.DataCollectAction_GoMO; actionEventArgs.ProductInfo.NowSimulation.ActionList = ";" + ActionType.DataCollectAction_GoMO + ";"; actionEventArgs.ProductInfo.NowSimulation.LotCode = actionEventArgs.LotCode; actionEventArgs.ProductInfo.NowSimulation.MOCode = mo.MOCode; actionEventArgs.ProductInfo.NowSimulation.ItemCode = mo.ItemCode; Model model = mf.GetModelByItemCode(mo.ItemCode); if (model == null) { throw new Exception("$CS_Model_Lost $CS_Param_ItemCode=" + mo.ItemCode); } actionEventArgs.ProductInfo.NowSimulation.ModelCode = model.ModelCode; actionEventArgs.ProductInfo.NowSimulation.IsComplete = ProductComplete.NoComplete; actionEventArgs.ProductInfo.NowSimulation.CollectStatus = CollectStatus.CollectStatus_BEGIN; actionEventArgs.ProductInfo.NowSimulation.ResCode = actionEventArgs.ResourceCode; actionEventArgs.ProductInfo.NowSimulation.ProductStatus = ProductStatus.GOOD; actionEventArgs.ProductInfo.NowSimulation.FromOP = ActionOnLineHelper.StringNull; actionEventArgs.ProductInfo.NowSimulation.FromRoute = ActionOnLineHelper.StringNull; actionEventArgs.ProductInfo.NowSimulation.CartonCode = ActionOnLineHelper.StringNull; actionEventArgs.ProductInfo.NowSimulation.LotNo = ActionOnLineHelper.StringNull; actionEventArgs.ProductInfo.NowSimulation.PalletCode = ActionOnLineHelper.StringNull; actionEventArgs.ProductInfo.NowSimulation.NGTimes = ActionOnLineHelper.StartNGTimes; actionEventArgs.ProductInfo.NowSimulation.ProductStatus = ProductStatus.GOOD; actionEventArgs.ProductInfo.NowSimulation.LotStatus = LotStatusForMO2LotLink.LOTSTATUS_USE; actionEventArgs.ProductInfo.NowSimulation.IsHold = 0; actionEventArgs.ProductInfo.NowSimulation.MOSeq = (int)mo.MOSeq; // Added by Icyer 2007/07/03 //update by andy.xin rmaBillCode //actionEventArgs.ProductInfo.NowSimulation.RMABillCode = rmaBillCode; //mo.RMABillCode; #endregion } catch (Exception e) { messages.Add(new Message(e)); } dataCollectDebug.WhenFunctionOut(messages); return(messages); }
private void SetEditObject(object obj) { if (_facade == null) { _facade = new MOFacade(base.DataProvider); } if (obj == null) { this.txtFactoryEdit.Text = string.Empty; this.txtMOEdit.Text = string.Empty; this.txtItemCodeEdit.Text = string.Empty; this.drpMOTypeEdit.SelectedIndex = 0; this.drpMOStatusEdit.SelectedIndex = 0; this.txtCustomerCodeEdit.Text = string.Empty; this.txtCustomerOrderNOEdit.Text = string.Empty; this.txtMemo.Text = string.Empty; this.drpRouteEdit.SelectedIndex = 0; this.chbLimitItemQtyEdit.Checked = false; this.txtMOQtyEdit.Text = string.Empty; this.txtInputQtyEdit.Text = string.Empty; this.txtCompleteQtyEdit.Text = string.Empty; this.txtUnCompleteQtyEdit.Text = string.Empty; this.txtPlanStartDateEdit.Text = string.Empty; this.txtPlanEndDateEdit.Text = string.Empty; this.txtActualStartDateEdit.Text = string.Empty; this.txtActualEndDateEdit.Text = string.Empty; this.txtMOUserEdit.Text = string.Empty; this.txtMODownloadDateEdit.Text = string.Empty; this.txtScrapeQtyEdit.Text = string.Empty; this.txtDenominatorEdit.Text = string.Empty; this.lblCompareBOMInformation.Text = string.Empty; this.txtMaintainUser.Text = string.Empty; this.txtMaintainDate.Text = string.Empty; this.txtPendingCause.Text = string.Empty; this.txtRMABillNo.Text = string.Empty; this.txtMOBomEdit.Text = string.Empty; this.txtMORemarkEdit.Text = string.Empty; return; } this.txtFactoryEdit.Text = ((MO)obj).Factory.ToString(); this.txtMOEdit.Text = ((MO)obj).MOCode.ToString(); this.txtItemCodeEdit.Text = ((MO)obj).ItemCode.ToString(); try { this.drpMOTypeEdit.SelectedValue = ((MO)obj).MOType.ToString(); } catch { this.drpMOTypeEdit.SelectedIndex = 0; } try { this.drpMOStatusEdit.SelectedValue = ((MO)obj).MOStatus.ToString(); } catch { this.drpMOStatusEdit.SelectedIndex = 0; } this.txtCustomerCodeEdit.Text = ((MO)obj).CustomerCode.ToString(); this.txtCustomerOrderNOEdit.Text = ((MO)obj).CustomerOrderNO.ToString(); this.txtMemo.Text = ((MO)obj).MOMemo.ToString(); this.chbLimitItemQtyEdit.Checked = FormatHelper.StringToBoolean(((MO)obj).IsControlInput); this.txtMOQtyEdit.Text = ((MO)obj).MOPlanQty.ToString(); this.txtScrapeQtyEdit.Text = ((MO)obj).MOScrapQty.ToString(); this.txtInputQtyEdit.Text = ((MO)obj).MOInputQty.ToString(); this.txtCompleteQtyEdit.Text = ((MO)obj).MOActualQty.ToString(); Decimal unCompleteQty = ((MO)obj).MOInputQty - ((MO)obj).MOActualQty - ((MO)obj).MOScrapQty - ((MO)obj).MOOffQty; this.txtUnCompleteQtyEdit.Text = unCompleteQty.ToString(); this.txtOffMOQtyEdit.Text = ((MO)obj).MOOffQty.ToString(); this.txtPlanStartDateEdit.Text = FormatHelper.ToDateString(((MO)obj).MOPlanStartDate); this.txtPlanEndDateEdit.Text = FormatHelper.ToDateString(((MO)obj).MOPlanEndDate); // this.txtActualStartDateEdit.Text = FormatHelper.ToDateString( ((MO)obj).MOActualStartDate ); // this.txtActualEndDateEdit.Text = FormatHelper.ToDateString( ((MO)obj).MOActualEndDate ); this.txtActualStartDateEdit.Text = (((MO)obj).MOActualStartDate > 20000101 && ((MO)obj).MOActualStartDate < 21001231) ? FormatHelper.ToDateString(((MO)obj).MOActualStartDate) : ""; //modify by Simone this.txtActualEndDateEdit.Text = (((MO)obj).MOActualEndDate > 20000101 && ((MO)obj).MOActualEndDate < 21001231) ? FormatHelper.ToDateString(((MO)obj).MOActualEndDate) : ""; this.txtMOUserEdit.Text = ((MO)obj).MOUser.ToString(); this.txtMODownloadDateEdit.Text = FormatHelper.ToDateString(((MO)obj).MODownloadDate); this.txtDenominatorEdit.Text = ((MO)obj).IDMergeRule.ToString(); this.txtMaintainUser.Text = ((MO)obj).MaintainUser; this.txtMaintainDate.Text = FormatHelper.ToDateString(((MO)obj).MaintainDate); this.txtPendingCause.Text = ((MO)obj).MOPendingCause; this.txtBIOSVersion.Text = ((MO)obj).MOBIOSVersion.ToString(); this.txtPCBAVersion.Text = ((MO)obj).MOPCBAVersion.ToString(); this.txtRMABillNo.Text = ((MO)obj).RMABillCode.ToString(); this.txtMOBomEdit.Text = ((MO)obj).BOMVersion.ToString(); this.txtMORemarkEdit.Text = ((MO)obj).MORemark.ToString(); if (((MO)obj).IsCompareSoft == 1) { this.chbBIOSVersion.Checked = true; } //bom compare information if (((MO)obj).IsBOMPass == IsPass.ISPASS_PASS.ToString()) { this.lblCompareBOMInformation.Text = this.languageComponent1.GetString("$MSG_BOMComparePass"); } else { if (((MO)obj).IsBOMPass == IsPass.ISPASS_NOPASS.ToString()) { this.lblCompareBOMInformation.Text = this.languageComponent1.GetString("$MSG_BOMCompareNOPass"); } else { this.lblCompareBOMInformation.Text = string.Empty; } } //moroute MO2Route currentMO2Route = (MO2Route)this._facade.GetMONormalRouteByMOCode(((MO)obj).MOCode); if (currentMO2Route != null) { try { this.drpRouteEdit.SelectedValue = FormatHelper.CleanString(currentMO2Route.RouteCode); } catch { this.drpRouteEdit.SelectedIndex = 0; } } else { //2006/09/27 Laws Lu,修改 支持默认途程 object objDRoute = this._facade.GetDefaultItem2Route(((MO)obj).ItemCode); if (objDRoute != null) { try { this.drpRouteEdit.SelectedValue = FormatHelper.CleanString(((DefaultItem2Route)objDRoute).RouteCode); } catch { this.drpRouteEdit.SelectedIndex = 0; } } else { this.drpRouteEdit.SelectedIndex = 0; } } }