public bool InitWithoutResAndOP(IDomainDataProvider dataProvider, string ssCode, DBDateTime dbDateTime) { bool returnValue = false; BaseModelFacade baseModelFacade = new BaseModelFacade(dataProvider); ShiftModelFacade shiftModelFacade = new ShiftModelFacade(dataProvider); _DataProvider = dataProvider; _DBDateTime = dbDateTime; //获取对应的SS _StepSequence = (StepSequence)baseModelFacade.GetStepSequence(ssCode); if (_StepSequence == null) { return(returnValue); } //获取当前的ShiftDate _ShiftDate = shiftModelFacade.GetShiftDayBySS(_StepSequence, _DBDateTime.DateTime); //获取当前的Shift _Shift = (Shift)shiftModelFacade.GetShift(_StepSequence.ShiftTypeCode, _DBDateTime.DBTime); if (_Shift == null) { return(returnValue); } returnValue = true; return(returnValue); }
protected override bool ValidateInput() { PageCheckManager manager = new PageCheckManager(); manager.Add(new DateCheck(lblDateQuery, DateEdit.Text, true)); manager.Add(new LengthCheck(lblShiftCodeEdit, txtShiftCodeEdit, 40, true)); manager.Add(new LengthCheck(lblCrewCodeEdit, txtCrewCodeEdit, 40, true)); manager.Add(new LengthCheck(lblFACCodeEdit, txtFACCodeEdit, 40, true)); manager.Add(new LengthCheck(lblFirstClassGroup, drpFirstClassEdit, 40, true)); manager.Add(new DecimalCheck(lblDurationEdit, txtDurationEdit, 0, 9999999999, true)); manager.Add(new NumberCheck(lblManCountEdit, txtManCountEdit, 0, 9999999999, true)); if (!manager.Check()) { WebInfoPublish.Publish(this, manager.CheckMessage, this.languageComponent1); return(false); } if (Convert.ToDecimal(this.txtDurationEdit.Text.Trim()) <= 0) { WebInfoPublish.Publish(this, "$Duration_Must_Over_Zero", this.languageComponent1); return(false); } if (Convert.ToDecimal(this.txtManCountEdit.Text.Trim()) <= 0) { WebInfoPublish.Publish(this, "$ManCount_Must_Over_Zero", this.languageComponent1); return(false); } ShiftModelFacade shiftModelFacade = new ShiftModelFacade(this.DataProvider); object shiftObject = shiftModelFacade.GetShift(FormatHelper.CleanString(this.txtShiftCodeEdit.Text.ToUpper())); if (shiftObject == null) { WebInfoPublish.Publish(this, "$Error_Shift_Not_Exist", this.languageComponent1); return(false); } ShiftModel shiftModel = new ShiftModel(this.DataProvider); object crewObject = shiftModel.GetShiftCrew(FormatHelper.CleanString(this.txtCrewCodeEdit.Text.ToUpper())); if (crewObject == null) { WebInfoPublish.Publish(this, "$Error_ShiftCrew_Not_Exist", this.languageComponent1); return(false); } WarehouseFacade warehouseFacade = new WarehouseFacade(this.DataProvider); object facObject = warehouseFacade.GetFactory(FormatHelper.CleanString(this.txtFACCodeEdit.Text.ToUpper())); if (facObject == null) { WebInfoPublish.Publish(this, "$Error_FACCODE_Not_Exist", this.languageComponent1); return(false); } return(true); }
public void ImportMaterialNeed(bool isRollBack) { ShiftModelFacade shiftModelFacade = new ShiftModelFacade(this._DataProvider); DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this._DataProvider); object[] objs = ConvertArrayListToObjectArray(_ImportDataTable); object[] objDt = ConvertArrayListToObjectArray(_ImportDataTable); try { _DataProvider.BeginTransaction(); if (objs != null && objDt != null) { for (int i = 0; i < objs.Length; i++) { try { MaterialReqStd materialReqStd = objs[i] as MaterialReqStd; if (_MaterialFacade == null) { _MaterialFacade = new MaterialFacade(_DataProvider); } object objWorkPlan = _MaterialFacade.GetMaterialReqStd(materialReqStd.ItemCode, materialReqStd.OrganizationID); if (objWorkPlan != null) { _DataProvider.Update(objs[i]); _DataProvider.Update(objDt[i]); } else { _DataProvider.Insert(objDt[i]); } GridRecord row = _ImportGridRow[i] as GridRecord; row.Items.FindItemByKey("ImportResult").Text = _LanguageComponent1.GetString("$CycleImport_Success"); row.Items.FindItemByKey("ImportResult").CssClass = "LinkColorBlue"; } catch (Exception ex) { GridRecord row = _ImportGridRow[i] as GridRecord; row.Items.FindItemByKey("ImportResult").Text = "导入失败"; row.Items.FindItemByKey("ImportResult").CssClass = "ForeColorRed"; this.ErrorArray.Add(ex); } } } _DataProvider.CommitTransaction(); } catch (Exception ex) { _DataProvider.RollbackTransaction(); this.ErrorArray.Add(ex); } }
protected override void SetEditObject(object obj) { if (obj == null) { this.dateDateFrom.Date_String = FormatHelper.ToDateString(FormatHelper.TODateInt(DateTime.Now)); this.txtBigSSCodeGroup.Text = ""; this.txtMactureSeq.Text = ""; this.txtMOEdit.Text = ""; this.txtMOSeqEdit.Text = ""; this.txtPlanInQTYEdit.Text = ""; this.timeFrom.Text = ""; this.txtBigSSCodeGroup.Text = ""; this.txtMat.Text = ""; this.txtAct.Text = ""; this.txtActQty.Text = ""; return; } // 执行状态为“待投产”、“生产中”状态的计划信息可以修改除主键之外的其他信息【包括导入过程中的修改】,如果计划日期早于当前日期,则不允许修改计划信息 ShiftModelFacade shiftModelFacade = new ShiftModelFacade(base.DataProvider); DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(base.DataProvider); int shiftDay = shiftModelFacade.GetShiftDayByBigSSCode(((WorkPlan)obj).BigSSCode, dbDateTime.DateTime); if (((WorkPlan)obj).PlanDate < shiftDay) { WebInfoPublish.PublishInfo(this, "$if_date_cannotmodify", languageComponent1); return; } if (((WorkPlan)obj).ActionStatus == WorkPlanActionStatus.WorkPlanActionStatus_Close) { WebInfoPublish.PublishInfo(this, "$status_error", languageComponent1); return; } this.dateDateFrom.Date_String = FormatHelper.ToDateString(((WorkPlan)obj).PlanDate); this.txtBigSSCodeGroup.Text = ((WorkPlan)obj).BigSSCode; this.txtMactureSeq.Text = ((WorkPlan)obj).PlanSeq.ToString(); this.txtMOEdit.Text = ((WorkPlan)obj).MoCode; this.txtMOSeqEdit.Text = ((WorkPlan)obj).MoSeq.ToString(); this.txtPlanInQTYEdit.Text = ((WorkPlan)obj).PlanQty.ToString(); this.timeFrom.Text = FormatHelper.ToTimeString(((WorkPlan)obj).PlanStartTime); this.txtAct.Text = ((WorkPlan)obj).ActionStatus.ToString(); this.txtMat.Text = ((WorkPlan)obj).MaterialStatus.ToString(); this.txtActQty.Text = ((WorkPlan)obj).ActQty.ToString(); }
protected override void DeleteDomainObjects(ArrayList domainObjects) { if (_Facade == null) { _Facade = new MaterialFacade(base.DataProvider); } ShiftModelFacade shiftModelFacade = new ShiftModelFacade(base.DataProvider); DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(base.DataProvider); List <WorkPlan> mKeyPartList = new List <WorkPlan>(); WorkPlan[] deliveryNotes = (WorkPlan[])domainObjects.ToArray(typeof(WorkPlan)); if (deliveryNotes != null) { this.DataProvider.BeginTransaction(); try { foreach (WorkPlan deliveryNote in deliveryNotes) { int shiftDay = shiftModelFacade.GetShiftDayByBigSSCode(deliveryNote.BigSSCode, dbDateTime.DateTime); if (deliveryNote.PlanDate < shiftDay) { WebInfoPublish.Publish(this, "$if_date_cannotmodify", languageComponent1); return; } if (deliveryNote.ActionStatus == WorkPlanActionStatus.WorkPlanActionStatus_Open || deliveryNote.ActionStatus == WorkPlanActionStatus.WorkPlanActionStatus_Close) { WebInfoPublish.Publish(this, "$STATUS_ERROR_DELETE", languageComponent1); return; } this._Facade.DeleteWorkPlan(deliveryNote); } this.DataProvider.CommitTransaction(); } catch (Exception ex) { this.DataProvider.RollbackTransaction(); ExceptionManager.Raise(deliveryNotes[0].GetType(), "$Error_Delete_Domain_Object", ex); } } }
public bool Init(IDomainDataProvider dataProvider, string resCode, DBDateTime dbDateTime) { bool returnValue = false; BaseModelFacade baseModelFacade = new BaseModelFacade(dataProvider); ShiftModelFacade shiftModelFacade = new ShiftModelFacade(dataProvider); _DataProvider = dataProvider; _ResCode = resCode; _DBDateTime = dbDateTime; //获取对应的OPCode Operation2Resource op2Res = (Operation2Resource)baseModelFacade.GetOperationByResource(_ResCode); if (op2Res != null) { _Operation = (Operation)baseModelFacade.GetOperation(op2Res.OPCode); } if (_Operation == null) { return(returnValue); } //获取对应的SS Resource res = (Resource)baseModelFacade.GetResource(_ResCode); if (res != null) { _StepSequence = (StepSequence)baseModelFacade.GetStepSequence(res.StepSequenceCode); } if (_StepSequence == null) { return(returnValue); } //获取当前的ShiftDate _ShiftDate = shiftModelFacade.GetShiftDayBySS(_StepSequence, _DBDateTime.DateTime); //获取当前的Shift _Shift = (Shift)shiftModelFacade.GetShift(_StepSequence.ShiftTypeCode, _DBDateTime.DBTime); if (_Shift == null) { return(returnValue); } returnValue = true; return(returnValue); }
protected override bool ValidateInput() { PageCheckManager manager = new PageCheckManager(); manager.Add(new DateCheck(lblDateQuery, DateEdit.Text, true)); manager.Add(new LengthCheck(lblSSEdit, txtSSEdit, 40, true)); manager.Add(new LengthCheck(lblShiftCodeEdit, txtShiftCodeEdit, 40, true)); manager.Add(new LengthCheck(lblCrewCodeEdit, txtCrewCodeEdit, 40, true)); if (!manager.Check()) { WebInfoPublish.Publish(this, manager.CheckMessage, this.languageComponent1); return(false); } BaseModelFacade baseModelFacade = new BaseModelFacade(this.DataProvider); object stepSequenceObject = baseModelFacade.GetStepSequence(FormatHelper.CleanString(this.txtSSEdit.Text.ToUpper())); if (stepSequenceObject == null) { WebInfoPublish.Publish(this, "$CS_STEPSEQUENCE_NOT_EXIST", this.languageComponent1); return(false); } ShiftModelFacade shiftModelFacade = new ShiftModelFacade(this.DataProvider); object shiftObject = shiftModelFacade.GetShift(FormatHelper.CleanString(this.txtShiftCodeEdit.Text.ToUpper())); if (shiftObject == null) { WebInfoPublish.Publish(this, "$Error_Shift_Not_Exist", this.languageComponent1); return(false); } ShiftModel shiftModel = new ShiftModel(this.DataProvider); object crewObject = shiftModel.GetShiftCrew(FormatHelper.CleanString(this.txtCrewCodeEdit.Text.ToUpper())); if (crewObject == null) { WebInfoPublish.Publish(this, "$Error_ShiftCrew_Not_Exist", this.languageComponent1); return(false); } return(true); }
public PhysicalLayoutDataPreparationHelper(BenQGuru.eMES.Common.Domain.IDomainDataProvider dataProvider, DropDownList segment, DropDownList stepSequence, DropDownList resource, DropDownList shift) { this._segment = segment; this._stepSequence = stepSequence; this._resource = resource; this._shift = shift; this._facade = new FacadeFactory(dataProvider).CreateBaseModelFacade(); this._shiftfacade = new FacadeFactory(dataProvider).CreateShiftModelFacade(); if (this._segment != null) { this._segment.SelectedIndexChanged += new EventHandler(_segment_SelectedIndexChanged); this._segment.AutoPostBack = true; this._segmentBuilder = new DropDownListBuilder(this._segment); this._segmentBuilder.HandleGetObjectList += new GetObjectListDelegate(this._getSegmentList); } if (this._stepSequence != null) { this._stepSequence.SelectedIndexChanged += new EventHandler(_stepSequence_SelectedIndexChanged); this._stepSequence.AutoPostBack = true; this._stepSequenceBuilder = new DropDownListBuilder(this._stepSequence); this._stepSequenceBuilder.HandleGetObjectList += new GetObjectListDelegate(this._getStepSequenceList); } if (this._resource != null) { this._resourceBuilder = new DropDownListBuilder(this._resource); this._resourceBuilder.HandleGetObjectList += new GetObjectListDelegate(this._getResourceList); } if (this._shift != null) { this._shiftBuilder = new DropDownListBuilder(this._shift); this._shiftBuilder.HandleGetObjectList += new GetObjectListDelegate(this._getShiftList); } }
//保存老化信息 private void SaveBurnWip() { DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider); BaseModelFacade baseModelFacade = new BaseModelFacade(this.DataProvider); ShiftModelFacade shiftModelFacade = new ShiftModelFacade(this.DataProvider); DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); ItemFacade itemFacade = new ItemFacade(this.DataProvider); BurnFacade burnFacade = new BurnFacade(this.DataProvider); //获取时段代码 StepSequence _StepSequence = (StepSequence)baseModelFacade.GetStepSequence(Resource.StepSequenceCode); TimePeriod tp = (TimePeriod)shiftModelFacade.GetTimePeriod(Resource.ShiftTypeCode, dbDateTime.DBTime); BurnWip burnWip = new BurnWip(); string sourceRCard = dataCollectFacade.GetSourceCard(this.txtRunningCard.Value.Trim().ToUpper(), string.Empty); burnWip.RunningCard = sourceRCard; burnWip.MOCode = product.LastSimulation.MOCode; burnWip.ItemCode = this.txtItem.Value; burnWip.SsCode = Resource.StepSequenceCode; burnWip.ResCode = Resource.ResourceCode; if (tp != null) { burnWip.TpCode = tp.TimePeriodCode; burnWip.ShiftDay = shiftModelFacade.GetShiftDay(tp, dbDateTime.DateTime); } burnWip.ProductStatus = ProductStatus.GOOD; if (rdoBurnIn.Checked) { burnWip.Status = BurnType.BurnIn; burnWip.BurnInDate = dbDateTime.DBDate; burnWip.BurnInTime = dbDateTime.DBTime; object objItem = itemFacade.GetItem(this.txtItem.Value, GlobalVariables.CurrentOrganizations.First().OrganizationID); if (objItem != null && ((Item)objItem).BurnUseMinutes.ToString() != "") { burnWip.ForecastOutDate = FormatHelper.TODateInt(dbDateTime.DateTime.AddMinutes(((Item)objItem).BurnUseMinutes)); burnWip.ForecastOutTime = FormatHelper.TOTimeInt(dbDateTime.DateTime.AddMinutes(((Item)objItem).BurnUseMinutes)); } } else { burnWip.Status = BurnType.BurnOut; burnWip.BurnOutDate = dbDateTime.DBDate; burnWip.BurnOutTime = dbDateTime.DBTime; if (rdoNG.Checked) { burnWip.ProductStatus = ProductStatus.NG; } } burnWip.MaintainUser = userCode; burnWip.MaintainDate = dbDateTime.DBDate; burnWip.MaintainTime = dbDateTime.DBTime; object objBurn = burnFacade.GetBurnWip(burnWip.RunningCard, burnWip.MOCode); if (objBurn == null) { burnFacade.AddBurnWip(burnWip); } else { if (((BurnWip)objBurn).Status == BurnType.BurnOut && rdoBurnOut.Checked) //返工或维修回流时,若没有走burn in工序,则预计完成时间更新为系统时间 { burnWip.BurnInDate = dbDateTime.DBDate; burnWip.BurnInTime = dbDateTime.DBTime; burnWip.ForecastOutDate = dbDateTime.DBDate; burnWip.ForecastOutTime = dbDateTime.DBTime; } else { burnWip.BurnInDate = ((BurnWip)objBurn).BurnInDate; burnWip.BurnInTime = ((BurnWip)objBurn).BurnInTime; burnWip.ForecastOutDate = ((BurnWip)objBurn).ForecastOutDate; burnWip.ForecastOutTime = ((BurnWip)objBurn).ForecastOutTime; } burnFacade.UpdateBurnWip(burnWip); } }
private void CheckWorkPlan() { int count = this._ImportDataTable.Rows.Count; Hashtable checkedRow = new Hashtable(); ShiftModelFacade shiftModelFacade = new ShiftModelFacade(this._DataProvider); MaterialFacade materialFacade = new MaterialFacade(this._DataProvider); DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this._DataProvider); for (int i = count - 1; i >= 0; i--) { DataRow row = this._ImportDataTable.Rows[i]; GridRecord gridRow = this._ImportGridRow[i] as GridRecord; string moCode = row["MOCODE"].ToString(); string bigSSCode = row["BIGSSCODE"].ToString(); string planDate = row["PLANDATE"].ToString(); string planSeq = row["PLANSEQ"].ToString(); string moSeq = row["MOSEQ"].ToString(); string planStartTime = (Convert.ToDateTime(row["PLANSTARTTIME"])).ToString("HH:mm:ss"); string planQty = row["PLANQTY"].ToString(); if (string.IsNullOrEmpty(moCode)) { if (!checkedRow.ContainsKey(moCode)) { checkedRow.Add(moCode, false); } gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = _LanguageComponent1.GetString("$CS_MO_NotExit"); gridRow.Items.FindItemByKey("ImportResult").CssClass = "MsgYellow"; this._ImportDataTable.Rows.Remove(row); this._ImportGridRow.Remove(gridRow); continue; } if (string.IsNullOrEmpty(bigSSCode)) { if (!checkedRow.ContainsKey(bigSSCode)) { checkedRow.Add(bigSSCode, false); } gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = _LanguageComponent1.GetString("$BIGSSCODE_IS_NOT_EXIT"); gridRow.Items.FindItemByKey("ImportResult").CssClass = "MsgYellow"; this._ImportDataTable.Rows.Remove(row); this._ImportGridRow.Remove(gridRow); continue; } if (string.IsNullOrEmpty(planDate)) { if (!checkedRow.ContainsKey(planDate)) { checkedRow.Add(planDate, false); } gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = "计划日期不能为空"; gridRow.Items.FindItemByKey("ImportResult").CssClass = "MsgYellow"; this._ImportDataTable.Rows.Remove(row); this._ImportGridRow.Remove(gridRow); continue; } try { DateTime planDateTime = Convert.ToDateTime(FormatHelper.ToDateString(int.Parse(planDate), "-")); } catch { if (!checkedRow.ContainsKey(planDate)) { checkedRow.Add(planDate, false); } gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = "计划日期错误"; gridRow.Items.FindItemByKey("ImportResult").CssClass = "MsgYellow"; this._ImportDataTable.Rows.Remove(row); this._ImportGridRow.Remove(gridRow); continue; } if (string.IsNullOrEmpty(planSeq)) { if (!checkedRow.ContainsKey(planSeq)) { checkedRow.Add(planSeq, false); } gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = "生产顺序不能为空"; gridRow.Items.FindItemByKey("ImportResult").CssClass = "MsgYellow"; this._ImportDataTable.Rows.Remove(row); this._ImportGridRow.Remove(gridRow); continue; } if (string.IsNullOrEmpty(moSeq)) { if (!checkedRow.ContainsKey(moSeq)) { checkedRow.Add(moSeq, false); } gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = "工单项次不能为空"; gridRow.Items.FindItemByKey("ImportResult").CssClass = "MsgYellow"; this._ImportDataTable.Rows.Remove(row); this._ImportGridRow.Remove(gridRow); continue; } if (string.IsNullOrEmpty(planStartTime)) { if (!checkedRow.ContainsKey(planStartTime)) { checkedRow.Add(planStartTime, false); } gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = "计划开始时间不能为空"; gridRow.Items.FindItemByKey("ImportResult").CssClass = "MsgYellow"; this._ImportDataTable.Rows.Remove(row); this._ImportGridRow.Remove(gridRow); continue; } try { int numplanSeq = int.Parse(planSeq); if (numplanSeq < 0) { if (!checkedRow.ContainsKey(planSeq)) { checkedRow.Add(planSeq, false); } gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = "生产顺序不应小于0"; gridRow.Items.FindItemByKey("ImportResult").CssClass = "MsgYellow"; this._ImportDataTable.Rows.Remove(row); this._ImportGridRow.Remove(gridRow); continue; } } catch { if (!checkedRow.ContainsKey(planSeq)) { checkedRow.Add(planSeq, false); } gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = "生产顺序格式错误"; gridRow.Items.FindItemByKey("ImportResult").CssClass = "MsgYellow"; this._ImportDataTable.Rows.Remove(row); this._ImportGridRow.Remove(gridRow); continue; } try { int nummoSeq = int.Parse(moSeq); if (nummoSeq < 0) { if (!checkedRow.ContainsKey(moSeq)) { checkedRow.Add(moSeq, false); } gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = "工单项次不应小于0"; gridRow.Items.FindItemByKey("ImportResult").CssClass = "MsgYellow"; this._ImportDataTable.Rows.Remove(row); this._ImportGridRow.Remove(gridRow); continue; } } catch { if (!checkedRow.ContainsKey(moSeq)) { checkedRow.Add(moSeq, false); } gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = "工单项次格式错误"; gridRow.Items.FindItemByKey("ImportResult").CssClass = "MsgYellow"; this._ImportDataTable.Rows.Remove(row); this._ImportGridRow.Remove(gridRow); continue; } try { decimal numplanQty = decimal.Parse(planQty); if (numplanQty < 0) { if (!checkedRow.ContainsKey(planQty)) { checkedRow.Add(planQty, false); } gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = "计划数量不应小于0"; gridRow.Items.FindItemByKey("ImportResult").CssClass = "MsgYellow"; this._ImportDataTable.Rows.Remove(row); this._ImportGridRow.Remove(gridRow); continue; } } catch { if (!checkedRow.ContainsKey(planQty)) { checkedRow.Add(planQty, false); } gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = "计划数量格式错误"; gridRow.Items.FindItemByKey("ImportResult").CssClass = "MsgYellow"; this._ImportDataTable.Rows.Remove(row); this._ImportGridRow.Remove(gridRow); continue; } //planDate try { int numplanDate = FormatHelper.TODateInt(planDate.Insert(4, "-").Insert(7, "-")); } catch { if (!checkedRow.ContainsKey(planDate)) { checkedRow.Add(planDate, false); } gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = "计划日期格式错误"; gridRow.Items.FindItemByKey("ImportResult").CssClass = "MsgYellow"; this._ImportDataTable.Rows.Remove(row); this._ImportGridRow.Remove(gridRow); continue; } //planStartTime try { int numplanStartTime = FormatHelper.TOTimeInt(planStartTime.ToString()); } catch { if (!checkedRow.ContainsKey(planStartTime)) { checkedRow.Add(planStartTime, false); } gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = "计划开始时间格式错误"; gridRow.Items.FindItemByKey("ImportResult").CssClass = "MsgYellow"; this._ImportDataTable.Rows.Remove(row); this._ImportGridRow.Remove(gridRow); continue; } int shiftDay = shiftModelFacade.GetShiftDayByBigSSCode(bigSSCode, dbDateTime.DateTime); object[] objs = _DataProvider.CustomQuery(typeof(BenQGuru.eMES.Domain.MOModel.Model), new SQLParamCondition(@"select mocode from tblmo where 1=1 " + GlobalVariables.CurrentOrganizations.GetSQLCondition() + @" and mocode=$MOCODE", new SQLParameter[] { new SQLParameter("$MOCODE", typeof(string), moCode.ToUpper()) })); if (objs == null) { if (!checkedRow.ContainsKey(moCode)) { checkedRow.Add(moCode, false); } gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = _LanguageComponent1.GetString("$CS_MO_NotExit"); gridRow.Items.FindItemByKey("ImportResult").CssClass = "MsgYellow"; this._ImportDataTable.Rows.Remove(row); this._ImportGridRow.Remove(gridRow); continue; } object[] objss = _DataProvider.CustomQuery(typeof(BenQGuru.eMES.Domain.BaseSetting.StepSequence), new SQLParamCondition(@"select distinct bigsscode from tblss where 1=1 " + GlobalVariables.CurrentOrganizations.GetSQLCondition() + @" and bigsscode=$BIGSSCODE", new SQLParameter[] { new SQLParameter("$BIGSSCODE", typeof(string), bigSSCode.ToUpper()) })); if (objss == null) { if (!checkedRow.ContainsKey(bigSSCode)) { checkedRow.Add(bigSSCode, false); } gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = _LanguageComponent1.GetString("$BIGSSCODE_IS_NOT_EXIT"); gridRow.Items.FindItemByKey("ImportResult").CssClass = "MsgYellow"; this._ImportDataTable.Rows.Remove(row); this._ImportGridRow.Remove(gridRow); continue; } if (_MaterialFacade == null) { _MaterialFacade = new MaterialFacade(_DataProvider); } object objWorkPlanFromDB = _MaterialFacade.GetWorkPlan(bigSSCode, int.Parse(planDate), moCode, decimal.Parse(moSeq)); if (objWorkPlanFromDB != null) { //修改的投入数量必须大于等于实际数量 if (decimal.Parse(planQty) < ((WorkPlan)objWorkPlanFromDB).ActQty) { if (!checkedRow.ContainsKey(planQty)) { checkedRow.Add(planQty, false); } gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = _LanguageComponent1.GetString("$planqty_isnotequ_actqty"); gridRow.Items.FindItemByKey("ImportResult").CssClass = "MsgYellow"; this._ImportDataTable.Rows.Remove(row); this._ImportGridRow.Remove(gridRow); continue; } if ((((WorkPlan)objWorkPlanFromDB).ActionStatus == WorkPlanActionStatus.WorkPlanActionStatus_Close)) //执行状态为待投产或生产中才update { if (!checkedRow.ContainsKey(planDate)) { checkedRow.Add(planDate, false); } gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = _LanguageComponent1.GetString("$status_error"); gridRow.Items.FindItemByKey("ImportResult").CssClass = "MsgYellow"; this._ImportDataTable.Rows.Remove(row); this._ImportGridRow.Remove(gridRow); continue; } } if (int.Parse(planDate) < shiftDay) { if (!checkedRow.ContainsKey(planDate)) { checkedRow.Add(planDate, false); } gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = "计划日期不能早于当前日期"; gridRow.Items.FindItemByKey("ImportResult").CssClass = "MsgYellow"; this._ImportDataTable.Rows.Remove(row); this._ImportGridRow.Remove(gridRow); continue; } WorkPlan GetworkPlanByKeys = (WorkPlan)materialFacade.GetWorkPlan(bigSSCode, int.Parse(planDate), moCode, decimal.Parse(moSeq)); WorkPlan GetworkPlanByUniques = (WorkPlan)materialFacade.GetWorkPlan(bigSSCode, int.Parse(planDate), int.Parse(planSeq)); if (GetworkPlanByKeys == null && GetworkPlanByUniques != null) { if (!checkedRow.ContainsKey(moCode)) { checkedRow.Add(moCode, false); } gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = "请检查日期+线别+投产顺序的唯一性"; gridRow.Items.FindItemByKey("ImportResult").CssClass = "MsgYellow"; this._ImportDataTable.Rows.Remove(row); this._ImportGridRow.Remove(gridRow); continue; } if (GetworkPlanByKeys != null && GetworkPlanByUniques != null) { if (GetworkPlanByKeys.BigSSCode != GetworkPlanByUniques.BigSSCode || GetworkPlanByKeys.PlanDate != GetworkPlanByUniques.PlanDate || GetworkPlanByKeys.MoCode != GetworkPlanByUniques.MoCode || GetworkPlanByKeys.MoSeq != GetworkPlanByUniques.MoSeq) { if (!checkedRow.ContainsKey(moCode)) { checkedRow.Add(moCode, false); } gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = "请检查日期+线别+投产顺序的唯一性"; gridRow.Items.FindItemByKey("ImportResult").CssClass = "MsgYellow"; this._ImportDataTable.Rows.Remove(row); this._ImportGridRow.Remove(gridRow); continue; } } if (!checkedRow.ContainsKey(moCode)) { checkedRow.Add(moCode, false); } gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = true; } }
private void CheckIndirectManCount() { int count = this.ImportDatatable.Rows.Count; Hashtable checkedRow = new Hashtable(); DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this._dataProvider); for (int i = count - 1; i >= 0; i--) { DataRow row = this.ImportDatatable.Rows[i]; GridRecord gridRow = this.ImportGridRow[i] as GridRecord; string ShiftDate = row["ShiftDate"].ToString(); string ShiftCode = row["ShiftCode"].ToString(); string CrewCode = row["CrewCode"].ToString(); string FacCode = row["FacCode"].ToString(); string FirstClass = row["FirstClass"].ToString(); string ManCount = row["ManCount"].ToString(); string Duration = row["Duration"].ToString(); Decimal DurationDecimal = Convert.ToDecimal(row["Duration"].ToString()) * 3600; if (string.IsNullOrEmpty(ShiftDate)) { if (!checkedRow.ContainsKey(ShiftDate)) { checkedRow.Add(ShiftDate, false); } gridRow.Items.FindItemByKey(checkColumn).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = _languageComponent1.GetString("$ShiftDate_NotExit"); gridRow.Items.FindItemByKey("ImportResult").CssClass = "ForeColorRed"; // gridRow.Items.FindItemByKey("ImportResult").Style.ForeColor = TextColor.NoticeColor; this.ImportDatatable.Rows.Remove(row); this.ImportGridRow.Remove(gridRow); continue; } try { DateTime planDateTime = Convert.ToDateTime(ShiftDate); } catch { if (!checkedRow.ContainsKey(ShiftDate)) { checkedRow.Add(ShiftDate, false); } gridRow.Items.FindItemByKey("").Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = _languageComponent1.GetString("$ShiftDate_Is_Wrong"); gridRow.Items.FindItemByKey("ImportResult").CssClass = "ForeColorRed"; //gridRow.Items.FindItemByKey("ImportResult").Style.ForeColor = TextColor.NoticeColor; this.ImportDatatable.Rows.Remove(row); this.ImportGridRow.Remove(gridRow); continue; } if (string.IsNullOrEmpty(ShiftCode)) { if (!checkedRow.ContainsKey(ShiftCode)) { checkedRow.Add(ShiftCode, false); } gridRow.Items.FindItemByKey(checkColumn).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = _languageComponent1.GetString("$ShiftCode_NotExit"); gridRow.Items.FindItemByKey("ImportResult").CssClass = "ForeColorRed"; //gridRow.Items.FindItemByKey("ImportResult").Style.ForeColor = TextColor.NoticeColor; this.ImportDatatable.Rows.Remove(row); this.ImportGridRow.Remove(gridRow); continue; } if (string.IsNullOrEmpty(CrewCode)) { if (!checkedRow.ContainsKey(CrewCode)) { checkedRow.Add(CrewCode, false); } gridRow.Items.FindItemByKey(checkColumn).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = _languageComponent1.GetString("$CrewCode_NotExit"); gridRow.Items.FindItemByKey("ImportResult").CssClass = "ForeColorRed"; //gridRow.Items.FindItemByKey("ImportResult").Style.ForeColor = TextColor.NoticeColor; this.ImportDatatable.Rows.Remove(row); this.ImportGridRow.Remove(gridRow); continue; } if (string.IsNullOrEmpty(FacCode)) { if (!checkedRow.ContainsKey(FacCode)) { checkedRow.Add(FacCode, false); } gridRow.Items.FindItemByKey(checkColumn).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = _languageComponent1.GetString("$FacCode_NotExit"); gridRow.Items.FindItemByKey("ImportResult").CssClass = "ForeColorRed"; //gridRow.Items.FindItemByKey("ImportResult").Style.ForeColor = TextColor.NoticeColor; this.ImportDatatable.Rows.Remove(row); this.ImportGridRow.Remove(gridRow); continue; } if (string.IsNullOrEmpty(FirstClass)) { if (!checkedRow.ContainsKey(FirstClass)) { checkedRow.Add(FirstClass, false); } gridRow.Items.FindItemByKey(checkColumn).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = _languageComponent1.GetString("$FirstClass_NotExit"); gridRow.Items.FindItemByKey("ImportResult").CssClass = "ForeColorRed"; //gridRow.Items.FindItemByKey("ImportResult").Style.ForeColor = TextColor.NoticeColor; this.ImportDatatable.Rows.Remove(row); this.ImportGridRow.Remove(gridRow); continue; } if (string.IsNullOrEmpty(ManCount)) { if (!checkedRow.ContainsKey(ManCount)) { checkedRow.Add(ManCount, false); } gridRow.Items.FindItemByKey(checkColumn).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = _languageComponent1.GetString("$ManCount_NotExit"); gridRow.Items.FindItemByKey("ImportResult").CssClass = "ForeColorRed"; //gridRow.Items.FindItemByKey("ImportResult").Style.ForeColor = TextColor.NoticeColor; this.ImportDatatable.Rows.Remove(row); this.ImportGridRow.Remove(gridRow); continue; } try { int manCount = int.Parse(ManCount); } catch { if (!checkedRow.ContainsKey(ManCount)) { checkedRow.Add(ManCount, false); } gridRow.Items.FindItemByKey(checkColumn).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = _languageComponent1.GetString("$ManCount_Is_Wrong"); gridRow.Items.FindItemByKey("ImportResult").CssClass = "ForeColorRed"; //gridRow.Items.FindItemByKey("ImportResult").Style.ForeColor = TextColor.NoticeColor; this.ImportDatatable.Rows.Remove(row); this.ImportGridRow.Remove(gridRow); continue; } if (string.IsNullOrEmpty(Duration)) { if (!checkedRow.ContainsKey(Duration)) { checkedRow.Add(Duration, false); } gridRow.Items.FindItemByKey(checkColumn).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = _languageComponent1.GetString("$Duration_NotExit"); gridRow.Items.FindItemByKey("ImportResult").CssClass = "ForeColorRed"; //gridRow.Items.FindItemByKey("ImportResult").Style.ForeColor = TextColor.NoticeColor; this.ImportDatatable.Rows.Remove(row); this.ImportGridRow.Remove(gridRow); continue; } try { decimal duration = Decimal.Parse(Duration); } catch { if (!checkedRow.ContainsKey(Duration)) { checkedRow.Add(Duration, false); } gridRow.Items.FindItemByKey(checkColumn).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = _languageComponent1.GetString("$Duration_Is_Wrong"); gridRow.Items.FindItemByKey("ImportResult").CssClass = "ForeColorRed"; //gridRow.Items.FindItemByKey("ImportResult").Style.ForeColor = TextColor.NoticeColor; this.ImportDatatable.Rows.Remove(row); this.ImportGridRow.Remove(gridRow); continue; } ShiftModelFacade shiftModelFacade = new ShiftModelFacade(this._dataProvider); object shiftObject = shiftModelFacade.GetShift(FormatHelper.CleanString(ShiftCode.ToUpper())); if (shiftObject == null) { if (!checkedRow.ContainsKey(ShiftCode)) { checkedRow.Add(ShiftCode, false); } gridRow.Items.FindItemByKey(checkColumn).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = _languageComponent1.GetString("$Error_Shift_Not_Exist"); gridRow.Items.FindItemByKey("ImportResult").CssClass = "ForeColorRed"; //gridRow.Items.FindItemByKey("ImportResult").Style.ForeColor = TextColor.NoticeColor; this.ImportDatatable.Rows.Remove(row); this.ImportGridRow.Remove(gridRow); continue; } ShiftModel shiftModel = new ShiftModel(this._dataProvider); object crewObject = shiftModel.GetShiftCrew(FormatHelper.CleanString(CrewCode.ToUpper())); if (crewObject == null) { if (!checkedRow.ContainsKey(CrewCode)) { checkedRow.Add(CrewCode, false); } gridRow.Items.FindItemByKey(checkColumn).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = _languageComponent1.GetString("$Error_ShiftCrew_Not_Exist"); gridRow.Items.FindItemByKey("ImportResult").CssClass = "ForeColorRed"; //gridRow.Items.FindItemByKey("ImportResult").Style.ForeColor = TextColor.NoticeColor; this.ImportDatatable.Rows.Remove(row); this.ImportGridRow.Remove(gridRow); continue; } WarehouseFacade warehouseFacade = new WarehouseFacade(this._dataProvider); object facObject = warehouseFacade.GetFactory(FormatHelper.CleanString(FacCode.ToUpper())); if (facObject == null) { if (!checkedRow.ContainsKey(FacCode)) { checkedRow.Add(FacCode, false); } gridRow.Items.FindItemByKey(checkColumn).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = _languageComponent1.GetString("$Error_FACCODE_Not_Exist"); gridRow.Items.FindItemByKey("ImportResult").CssClass = "ForeColorRed"; //gridRow.Items.FindItemByKey("ImportResult").Style.ForeColor = TextColor.NoticeColor; this.ImportDatatable.Rows.Remove(row); this.ImportGridRow.Remove(gridRow); continue; } ItemFacade itemFacade = new ItemFacade(this._dataProvider); object itemClass = itemFacade.GetItemSecondClass(FormatHelper.CleanString(FirstClass.ToUpper())); if (itemClass == null) { if (!checkedRow.ContainsKey(FirstClass)) { checkedRow.Add(FirstClass, false); } gridRow.Items.FindItemByKey(checkColumn).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = _languageComponent1.GetString("$Error_FirstClass_Not_Exist"); gridRow.Items.FindItemByKey("ImportResult").CssClass = "ForeColorRed"; //gridRow.Items.FindItemByKey("ImportResult").Style.ForeColor = TextColor.NoticeColor; this.ImportDatatable.Rows.Remove(row); this.ImportGridRow.Remove(gridRow); continue; } gridRow.Items.FindItemByKey(checkColumn).Value = true; } }
public void ImportWorkPlan(bool isRollBack) { ShiftModelFacade shiftModelFacade = new ShiftModelFacade(this._DataProvider); DBDateTime now = FormatHelper.GetNowDBDateTime(this._DataProvider); object[] objs = ConvertArrayListToObjectArray(_ImportDataTable); object[] objDt = ConvertArrayListToObjectArray(_ImportDataTable); try { _DataProvider.BeginTransaction(); if (objs != null && objDt != null) { for (int i = 0; i < objs.Length; i++) { try { GridRecord row = _ImportGridRow[i] as GridRecord; WorkPlan workPlanFromExcel = objs[i] as WorkPlan; int shiftDay = shiftModelFacade.GetShiftDayByBigSSCode(workPlanFromExcel.BigSSCode, now.DateTime); if (_MaterialFacade == null) { _MaterialFacade = new MaterialFacade(_DataProvider); } WorkPlan objWorkPlanFromDB = (WorkPlan)_MaterialFacade.GetWorkPlan(workPlanFromExcel.BigSSCode, workPlanFromExcel.PlanDate, workPlanFromExcel.MoCode, workPlanFromExcel.MoSeq); if (objWorkPlanFromDB != null) { ((WorkPlan)objs[i]).MaterialQty = objWorkPlanFromDB.MaterialQty; ((WorkPlan)objs[i]).ActQty = objWorkPlanFromDB.ActQty; ((WorkPlan)objs[i]).MaterialStatus = objWorkPlanFromDB.MaterialStatus; ((WorkPlan)objs[i]).ActionStatus = objWorkPlanFromDB.ActionStatus; ((WorkPlan)objs[i]).ItemCode = objWorkPlanFromDB.ItemCode; ((WorkPlan)objs[i]).PromiseTime = objWorkPlanFromDB.PromiseTime; ((WorkPlan)objs[i]).LastReqTime = objWorkPlanFromDB.LastReqTime; ((WorkPlan)objs[i]).LastReceiveTime = objWorkPlanFromDB.LastReceiveTime; ((WorkPlan)objs[i]).PlanEndTime = objWorkPlanFromDB.PlanEndTime; ((WorkPlan)objDt[i]).MaterialQty = objWorkPlanFromDB.MaterialQty; ((WorkPlan)objDt[i]).ActQty = objWorkPlanFromDB.ActQty; ((WorkPlan)objDt[i]).MaterialStatus = objWorkPlanFromDB.MaterialStatus; ((WorkPlan)objDt[i]).ActionStatus = objWorkPlanFromDB.ActionStatus; ((WorkPlan)objDt[i]).ItemCode = objWorkPlanFromDB.ItemCode; ((WorkPlan)objDt[i]).PromiseTime = objWorkPlanFromDB.PromiseTime; ((WorkPlan)objDt[i]).LastReqTime = objWorkPlanFromDB.LastReqTime; ((WorkPlan)objDt[i]).LastReceiveTime = objWorkPlanFromDB.LastReceiveTime; ((WorkPlan)objDt[i]).PlanEndTime = objWorkPlanFromDB.PlanEndTime; _DataProvider.Update(objs[i]); _DataProvider.Update(objDt[i]); row.Items.FindItemByKey("ImportResult").Text = _LanguageComponent1.GetString("$CycleImport_Success"); row.Items.FindItemByKey("ImportResult").CssClass = "LinkColorBlue"; } else { if ((workPlanFromExcel.PlanDate) >= shiftDay) { _DataProvider.Insert(objDt[i]); row.Items.FindItemByKey("ImportResult").Text = _LanguageComponent1.GetString("$CycleImport_Success"); row.Items.FindItemByKey("ImportResult").CssClass = "LinkColorBlue"; } } } catch (Exception ex) { GridRecord row = _ImportGridRow[i] as GridRecord; row.Items.FindItemByKey("ImportResult").Text = _LanguageComponent1.GetString("$CycleImport_Error"); row.Items.FindItemByKey("ImportResult").CssClass = "ForeColorRed"; this.ErrorArray.Add(ex); } } } _DataProvider.CommitTransaction(); } catch (Exception ex) { _DataProvider.RollbackTransaction(); this.ErrorArray.Add(ex); } }
//Laws Lu,2005/08/19,新增 完工逻辑 //Laws Lu,2005/08/26,新增 更新工单报废数量 private void doAction(ActionEventArgs e) { #region 填写Simulation //Laws Lu,2005/08/26,新增 更新工单中报废的数量 DataCollectFacade fac = new DataCollectFacade(this.DataProvider); DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); Simulation sim = (Simulation)fac.GetSimulation(e.RunningCard.Trim()); if (sim != null) { sim.IsComplete = "1"; sim.EAttribute1 = "SCRAP";//TSStatus.TSStatus_Scrap 以Mail内容为准 sim.ProductStatus = "SCRAP"; sim.MaintainUser = e.UserCode.Trim(); sim.MaintainDate = dbDateTime.DBDate; sim.MaintainTime = dbDateTime.DBTime; } fac.UpdateSimulation(sim); #endregion #region 填写SimulationReport SimulationReport simulationReport = new SimulationReport(); simulationReport.RouteCode = sim.RouteCode; simulationReport.OPCode = sim.OPCode; simulationReport.CartonCode = sim.CartonCode; simulationReport.EAttribute1 = sim.EAttribute1; simulationReport.EAttribute2 = sim.EAttribute2; simulationReport.IDMergeRule = sim.IDMergeRule; simulationReport.IsComplete = sim.IsComplete; simulationReport.ItemCode = sim.ItemCode; simulationReport.LastAction = sim.LastAction; simulationReport.LOTNO = sim.LOTNO; simulationReport.MaintainDate = sim.MaintainDate; simulationReport.MaintainTime = sim.MaintainTime; simulationReport.MaintainUser = sim.MaintainUser; simulationReport.MOCode = sim.MOCode; simulationReport.ModelCode = sim.ModelCode; simulationReport.NGTimes = sim.NGTimes; simulationReport.PalletCode = sim.PalletCode; simulationReport.ResourceCode = sim.ResourceCode; simulationReport.RunningCard = sim.RunningCard; simulationReport.RunningCardSequence = sim.RunningCardSequence; simulationReport.Status = sim.ProductStatus; simulationReport.TranslateCard = sim.TranslateCard; simulationReport.TranslateCardSequence = sim.TranslateCardSequence; simulationReport.SourceCard = sim.SourceCard; simulationReport.SourceCardSequence = sim.SourceCardSequence; BaseModelFacade dataModel = new BaseModelFacade(this.DataProvider); Resource resource = (Resource)dataModel.GetResource(sim.ResourceCode); simulationReport.SegmentCode = resource.SegmentCode; ShiftModelFacade shiftModel = new ShiftModelFacade(this.DataProvider); TimePeriod period = (TimePeriod)shiftModel.GetTimePeriod(resource.ShiftTypeCode, simulationReport.MaintainTime); if (period == null) { throw new Exception("$OutOfPerid"); } // Modified by Jane Shu Date:2005-07-26 // if ( period.IsOverDate == FormatHelper.TRUE_STRING ) // { // if ( period.TimePeriodBeginTime < period.TimePeriodEndTime ) // { // simulationReport.ShiftDay = FormatHelper.TODateInt(DateTime.Now.AddDays(-1)) ; // } // else if ( sim.MaintainTime < period.TimePeriodBeginTime) // { // simulationReport.ShiftDay = FormatHelper.TODateInt(DateTime.Now.AddDays(-1)) ; // } // else // { // simulationReport.ShiftDay = FormatHelper.TODateInt(DateTime.Now) ; // } // } // else // { // simulationReport.ShiftDay = FormatHelper.TODateInt(DateTime.Now) ; // } simulationReport.ShiftTypeCode = resource.ShiftTypeCode; simulationReport.ShiftCode = period.ShiftCode; simulationReport.TimePeriodCode = period.TimePeriodCode; simulationReport.StepSequenceCode = resource.StepSequenceCode; simulationReport.MOSeq = sim.MOSeq; // Added by Icyer 2007/07/03 fac.UpdateSimulationReport(simulationReport); #endregion #region 填写OnWIP // OnWIP onwip = new OnWIP(); // onwip.Action = sim.LastAction; // onwip.ActionResult = sim.ProductStatus; // onwip.ItemCode = sim.ItemCode ; // onwip.MaintainDate = FormatHelper.TODateInt(DateTime.Now) ; // onwip.MaintainTime = FormatHelper.TOTimeInt(DateTime.Now) ; // onwip.MaintainUser = sim.MaintainUser ; // onwip.MOCode = sim.MOCode; // onwip.ModelCode = sim.ModelCode; // onwip.NGTimes = sim.NGTimes; // onwip.OPCode = sim.OPCode; // onwip.ResourceCode = sim.ResourceCode; // onwip.RouteCode = sim.RouteCode; // onwip.RunningCard = sim.RunningCard; // onwip.RunningCardSequence = sim.RunningCardSequence ; // //// BaseModelFacade dataModel1 = new BaseModelFacade(this.DataProvider); //// Resource resource1 = (Resource)dataModel1.GetResource(sim.ResourceCode); //// onwip.SegmentCode = resource1.SegmentCode ; //// //// ShiftModelFacade shiftModel1 = new ShiftModelFacade(this.DataProvider); //// TimePeriod period1 = (TimePeriod)shiftModel1.GetTimePeriod(resource1.ShiftTypeCode,onwip.MaintainTime); //// if (period1==null) //// { //// throw new Exception("$OutOfPerid"); //// } // //// if ( period1.IsOverDate == FormatHelper.TRUE_STRING ) //// { //// if ( period1.TimePeriodBeginTime < period1.TimePeriodEndTime ) //// { //// onwip.ShiftDay = FormatHelper.TODateInt(DateTime.Now.AddDays(-1)) ; //// } //// else if ( sim.MaintainTime < period1.TimePeriodBeginTime) //// { //// onwip.ShiftDay = FormatHelper.TODateInt(DateTime.Now.AddDays(-1)) ; //// } //// else //// { //// onwip.ShiftDay = FormatHelper.TODateInt(DateTime.Now) ; //// } //// } //// else //// { //// onwip.ShiftDay = FormatHelper.TODateInt(DateTime.Now) ; //// } //// onwip.ShiftTypeCode = resource1.ShiftTypeCode; //// onwip.ShiftCode = period1.ShiftCode; //// onwip.TimePeriodCode = period1.TimePeriodCode; // // onwip.SourceCard = sim.SourceCard; // onwip.SourceCardSequence = sim.SourceCardSequence; //// onwip.StepSequenceCode = resource1.StepSequenceCode; // // onwip.TranslateCard = sim.TranslateCard; // onwip.TranslateCardSequence = sim.TranslateCardSequence; // // fac.UpdateOnWIP(onwip); #endregion MOFacade moFAC = new MOFacade(_domainDataProvider); object objMO = null; if (e.CurrentMO != null) { objMO = e.CurrentMO; } else { objMO = moFAC.GetMO(sim.MOCode); e.CurrentMO = objMO as Domain.MOModel.MO; } if (objMO != null) { MO mo = (MO)objMO; //Laws Lu,2006/02/28,修改 报废数量 mo.MOScrapQty = /*mo.MOScrapQty + */ 1 * sim.IDMergeRule; moFAC.UpdateMOScrapQty(mo); } //End Laws Lu }
public void RefreshQty() { BaseModelFacade baseModelFacade = new BaseModelFacade(this.DataProvider); ShiftModelFacade shiftModelFacade = new ShiftModelFacade(this.DataProvider); ReportFacade reportFacade = new ReportFacade(this.DataProvider); MOFacade moFacade = new MOFacade(this.DataProvider); //DateTime DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); DateTime now = FormatHelper.ToDateTime(dbDateTime.DBDate, dbDateTime.DBTime); //ResCode string resCode = ApplicationService.Current().ResourceCode; //Shift day and shift string shiftCode = string.Empty; int shiftDay = 0; Resource res = (Resource)baseModelFacade.GetResource(resCode); if (res != null) { TimePeriod currTimePeriod = (TimePeriod)shiftModelFacade.GetTimePeriod(res.ShiftTypeCode, dbDateTime.DBTime); if (currTimePeriod != null) { shiftDay = shiftModelFacade.GetShiftDay(currTimePeriod, now); shiftCode = currTimePeriod.ShiftCode; } } //刷新数量数据 object[] reportSOQtyList = reportFacade.QueryMOCodeFromReportSOQty(shiftDay, shiftCode, resCode); DataTable dataTable = new DataTable(); dataTable.Columns.Add("MOCode"); dataTable.Columns.Add("PlanQty"); dataTable.Columns.Add("ResOutputCurrent"); dataTable.Columns.Add("ResOutputTotal"); decimal sumPlanQty = 0; int sumResOutputCurrent = 0; int sumResOutputTotal = 0; if (reportSOQtyList != null) { foreach (ReportSOQty reportSOQty in reportSOQtyList) { MO mo = (MO)moFacade.GetMO(reportSOQty.MOCode); if (mo != null) { object[] outputCurrent = reportFacade.QueryOPCountSumFromReportSOQty(shiftDay, shiftCode, resCode, reportSOQty.MOCode); object[] outputTotal = reportFacade.QueryOPCountSumFromReportSOQty(0, string.Empty, resCode, reportSOQty.MOCode); if (outputCurrent != null && outputTotal != null) { DataRow row = dataTable.NewRow(); row["MOCode"] = reportSOQty.MOCode; row["PlanQty"] = mo.MOPlanQty.ToString("0"); row["ResOutputCurrent"] = ((ReportSOQty)outputCurrent[0]).OPCount.ToString(); row["ResOutputTotal"] = ((ReportSOQty)outputTotal[0]).OPCount.ToString(); dataTable.Rows.Add(row); sumPlanQty += mo.MOPlanQty; sumResOutputCurrent += ((ReportSOQty)outputCurrent[0]).OPCount; sumResOutputTotal += ((ReportSOQty)outputTotal[0]).OPCount; } } } } DataRow rowSum = dataTable.NewRow(); rowSum["MOCode"] = UserControl.MutiLanguages.ParserString("Summary"); rowSum["PlanQty"] = sumPlanQty.ToString("0"); rowSum["ResOutputCurrent"] = sumResOutputCurrent.ToString(); rowSum["ResOutputTotal"] = sumResOutputTotal.ToString(); dataTable.Rows.Add(rowSum); this.ultraGridQty.DataSource = dataTable; this.ultraGridQty.DataBind(); }
protected override bool ValidateInput() { PageCheckManager manager = new PageCheckManager(); manager.Add(new LengthCheck(lblSSEdit, txtSSEdit, 40, true)); manager.Add(new DateCheck(lblDateQuery, DateEdit.Text, true)); manager.Add(new LengthCheck(lblShiftCodeEdit, txtShiftCodeEdit, 40, true)); manager.Add(new LengthCheck(lblItemCodeEdit, txtItemCodeEdit, 40, true)); manager.Add(new LengthCheck(lblExceptionCodeEdit, txtExceptionCodeEdit, 40, true)); manager.Add(new LengthCheck(lblMemoEdit, txtMemoEdit, 500, false)); manager.Add(new LengthCheck(lblComfirmMEMOEdit, txtComfirmMEMOEdit, 500, false)); if (!manager.Check()) { WebInfoPublish.Publish(this, manager.CheckMessage, this.languageComponent1); return(false); } //if (Convert.ToDateTime(this.BeginTimeEdit.TimeString) > Convert.ToDateTime(this.EndTimeEdit.TimeString)) //{ // WebInfoPublish.Publish(this, "$Error_BeginTime_Biggger_EndTime", this.languageComponent1); // return false; //} ShiftModelFacade shiftModelFacade = new ShiftModelFacade(this.DataProvider); object shiftObject = shiftModelFacade.GetShift(FormatHelper.CleanString(this.txtShiftCodeEdit.Text.ToUpper())); if (shiftObject == null) { WebInfoPublish.Publish(this, "$Error_Shift_Not_Exist", this.languageComponent1); return(false); } ItemFacade itemFacade = new ItemFacade(this.DataProvider); object itemObject = itemFacade.GetItem(FormatHelper.CleanString(this.txtItemCodeEdit.Text.ToUpper()), GlobalVariables.CurrentOrganizations.First().OrganizationID); if (itemObject == null) { WebInfoPublish.Publish(this, "$Error_CS_No_OPBOMDetail", this.languageComponent1); return(false); } BaseModelFacade baseModelFacade = new BaseModelFacade(this.DataProvider); object stepSequenceObject = baseModelFacade.GetStepSequence(FormatHelper.CleanString(this.txtSSEdit.Text.ToUpper())); if (stepSequenceObject == null) { WebInfoPublish.Publish(this, "$CS_STEPSEQUENCE_NOT_EXIST", this.languageComponent1); return(false); } if (((Shift)shiftObject).ShiftTypeCode != ((StepSequence)stepSequenceObject).ShiftTypeCode) { WebInfoPublish.Publish(this, "$CS_STEPSEQUENCE_NOT_Math_ShiftCode", this.languageComponent1); return(false); } if (_facade == null) { _facade = new PerformanceFacade(base.DataProvider); } object exceptionCodeObject = _facade.GetExceptionCode(FormatHelper.CleanString(this.txtExceptionCodeEdit.Text.ToUpper())); if (exceptionCodeObject == null) { WebInfoPublish.Publish(this, "$ExceptionCode_NOT_EXIST", this.languageComponent1); return(false); } return(true); }
private void CheckLine2Crew() { int count = this.ImportDatatable.Rows.Count; Hashtable checkedRow = new Hashtable(); DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this._dataProvider); for (int i = count - 1; i >= 0; i--) { DataRow row = this.ImportDatatable.Rows[i]; GridRecord gridRow = this.ImportGridRow[i] as GridRecord; string ShiftDate = row["ShiftDate"].ToString(); string ShiftCode = row["ShiftCode"].ToString(); string CrewCode = row["CrewCode"].ToString(); string ssCode = row["SSCode"].ToString(); if (string.IsNullOrEmpty(ShiftDate)) { if (!checkedRow.ContainsKey(ShiftDate)) { checkedRow.Add(ShiftDate, false); } gridRow.Items.FindItemByKey(checkColumn).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = _languageComponent1.GetString("$ShiftDate_NotExit"); gridRow.Items.FindItemByKey("ImportResult").CssClass = "ForeColorRed"; //gridRow.Items.FindItemByKey("ImportResult").Style.ForeColor = TextColor.NoticeColor; this.ImportDatatable.Rows.Remove(row); this.ImportGridRow.Remove(gridRow); continue; } try { DateTime planDateTime = Convert.ToDateTime(ShiftDate); } catch { if (!checkedRow.ContainsKey(ShiftDate)) { checkedRow.Add(ShiftDate, false); } gridRow.Items.FindItemByKey(checkColumn).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = _languageComponent1.GetString("$ShiftDate_Is_Wrong"); gridRow.Items.FindItemByKey("ImportResult").CssClass = "ForeColorRed"; //gridRow.Items.FindItemByKey("ImportResult").Style.ForeColor = TextColor.NoticeColor; this.ImportDatatable.Rows.Remove(row); this.ImportGridRow.Remove(gridRow); continue; } if (string.IsNullOrEmpty(ShiftCode)) { if (!checkedRow.ContainsKey(ShiftCode)) { checkedRow.Add(ShiftCode, false); } gridRow.Items.FindItemByKey(checkColumn).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = _languageComponent1.GetString("$ShiftCode_NotExit"); gridRow.Items.FindItemByKey("ImportResult").CssClass = "ForeColorRed"; //gridRow.Items.FindItemByKey("ImportResult").Style.ForeColor = TextColor.NoticeColor; this.ImportDatatable.Rows.Remove(row); this.ImportGridRow.Remove(gridRow); continue; } if (string.IsNullOrEmpty(CrewCode)) { if (!checkedRow.ContainsKey(CrewCode)) { checkedRow.Add(CrewCode, false); } gridRow.Items.FindItemByKey(checkColumn).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = _languageComponent1.GetString("$CrewCode_NotExit"); gridRow.Items.FindItemByKey("ImportResult").CssClass = "ForeColorRed"; //gridRow.Items.FindItemByKey("ImportResult").Style.ForeColor = TextColor.NoticeColor; this.ImportDatatable.Rows.Remove(row); this.ImportGridRow.Remove(gridRow); continue; } if (string.IsNullOrEmpty(ssCode)) { if (!checkedRow.ContainsKey(ssCode)) { checkedRow.Add(ssCode, false); } gridRow.Items.FindItemByKey(checkColumn).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = _languageComponent1.GetString("$FacCode_NotExit"); gridRow.Items.FindItemByKey("ImportResult").CssClass = "ForeColorRed"; //gridRow.Items.FindItemByKey("ImportResult").Style.ForeColor = TextColor.NoticeColor; this.ImportDatatable.Rows.Remove(row); this.ImportGridRow.Remove(gridRow); continue; } ShiftModelFacade shiftModelFacade = new ShiftModelFacade(this._dataProvider); object shiftObject = shiftModelFacade.GetShift(FormatHelper.CleanString(ShiftCode.ToUpper())); if (shiftObject == null) { if (!checkedRow.ContainsKey(ShiftCode)) { checkedRow.Add(ShiftCode, false); } gridRow.Items.FindItemByKey(checkColumn).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = _languageComponent1.GetString("$Error_Shift_Not_Exist"); gridRow.Items.FindItemByKey("ImportResult").CssClass = "ForeColorRed"; //gridRow.Items.FindItemByKey("ImportResult").Style.ForeColor = TextColor.NoticeColor; this.ImportDatatable.Rows.Remove(row); this.ImportGridRow.Remove(gridRow); continue; } ShiftModel shiftModel = new ShiftModel(this._dataProvider); object crewObject = shiftModel.GetShiftCrew(FormatHelper.CleanString(CrewCode.ToUpper())); if (crewObject == null) { if (!checkedRow.ContainsKey(CrewCode)) { checkedRow.Add(CrewCode, false); } gridRow.Items.FindItemByKey(checkColumn).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = _languageComponent1.GetString("$Error_ShiftCrew_Not_Exist"); gridRow.Items.FindItemByKey("ImportResult").CssClass = "ForeColorRed"; //gridRow.Items.FindItemByKey("ImportResult").Style.ForeColor = TextColor.NoticeColor; this.ImportDatatable.Rows.Remove(row); this.ImportGridRow.Remove(gridRow); continue; } BaseModelFacade baseModelFacade = new BaseModelFacade(this._dataProvider); object stepSequenceObject = baseModelFacade.GetStepSequence(FormatHelper.CleanString(ssCode.ToUpper())); if (stepSequenceObject == null) { if (!checkedRow.ContainsKey(ssCode)) { checkedRow.Add(ssCode, false); } gridRow.Items.FindItemByKey(checkColumn).Value = false; gridRow.Items.FindItemByKey("ImportResult").Text = _languageComponent1.GetString("$CS_STEPSEQUENCE_NOT_EXIST"); gridRow.Items.FindItemByKey("ImportResult").CssClass = "ForeColorRed"; //gridRow.Items.FindItemByKey("ImportResult").Style.ForeColor = TextColor.NoticeColor; this.ImportDatatable.Rows.Remove(row); this.ImportGridRow.Remove(gridRow); continue; } gridRow.Items.FindItemByKey(checkColumn).Value = true; } }
/// <summary> /// /// </summary> /// <param name="isRollBack">true:出错就回滚;false:出错skip到下一个</param> public void Import(bool isRollBack) { ShiftModelFacade shiftModelFacade = new ShiftModelFacade(this._dataProvider); DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this._dataProvider); object[] objDt = null; if (string.Compare(ImportType, "IndirectManCount", true) == 0) { objDt = ConvertArrayListToObjectArray(ImportDatatable, "IndirectManCount"); } if (string.Compare(ImportType, "Line2Crew", true) == 0) { objDt = ConvertArrayListToObjectArray(ImportDatatable, "Line2Crew"); } try { _dataProvider.BeginTransaction(); if (string.Compare(ImportType, "IndirectManCount", true) == 0) { if (objDt != null) { for (int i = 0; i < objDt.Length; i++) { try { GridRecord row = ImportGridRow[i] as GridRecord; IndirectManCount IndirectManCountExcel = objDt[i] as IndirectManCount; if (_Facade == null) { _Facade = new PerformanceFacade(_dataProvider); } IndirectManCount getWorkPlanFromDB = (IndirectManCount)_Facade.GetIndirectManCount(IndirectManCountExcel.ShiftDate, IndirectManCountExcel.ShiftCode, IndirectManCountExcel.CrewCode, IndirectManCountExcel.FactoryCode, IndirectManCountExcel.FirstClass); if (getWorkPlanFromDB != null) { ((IndirectManCount)objDt[i]).FactoryCode = IndirectManCountExcel.FactoryCode; ((IndirectManCount)objDt[i]).FirstClass = IndirectManCountExcel.FirstClass; _dataProvider.Update(objDt[i]); row.Items.FindItemByKey("ImportResult").Text = _languageComponent1.GetString("$CycleImport_Success"); row.Items.FindItemByKey("ImportResult").CssClass = "LinkColorBlue"; } else { _dataProvider.Insert(objDt[i]); row.Items.FindItemByKey("ImportResult").Text = _languageComponent1.GetString("$CycleImport_Success"); row.Items.FindItemByKey("ImportResult").CssClass = "LinkColorBlue"; } } catch (Exception ex) { GridRecord row = ImportGridRow[i] as GridRecord; row.Items.FindItemByKey("ImportResult").Text = _languageComponent1.GetString("$CycleImport_Error"); row.Items.FindItemByKey("ImportResult").CssClass = "ForeColorRed"; this.ErrorArray.Add(ex); } } } } if (string.Compare(ImportType, "Line2Crew", true) == 0) { if (objDt != null) { for (int i = 0; i < objDt.Length; i++) { try { GridRecord row = ImportGridRow[i] as GridRecord; Line2Crew Line2CrewExcel = objDt[i] as Line2Crew; if (_Facade == null) { _Facade = new PerformanceFacade(_dataProvider); } Line2Crew getLine2CrewFromDB = (Line2Crew)_Facade.GetLine2Crew(Convert.ToInt32(Line2CrewExcel.ShiftDate), Line2CrewExcel.SSCode.ToString(), Line2CrewExcel.ShiftCode); if (getLine2CrewFromDB != null) { getLine2CrewFromDB.CrewCode = Line2CrewExcel.CrewCode; _dataProvider.Update(getLine2CrewFromDB); row.Items.FindItemByKey("ImportResult").Text = _languageComponent1.GetString("$CycleImport_Success"); row.Items.FindItemByKey("ImportResult").CssClass = "LinkColorBlue"; } else { _dataProvider.Insert(objDt[i]); row.Items.FindItemByKey("ImportResult").Text = _languageComponent1.GetString("$CycleImport_Success"); row.Items.FindItemByKey("ImportResult").CssClass = "LinkColorBlue"; } } catch (Exception ex) { GridRecord row = ImportGridRow[i] as GridRecord; row.Items.FindItemByKey("ImportResult").Text = _languageComponent1.GetString("$CycleImport_Error"); row.Items.FindItemByKey("ImportResult").CssClass = "ForeColorRed"; this.ErrorArray.Add(ex); } } } } _dataProvider.CommitTransaction(); } catch (Exception ex) { _dataProvider.RollbackTransaction(); this.ErrorArray.Add(ex); } }
public void SetUp() { broker = new OLEDBPersistBroker("Provider=OraOLEDB.Oracle.1;Password=emes;Persist Security Info=True;User ID=emes;Data Source=sqcdemo"); facade = new ShiftModelFacade(); }
private Domain.TS.TS GetNewTS(string runningCard, string partItemCode, string partRunningCard, string userCode) { SystemSettingFacade systemSettingFacade = new SystemSettingFacade(this.DataProvider); ShiftModelFacade shiftModelFacade = new ShiftModelFacade(this.DataProvider); ModelFacade modelFacade = new ModelFacade(this.DataProvider); TSFacade tsFacade = new TSFacade(this.DataProvider); DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider); string sourceRCard = dataCollectFacade.GetSourceCard(runningCard.Trim().ToUpper(), string.Empty); DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); SimulationReport lastSimulation = dataCollectFacade.GetLastSimulationReport(sourceRCard); if (lastSimulation == null) { return(null); } Domain.TS.TS newTS = tsFacade.CreateNewTS(); newTS.TSId = Guid.NewGuid().ToString(); newTS.RunningCard = partRunningCard; newTS.RunningCardSequence = dataCollectFacade.GetMaxRCardSequenceFromTS(partRunningCard) + 100; newTS.TranslateCard = partRunningCard; newTS.TranslateCardSequence = newTS.RunningCardSequence; newTS.SourceCard = partRunningCard; newTS.SourceCardSequence = newTS.RunningCardSequence; newTS.CardType = CardType.CardType_Part; newTS.ReplacedRunningCard = " "; newTS.ItemCode = partItemCode; Model model = (Model)modelFacade.GetModelByItemCode(partItemCode); if (model == null) { Parameter parameter = (Parameter)systemSettingFacade.GetParameter("PING", "DEFAULT_MODEL_CODE"); if (parameter != null) { newTS.ModelCode = parameter.ParameterAlias.Trim().ToUpper(); } } else { newTS.ModelCode = model.ModelCode; } newTS.MOCode = lastSimulation.MOCode; newTS.FromRouteCode = lastSimulation.RouteCode; newTS.FromOPCode = lastSimulation.OPCode; newTS.FromResourceCode = lastSimulation.ResourceCode; newTS.FromSegmentCode = lastSimulation.SegmentCode; newTS.FromStepSequenceCode = lastSimulation.StepSequenceCode; newTS.FromShiftTypeCode = lastSimulation.ShiftTypeCode; newTS.MOSeq = lastSimulation.MOSeq; TimePeriod tp = (TimePeriod)shiftModelFacade.GetTimePeriod(newTS.FromShiftTypeCode, dbDateTime.DBTime); if (tp != null) { newTS.FromTimePeriodCode = tp.TimePeriodCode; newTS.FromShiftCode = tp.ShiftCode; newTS.FromShiftDay = shiftModelFacade.GetShiftDay(tp, dbDateTime.DateTime); } newTS.FromUser = userCode; newTS.FromDate = dbDateTime.DBDate; newTS.FormTime = dbDateTime.DBTime; newTS.MaintainUser = userCode; newTS.MaintainDate = dbDateTime.DBDate; newTS.MaintainTime = dbDateTime.DBTime; newTS.TSTimes = tsFacade.GetMaxTSTimes(partRunningCard) + 1; newTS.FromInputType = TSSource.TSSource_TS; newTS.TSStatus = TSStatus.TSStatus_New; newTS.TransactionStatus = TransactionStatus.TransactionStatus_NO; return(newTS); }
protected override bool ValidateInput() { PageCheckManager manager = new PageCheckManager(); manager.Add(new DateCheck(this.lblDate, this.dateDateFrom.Text, true)); manager.Add(new LengthCheck(lblBigSSCodeGroup, txtBigSSCodeGroup, 40, true)); manager.Add(new LengthCheck(lblMOEdit, txtMOEdit, 40, true)); manager.Add(new LengthCheck(lblMactureSeq, txtMactureSeq, 10, true)); manager.Add(new LengthCheck(lblMOSeqEdit, txtMOSeqEdit, 10, true)); manager.Add(new DecimalCheck(lblPlanInQTYEdit, txtPlanInQTYEdit, 0, 9999999999, true)); manager.Add(new TimeRangeCheck(this.lblPlanInStartDateEdit, this.timeFrom.Text, this.timeFrom.Text, true)); if (this.txtMOSeqEdit.Text.Trim().Length > 0) { manager.Add(new NumberCheck(lblMOSeqEdit, txtMOSeqEdit, 0, 9999999999, true)); } if (this.txtMactureSeq.Text.Trim().Length > 0) { manager.Add(new NumberCheck(lblMactureSeq, txtMactureSeq, 0, 9999999999, true)); } if (!manager.Check()) { WebInfoPublish.Publish(this, manager.CheckMessage, this.languageComponent1); return(false); } if (_MoFacade == null) { _MoFacade = new MOFacade(base.DataProvider); } object objMo = _MoFacade.GetMO(FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtMOEdit.Text))); if (objMo == null) { WebInfoPublish.Publish(this, "$CS_MO_Not_Exist", languageComponent1); return(false); } if (_Facade == null) { _Facade = new MaterialFacade(base.DataProvider); } ShiftModelFacade shiftModelFacade = new ShiftModelFacade(base.DataProvider); DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(base.DataProvider); WorkPlan GetWorkPlanByKeys = (WorkPlan)_Facade.GetWorkPlan(FormatHelper.PKCapitalFormat(FormatHelper.CleanString(txtBigSSCodeGroup.Text)), FormatHelper.TODateInt(FormatHelper.CleanString(this.dateDateFrom.Date_String)), FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtMOEdit.Text)), int.Parse(FormatHelper.CleanString(this.txtMOSeqEdit.Text))); WorkPlan GetWorkPlanByUnipues = (WorkPlan)_Facade.GetWorkPlan(FormatHelper.PKCapitalFormat(FormatHelper.CleanString(txtBigSSCodeGroup.Text)), FormatHelper.TODateInt(FormatHelper.CleanString(this.dateDateFrom.Date_String)), int.Parse(FormatHelper.CleanString(this.txtMactureSeq.Text))); if (GetWorkPlanByKeys == null && GetWorkPlanByUnipues != null) { WebInfoPublish.PublishInfo(this, "$date__isunique", languageComponent1); return(false); } if (GetWorkPlanByKeys != null && GetWorkPlanByUnipues != null) { if (GetWorkPlanByKeys.BigSSCode != GetWorkPlanByUnipues.BigSSCode || GetWorkPlanByKeys.PlanDate != GetWorkPlanByUnipues.PlanDate || GetWorkPlanByKeys.MoCode != GetWorkPlanByUnipues.MoCode || GetWorkPlanByKeys.MoSeq != GetWorkPlanByUnipues.MoSeq) { WebInfoPublish.PublishInfo(this, "$date__isunique", languageComponent1); return(false); } } int shiftDay = shiftModelFacade.GetShiftDayByBigSSCode( FormatHelper.PKCapitalFormat(FormatHelper.CleanString(txtBigSSCodeGroup.Text)), dbDateTime.DateTime); if (FormatHelper.TODateInt(FormatHelper.CleanString(this.dateDateFrom.Date_String)) < shiftDay) { WebInfoPublish.PublishInfo(this, "$if_date_cannotmodify", languageComponent1); return(false); } return(true); }
public Messages Execute(ActionEventArgs actionEventArgs) { Messages messages = new Messages(); DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect"); dataCollectDebug.WhenFunctionIn(messages); try { ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider); //填写SIMULATION 检查工单、ID、途程、操作 // 联美兰达的下料不检查途程 //messages.AddMessages( dataCollect.CheckID(actionEventArgs)); if (messages.IsSuccess()) { // 联美兰达下料不更新Simulation //messages.AddMessages( dataCollect.Execute(actionEventArgs)); if (messages.IsSuccess()) { /* 由于界面上会自动调用GOOD采集,因此不用写报表 * //填写测试报表 * ReportHelper reportCollect= new ReportHelper(this.DataProvider); * messages.AddMessages(reportCollect.ReportLineQuanMaster(this.DataProvider,actionEventArgs.ActionType,actionEventArgs.ProductInfo)); * messages.AddMessages(reportCollect.ReportResQuanMaster(this.DataProvider,actionEventArgs.ActionType,actionEventArgs.ProductInfo)); */ //Laws Lu,2005/10/20,新增 使用配置文件来控制物料模块是否使用 if (System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"].Trim() == "1") { BenQGuru.eMES.Material.CastDownHelper castHelper = new BenQGuru.eMES.Material.CastDownHelper(DataProvider); ArrayList arRcard = new ArrayList(); castHelper.GetAllRCardByMo(ref arRcard, actionEventArgs.ProductInfo.NowSimulation.RunningCard, actionEventArgs.ProductInfo.NowSimulation.MOCode); if (arRcard.Count == 0) { arRcard.Add(actionEventArgs.RunningCard); } string runningCards = "('" + String.Join("','", (string[])arRcard.ToArray(typeof(string))) + "')"; object[] objs = (actionEventArgs as DropMaterialEventArgs).OnwipItems; //下料并归还库房 BenQGuru.eMES.Material.WarehouseFacade wfacade = new BenQGuru.eMES.Material.WarehouseFacade(this.DataProvider); wfacade.RemoveWarehouse( objs , runningCards , actionEventArgs.ProductInfo.NowSimulation.MOCode , actionEventArgs.UserCode , actionEventArgs.ProductInfo.NowSimulationReport.StepSequenceCode , actionEventArgs.ProductInfo.NowSimulation.OPCode); } else // Added by Icyer 2006/11/16 { DropMaterialEventArgs arg = (DropMaterialEventArgs)actionEventArgs; if (arg.OnwipItems != null) { // 查询需要管控的KeyPart ArrayList listKeyPart = new ArrayList(); ArrayList listAllKeyPart = new ArrayList(); //ArrayList partsToUnload = new ArrayList(); //ArrayList partsToReplace = new ArrayList(); //for (int i = 0; i < arg.OnwipItems.Length; i++) //{ // BenQGuru.eMES.Material.InnoObject io = (BenQGuru.eMES.Material.InnoObject)arg.OnwipItems[i]; // if (io.NewBarcode.Trim().Length > 0) // partsToReplace.Add(io); // else // partsToUnload.Add(io); //} string sql = string.Empty; CastDownHelper castDownHelper = new CastDownHelper(DataProvider); BaseModelFacade baseModelFacade = new BaseModelFacade(this.DataProvider); DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider); ShiftModelFacade shiftModelFacade = new ShiftModelFacade(this.DataProvider); DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); foreach (InnoObject io in arg.OnwipItems) { //获取arRcard ArrayList arRcard = new ArrayList(); castDownHelper.GetAllRCard(ref arRcard, actionEventArgs.ProductInfo.NowSimulation.RunningCard); if (arRcard.Count == 0) { arRcard.Add(actionEventArgs.RunningCard); } //获取dropop Operation2Resource objOP = baseModelFacade.GetOperationByResource(arg.ResourceCode); string dropop = string.Empty; if (objOP != null) { dropop = objOP.OPCode; } #region 针对旧料所作的动作 string runningCards = "('" + String.Join("','", (string[])arRcard.ToArray(typeof(string))) + "')"; sql = string.Format("update TBLONWIPITEM set TRANSSTATUS='{0}',ActionType=" + (int)MaterialType.DropMaterial + ",DropOP = '" + dropop + "'" + ",DropUser='******'" + ",DropDate=" + dbDateTime.DBDate + ",DropTime=" + dbDateTime.DBTime + " where RCARD in {1} and ActionType='{2}'" + " and MCARD in ('" + io.MCard.Trim().ToUpper() + "')" , TransactionStatus.TransactionStatus_YES , runningCards , (int)Web.Helper.MaterialType.CollectMaterial); this.DataProvider.CustomExecute(new SQLCondition(sql)); if (io.MCardType == MCardType.MCardType_Keyparts) { sql = "update TBLSIMULATIONREPORT set IsLoadedPart='0',LoadedRCard='' " + " where RCARD in ('" + io.MCard.Trim().ToUpper() + "')"; this.DataProvider.CustomExecute(new SQLCondition(sql)); sql = "update TBLITEMLOTDETAIL set SERIALSTATUS='STORAGE' " + " where SERIALNO in ('" + io.MCard.Trim().ToUpper() + "')"; this.DataProvider.CustomExecute(new SQLCondition(sql)); } #endregion #region 针对新料所做的动作 if (io.NewBarcode.Trim().Length > 0) { object[] oldOnWIPItemList = dataCollectFacade.QueryOnWIPItem(io.MCard, runningCards, ((int)Web.Helper.MaterialType.DropMaterial).ToString()); if (oldOnWIPItemList != null && oldOnWIPItemList.Length > 0) { OnWIPItem oldOnWIPItem = (OnWIPItem)oldOnWIPItemList[0]; OnWIPItem newOnWIPItem = dataCollectFacade.CreateNewOnWIPItem(); newOnWIPItem.RunningCard = oldOnWIPItem.RunningCard; newOnWIPItem.MSequence = oldOnWIPItem.MSequence; newOnWIPItem.MOCode = oldOnWIPItem.MOCode; newOnWIPItem.ModelCode = oldOnWIPItem.ModelCode; newOnWIPItem.ItemCode = oldOnWIPItem.ItemCode; newOnWIPItem.MItemCode = oldOnWIPItem.MItemCode; newOnWIPItem.MCardType = oldOnWIPItem.MCardType; newOnWIPItem.Qty = oldOnWIPItem.Qty; newOnWIPItem.RouteCode = oldOnWIPItem.RouteCode; newOnWIPItem.OPCode = oldOnWIPItem.OPCode; newOnWIPItem.ResourceCode = oldOnWIPItem.ResourceCode; newOnWIPItem.SegmentCode = oldOnWIPItem.SegmentCode; newOnWIPItem.StepSequenceCode = oldOnWIPItem.StepSequenceCode; newOnWIPItem.EAttribute1 = oldOnWIPItem.EAttribute1; newOnWIPItem.MOSeq = oldOnWIPItem.MOSeq; newOnWIPItem.MCARD = io.NewBarcode; newOnWIPItem.LotNO = io.NewLotNo; newOnWIPItem.PCBA = io.NewPCBA; newOnWIPItem.BIOS = io.NewBIOS; newOnWIPItem.Version = io.NewVersion; newOnWIPItem.VendorItemCode = io.NewVendorItemCode; newOnWIPItem.VendorCode = io.NewVendorCode; newOnWIPItem.DateCode = io.NewDateCode; newOnWIPItem.TransactionStatus = TransactionStatus.TransactionStatus_NO; newOnWIPItem.ActionType = (int)Web.Helper.MaterialType.CollectMaterial; newOnWIPItem.MaintainUser = actionEventArgs.UserCode; newOnWIPItem.MaintainDate = dbDateTime.DBDate; newOnWIPItem.MaintainTime = dbDateTime.DBTime; //RunningCardSequence取当前RCard的最小再减一 newOnWIPItem.RunningCardSequence = dataCollectFacade.GetMinRCardSequenceFromOnWipItem(runningCards); //重新抓取ShiftTypeCode、ShiftCode、TimePeriodCode StepSequence stepSequence = (StepSequence)baseModelFacade.GetStepSequence(newOnWIPItem.StepSequenceCode); if (stepSequence == null) { newOnWIPItem.ShiftTypeCode = stepSequence.ShiftTypeCode; } else { newOnWIPItem.ShiftTypeCode = oldOnWIPItem.ShiftTypeCode; } TimePeriod timePeriod = (TimePeriod)shiftModelFacade.GetTimePeriod(newOnWIPItem.ShiftTypeCode, dbDateTime.DBTime); if (timePeriod != null) { newOnWIPItem.TimePeriodCode = timePeriod.TimePeriodCode; newOnWIPItem.ShiftCode = timePeriod.ShiftCode; } dataCollectFacade.AddOnWIPItem(newOnWIPItem); } if (io.MCardType == MCardType.MCardType_Keyparts) { sql = "update TBLSIMULATIONREPORT set IsLoadedPart='1',LoadedRCard='" + String.Join(",", (string[])arRcard.ToArray(typeof(string))) + "' " + " where RCARD in ('" + io.NewBarcode.Trim().ToUpper() + "')"; this.DataProvider.CustomExecute(new SQLCondition(sql)); sql = "update TBLITEMLOTDETAIL set SERIALSTATUS='UNSTORAGE' " + " where SERIALNO in ('" + io.NewBarcode.Trim().ToUpper() + "')"; this.DataProvider.CustomExecute(new SQLCondition(sql)); } // Added By Hi1/Venus.feng on 20081114 for Hisense Version : Add Remove Pallet and Carton // 拆箱和拆Pallet DataCollectFacade dcf = new DataCollectFacade(this.DataProvider); if (messages.IsSuccess()) { messages.AddMessages(dcf.RemoveFromPallet(io.NewBarcode.Trim().ToUpper(), actionEventArgs.UserCode, true)); if (messages.IsSuccess()) { messages.ClearMessages(); } } if (messages.IsSuccess()) { messages.AddMessages(dcf.RemoveFromCarton(io.NewBarcode.Trim().ToUpper(), actionEventArgs.UserCode)); if (messages.IsSuccess()) { messages.ClearMessages(); } } // End Added } #endregion } } } } } } catch (Exception e) { messages.Add(new Message(e)); } dataCollectDebug.WhenFunctionOut(messages); return(messages); }
/// <summary> /// /// </summary> /// <param name="oqcGoodEventArgs"> </param> params (0,lotno) /// <returns></returns> public Messages Execute(ActionEventArgs actionEventArgs) { Messages messages = new Messages(); DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect"); dataCollectDebug.WhenFunctionIn(messages); OQCGoodEventArgs oqcGoodEventArgs = actionEventArgs as OQCGoodEventArgs; //added by hiro.chen 08/11/18 :判断是否已下地 DataCollectFacade dcFacade = new DataCollectFacade(this.DataProvider); messages.AddMessages(dcFacade.CheckISDown(actionEventArgs.RunningCard)); if (!messages.IsSuccess()) { return(messages); } //end try { ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider); ActionOQCHelper oqcHelper = new ActionOQCHelper(this.DataProvider); OQCFacade oqcFacade = new OQCFacade(this.DataProvider); // Added By Hi1/Venus.feng on 20080720 for Hisense Version : Change OQC Flow DBDateTime currentDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); // Some Check #region CheckOQCLotStatus /* * object objOQClot = oqcFacade.GetOQCLot(oqcGoodEventArgs.OQCLotNO, OQCFacade.Lot_Sequence_Default); * if (objOQClot == null) * { * throw new Exception("$Error_OQCLotNotExisted"); * } * if (((OQCLot)objOQClot).LOTStatus == OQCLotStatus.OQCLotStatus_Initial) * { * throw new Exception("$Error_OQCLotNO_Cannot_Initial"); * } * if ((((OQCLot)objOQClot).LOTStatus == OQCLotStatus.OQCLotStatus_Reject) || ((((OQCLot)objOQClot).LOTStatus == OQCLotStatus.OQCLotStatus_Pass))) * { * throw new Exception("$Error_OQCLotNO_HasComplete"); * } */ #endregion // Update tbloqc.status #region 修改OQCLot状态 OQCLot oqcLot = new OQCLot(); oqcLot.LOTNO = oqcGoodEventArgs.OQCLotNO; oqcLot.LotSequence = OQCFacade.Lot_Sequence_Default; oqcLot.LOTStatus = Web.Helper.OQCLotStatus.OQCLotStatus_Examing; oqcFacade.UpdateOQCLotStatus(oqcLot); #endregion // Update tbloqccardlotcklist //Maybe need check???? #region OQCLOTCardCheckList if (oqcGoodEventArgs.OQCLOTCardCheckLists != null) { OQCLOTCardCheckList oqcLotCardCheckList; for (int i = 0; i < oqcGoodEventArgs.OQCLOTCardCheckLists.Length; i++) { if (oqcGoodEventArgs.OQCLOTCardCheckLists[i] != null) { oqcLotCardCheckList = oqcGoodEventArgs.OQCLOTCardCheckLists[i] as OQCLOTCardCheckList; oqcLotCardCheckList.MaintainDate = currentDateTime.DBDate; oqcLotCardCheckList.MaintainTime = currentDateTime.DBTime; oqcFacade.AddOQCLOTCardCheckList(oqcLotCardCheckList); } } } #endregion // Update tbloqclotcklist #region OQCLOTCheckList object obj = oqcFacade.GetOQCLOTCheckList(oqcGoodEventArgs.OQCLotNO, OQCFacade.Lot_Sequence_Default); if (obj == null) { OQCLOTCheckList oqcCheckList = oqcFacade.CreateNewOQCLOTCheckList(); oqcCheckList.AGradeTimes = OQCFacade.Decimal_Default_value; oqcCheckList.BGradeTimes = OQCFacade.Decimal_Default_value; oqcCheckList.CGradeTimes = OQCFacade.Decimal_Default_value; oqcCheckList.ZGradeTimes = OQCFacade.Decimal_Default_value; oqcCheckList.LOTNO = oqcGoodEventArgs.OQCLotNO; oqcCheckList.LotSequence = OQCFacade.Lot_Sequence_Default; oqcCheckList.MaintainUser = oqcGoodEventArgs.UserCode; oqcCheckList.MaintainDate = currentDateTime.DBDate; oqcCheckList.MaintainTime = currentDateTime.DBTime; oqcCheckList.Result = OQCLotStatus.OQCLotStatus_Examing; oqcFacade.AddOQCLOTCheckList(GetDefectStatic(oqcGoodEventArgs.OQCLOTCardCheckLists, oqcCheckList)); } else { OQCLOTCheckList oqcCheckList = obj as OQCLOTCheckList; oqcCheckList.MaintainUser = oqcGoodEventArgs.UserCode; oqcFacade.UpdateOQCLOTCheckList(GetDefectStatic(oqcGoodEventArgs.OQCLOTCardCheckLists, oqcCheckList)); } #endregion // Update tbllot2cardcheck #region OQCLot2CardCheck OQCLot2CardCheck oqcLot2CardCheck = oqcFacade.CreateNewOQCLot2CardCheck(); oqcLot2CardCheck.ItemCode = oqcGoodEventArgs.ProductInfo.LastSimulation.ItemCode; oqcLot2CardCheck.LOTNO = oqcGoodEventArgs.OQCLotNO; oqcLot2CardCheck.MaintainUser = oqcGoodEventArgs.UserCode; oqcLot2CardCheck.MOCode = oqcGoodEventArgs.ProductInfo.LastSimulation.MOCode; oqcLot2CardCheck.ModelCode = oqcGoodEventArgs.ProductInfo.LastSimulation.ModelCode; oqcLot2CardCheck.OPCode = oqcGoodEventArgs.ProductInfo.LastSimulation.OPCode; oqcLot2CardCheck.ResourceCode = oqcGoodEventArgs.ResourceCode; oqcLot2CardCheck.RouteCode = oqcGoodEventArgs.ProductInfo.LastSimulation.RouteCode; oqcLot2CardCheck.RunningCard = oqcGoodEventArgs.ProductInfo.LastSimulation.RunningCard; oqcLot2CardCheck.RunningCardSequence = oqcGoodEventArgs.ProductInfo.LastSimulation.RunningCardSequence; BaseModelFacade dataModel = new BaseModelFacade(this.DataProvider); Resource resource = (Resource)dataModel.GetResource(oqcGoodEventArgs.ResourceCode); oqcLot2CardCheck.SegmnetCode = resource.SegmentCode; TimePeriod period = oqcGoodEventArgs.ProductInfo.TimePeriod; if (period == null) { ShiftModelFacade shiftModel = new ShiftModelFacade(this.DataProvider); period = (TimePeriod)shiftModel.GetTimePeriod(resource.ShiftTypeCode, currentDateTime.DBTime); if (period == null) { throw new Exception("$OutOfPerid"); } } oqcLot2CardCheck.ShiftCode = period.ShiftCode; oqcLot2CardCheck.ShiftTypeCode = resource.ShiftTypeCode; oqcLot2CardCheck.Status = ProductStatus.GOOD; oqcLot2CardCheck.StepSequenceCode = resource.StepSequenceCode; oqcLot2CardCheck.TimePeriodCode = period.TimePeriodCode; oqcLot2CardCheck.IsDataLink = oqcGoodEventArgs.IsDataLink; oqcLot2CardCheck.MaintainDate = currentDateTime.DBDate; oqcLot2CardCheck.MaintainTime = currentDateTime.DBTime; oqcLot2CardCheck.CheckSequence = oqcGoodEventArgs.CheckSequence; oqcLot2CardCheck.EAttribute1 = oqcGoodEventArgs.Memo; oqcFacade.AddOQCLot2CardCheck(oqcLot2CardCheck); #endregion // Good don't need update lot2errorcode or lotcard2errorcode ////// Update tbloqclot2errorcode ////// Update tbloqclotcard2errorcode messages.Add(new Message(MessageType.Success, "$CS_SampleConfirmOK")); // End Added #region Marked By Hi1/Venus.Feng on 20080720 for Hisense Version : Change OQC Flow /* * //填写SIMULATION 检查工单、ID、途程、操作 * messages.AddMessages( dataCollect.CheckID(oqcGoodEventArgs)); * if (messages.IsSuccess()) * { * // * if(oqcGoodEventArgs.ProductInfo.NowSimulation == null) * { * throw new Exception("$System_Error"); * } * //check oqclotstatus #region CheckOQCLotStatus * // object objOQClot = oqcFacade.GetOQCLot(oqcGoodEventArgs.OQCLotNO,OQCFacade.Lot_Sequence_Default); * // if(objOQClot == null) * // { * // throw new Exception("$Error_OQCLotNotExisted"); * // } * // if( ((OQCLot)objOQClot).LOTStatus == OQCLotStatus.OQCLotStatus_Initial) * // { * // throw new Exception("$Error_OQCLotNO_Cannot_Initial"); * // } * // if( (((OQCLot)objOQClot).LOTStatus == OQCLotStatus.OQCLotStatus_Reject)||((((OQCLot)objOQClot).LOTStatus == OQCLotStatus.OQCLotStatus_Pass) ) ) * // { * // throw new Exception("$Error_OQCLotNO_HasComplete"); * // } #endregion * * * messages.AddMessages( dataCollect.Execute(oqcGoodEventArgs)); * if (messages.IsSuccess()) * { * //判断是否第一笔,如果是修改oqclot #region 修改OQCLot状态 * // object[] objs = oqcFacade.ExtraQueryOQCLot2CardCheck(string.Empty,string.Empty,oqcGoodEventArgs.ProductInfo.NowSimulation.MOCode,oqcGoodEventArgs.OQCLotNO,OQCFacade.Lot_Sequence_Default.ToString()); * // if(objs == null) * // { * //object objLot = oqcFacade.GetOQCLot(oqcGoodEventArgs.OQCLotNO,OQCFacade.Lot_Sequence_Default); * OQCLot oqcLot = new OQCLot(); * oqcLot.LOTNO = oqcGoodEventArgs.OQCLotNO; * oqcLot.LotSequence = OQCFacade.Lot_Sequence_Default; * oqcLot.LOTStatus = Web.Helper.OQCLotStatus.OQCLotStatus_Examing; * oqcFacade.UpdateOQCLotStatus(oqcLot); * // } #endregion * * //add recrod to OQCLot2CardCheck #region OQCLot2CardCheck * OQCLot2CardCheck oqcLot2CardCheck = oqcFacade.CreateNewOQCLot2CardCheck(); * oqcLot2CardCheck.ItemCode = oqcGoodEventArgs.ProductInfo.NowSimulation.ItemCode; * oqcLot2CardCheck.LOTNO = oqcGoodEventArgs.OQCLotNO; * oqcLot2CardCheck.MaintainUser = oqcGoodEventArgs.UserCode; * oqcLot2CardCheck.MOCode = oqcGoodEventArgs.ProductInfo.NowSimulation.MOCode; * oqcLot2CardCheck.ModelCode = oqcGoodEventArgs.ProductInfo.NowSimulation.ModelCode; * oqcLot2CardCheck.OPCode = oqcGoodEventArgs.ProductInfo.NowSimulation.OPCode; * oqcLot2CardCheck.ResourceCode = oqcGoodEventArgs.ProductInfo.NowSimulation.ResourceCode; * oqcLot2CardCheck.RouteCode = oqcGoodEventArgs.ProductInfo.NowSimulation.RouteCode; * oqcLot2CardCheck.RunningCard = oqcGoodEventArgs.ProductInfo.NowSimulation.RunningCard; * oqcLot2CardCheck.RunningCardSequence = oqcGoodEventArgs.ProductInfo.NowSimulation.RunningCardSequence; * oqcLot2CardCheck.SegmnetCode = oqcGoodEventArgs.ProductInfo.NowSimulationReport.SegmentCode; * oqcLot2CardCheck.ShiftCode = oqcGoodEventArgs.ProductInfo.NowSimulationReport.ShiftCode; * oqcLot2CardCheck.ShiftTypeCode = oqcGoodEventArgs.ProductInfo.NowSimulationReport.ShiftTypeCode; * oqcLot2CardCheck.Status = ProductStatus.GOOD; * oqcLot2CardCheck.StepSequenceCode = oqcGoodEventArgs.ProductInfo.NowSimulationReport.StepSequenceCode; * oqcLot2CardCheck.TimePeriodCode = oqcGoodEventArgs.ProductInfo.NowSimulationReport.TimePeriodCode; * * oqcLot2CardCheck.IsDataLink = oqcGoodEventArgs.IsDataLink; //标识样本是不是来自数据连线 joe song 2006-06-08 * oqcLot2CardCheck.EAttribute1 = (oqcGoodEventArgs as OQCGoodEventArgs).Memo;//Laws Lu,2006/07/12 add memo field * * DBDateTime dbDateTime; * //Laws Lu,2006/11/13 uniform system collect date * if(actionEventArgs.ProductInfo.WorkDateTime != null) * { * dbDateTime = actionEventArgs.ProductInfo.WorkDateTime; * * } * else * { * dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider); * actionEventArgs.ProductInfo.WorkDateTime = dbDateTime; * } * * oqcLot2CardCheck.MaintainDate = dbDateTime.DBDate; * oqcLot2CardCheck.MaintainTime = dbDateTime.DBTime; * oqcFacade.AddOQCLot2CardCheck(oqcLot2CardCheck); #endregion * * //OQCLOTCardCheckList * #region OQCLOTCardCheckList * if( oqcGoodEventArgs.OQCLOTCardCheckLists != null) * { * for(int i=0;i<oqcGoodEventArgs.OQCLOTCardCheckLists.Length;i++) * { * if( oqcGoodEventArgs.OQCLOTCardCheckLists[i] != null) * { * OQCLOTCardCheckList objCardCheck = oqcGoodEventArgs.OQCLOTCardCheckLists[i] as OQCLOTCardCheckList; * objCardCheck.RunningCardSequence = oqcGoodEventArgs.ProductInfo.NowSimulation.RunningCardSequence; * oqcFacade.AddOQCLOTCardCheckList(objCardCheck); * } * } * } #endregion * * //OQCLOTCheckList 统计 #region OQCLOTCheckList * * * object obj = oqcFacade.GetOQCLOTCheckList(oqcGoodEventArgs.OQCLotNO,OQCFacade.Lot_Sequence_Default); * if(obj == null) * { * OQCLOTCheckList oqcCheckList = oqcFacade.CreateNewOQCLOTCheckList(); * oqcCheckList.AGradeTimes = OQCFacade.Decimal_Default_value; * oqcCheckList.BGradeTimes = OQCFacade.Decimal_Default_value; * oqcCheckList.CGradeTimes = OQCFacade.Decimal_Default_value; * oqcCheckList.LOTNO = oqcGoodEventArgs.OQCLotNO; * oqcCheckList.LotSequence = OQCFacade.Lot_Sequence_Default; * oqcCheckList.MaintainUser = oqcGoodEventArgs.UserCode; * oqcCheckList.MaintainDate = dbDateTime.DBDate; * oqcCheckList.MaintainTime = dbDateTime.DBTime; * oqcCheckList.Result = OQCLotStatus.OQCLotStatus_Examing; * * oqcFacade.AddOQCLOTCheckList(GetDefectStatic(oqcGoodEventArgs.OQCLOTCardCheckLists,oqcCheckList)); * } * else * { * OQCLOTCheckList oqcCheckList = obj as OQCLOTCheckList; * oqcCheckList.MaintainUser = oqcGoodEventArgs.UserCode; * * oqcFacade.UpdateOQCLOTCheckList(GetDefectStatic(oqcGoodEventArgs.OQCLOTCardCheckLists,oqcCheckList)); * } #endregion * * // #region this is for report add by crystal chu 2005/07/25 * // ReportHelper reportCollect= new ReportHelper(this.DataProvider); * // messages.AddMessages(reportCollect.ReportLineQuanMaster(this.DataProvider,oqcGoodEventArgs.ActionType,oqcGoodEventArgs.ProductInfo)); * // #endregion * * * } * } */ #endregion } catch (Exception e) { messages.Add(new Message(e)); } dataCollectDebug.WhenFunctionOut(messages); return(messages); }