protected override void AddDomainObject(object domainObject) { if (_facade == null) { _facade = new MaterialFacade(this.DataProvider); } DBDateTime dBDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); MaterialIssue materialIssue = domainObject as MaterialIssue; this._facade.AddMaterialIssue(materialIssue); WorkPlan workPlan = (WorkPlan)_facade.GetWorkPlan(materialIssue.BigSSCode, materialIssue.PlanDate, materialIssue.MoCode, materialIssue.MoSeq); if (workPlan != null) { workPlan.MaterialStatus = MaterialWarningStatus.MaterialWarningStatus_Responsed; workPlan.PromiseTime = dBDateTime.DBTime; _facade.UpdateWorkPlan(workPlan); } this.txtRationNumberEdit.Text = string.Empty; }
private void DoSuitInButton(string workPlanActionStatus) { if (_facade == null) { _facade = new MaterialFacade(this.DataProvider); } ArrayList arryList = this.gridHelper.GetCheckedRows(); if (arryList.Count == 0) { WebInfoPublish.Publish(this, "$CS_CHOOSE_ONE_RECORD_AT_LEAST", languageComponent1); return; } List <WorkPlan> workPlanList = new List <WorkPlan>(); DBDateTime dBDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); foreach (UltraGridRow row in arryList) { if (row.Cells.FromKey("ActionStatus").Text == this.languageComponent1.GetString(WorkPlanActionStatus.WorkPlanActionStatus_Close) || row.Cells.FromKey("ActionStatus").Text == this.languageComponent1.GetString(WorkPlanActionStatus.WorkPlanActionStatus_Open)) { WebInfoPublish.Publish(this, "$WorkPlanActionStatus_Not_Right", languageComponent1); return; } if (row.Cells.FromKey("ActionStatus").Text.Trim() == this.languageComponent1.GetString(workPlanActionStatus)) { WorkPlan workPlan = (WorkPlan)_facade.GetWorkPlan(row.Cells.FromKey("BigSSCode").Text, FormatHelper.TODateInt(Convert.ToDateTime(row.Cells.FromKey("MaterialPlanDate").Text)), row.Cells.FromKey("MoCode").Text, Convert.ToDecimal(row.Cells.FromKey("MoSeq").Text.Trim())); if (workPlan != null) { if (workPlanActionStatus == WorkPlanActionStatus.WorkPlanActionStatus_Ready) { workPlan.ActionStatus = WorkPlanActionStatus.WorkPlanActionStatus_Init; } else { workPlan.ActionStatus = WorkPlanActionStatus.WorkPlanActionStatus_Ready; } workPlan.MaintainDate = dBDateTime.DBDate; workPlan.MaintainTime = dBDateTime.DBTime; workPlanList.Add(workPlan); } } } if (workPlanList.Count > 0) { try { this.DataProvider.BeginTransaction(); for (int i = 0; i < workPlanList.Count; i++) { WorkPlan workPlanToUpdate = workPlanList[i] as WorkPlan; _facade.UpdateWorkPlan(workPlanToUpdate); } this.DataProvider.CommitTransaction(); } catch (Exception ex) { this.DataProvider.RollbackTransaction(); WebInfoPublish.Publish(this, ex.Message, this.languageComponent1); } } }
protected void cmdSaveTotal_ServerClick(object sender, EventArgs e) { if (_facade == null) { _facade = new MaterialFacade(this.DataProvider); } if (this.gridHelper.GetCheckedRows().Count < 1) { WebInfoPublish.PublishInfo(this, "$CS_GRID_SELECT_ONE_RECORD", this.languageComponent1); return; } if (!CheckGridValue()) { return; } ArrayList rowList = this.gridHelper.GetCheckedRows(); decimal materialTransNumber = 0; DBDateTime dBDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); try { this.DataProvider.BeginTransaction(); foreach (UltraGridRow row in rowList) { //更新的oldWorkPlan的MaterialQty WorkPlan oldWorkPlan = (WorkPlan)_facade.GetWorkPlan(row.Cells[2].Text.Trim(), Convert.ToInt32(row.Cells[1].Text), row.Cells[4].Text.Trim(), Convert.ToDecimal(row.Cells[5].Text.Trim())); if (oldWorkPlan != null) { oldWorkPlan.MaterialQty = oldWorkPlan.MaterialQty - Convert.ToDecimal(row.Cells[11].Text.Trim()); } _facade.UpdateWorkPlan(oldWorkPlan); //end //新增转出Trans MaterialIssue newOutMaterialIssue = new MaterialIssue(); newOutMaterialIssue.BigSSCode = row.Cells[2].Text.Trim(); newOutMaterialIssue.PlanDate = Convert.ToInt32(row.Cells[1].Text); newOutMaterialIssue.MoCode = row.Cells[4].Text.Trim(); newOutMaterialIssue.MoSeq = Convert.ToDecimal(row.Cells[5].Text.Trim()); newOutMaterialIssue.IssueSEQ = _facade.GetMaterialIssueMaxIssueSEQ(newOutMaterialIssue.BigSSCode, newOutMaterialIssue.PlanDate, newOutMaterialIssue.MoCode, newOutMaterialIssue.MoSeq); newOutMaterialIssue.IssueQTY = Convert.ToDecimal(row.Cells[11].Text.Trim()); newOutMaterialIssue.IssueType = MaterialIssueType.MaterialIssueType_LineTransferOut; newOutMaterialIssue.IssueStatus = MaterialIssueStatus.MaterialIssueStatus_Close; newOutMaterialIssue.MaintainUser = this.GetUserCode(); newOutMaterialIssue.MaintainDate = dBDateTime.DBDate; newOutMaterialIssue.MaintainTime = dBDateTime.DBTime; _facade.AddMaterialIssue(newOutMaterialIssue); //end materialTransNumber += Convert.ToDecimal(row.Cells[11].Text.Trim()); } //新增转入Trans MaterialIssue newInMaterialIssue = new MaterialIssue(); newInMaterialIssue.BigSSCode = ViewState["bigSSCode"].ToString(); newInMaterialIssue.PlanDate = Convert.ToInt32(ViewState["planDate"].ToString()); newInMaterialIssue.MoCode = this.txtMOEdit.Text.Trim().ToUpper(); newInMaterialIssue.MoSeq = Convert.ToDecimal(ViewState["moSeq"].ToString()); newInMaterialIssue.IssueSEQ = _facade.GetMaterialIssueMaxIssueSEQ(newInMaterialIssue.BigSSCode, newInMaterialIssue.PlanDate, newInMaterialIssue.MoCode, newInMaterialIssue.MoSeq); newInMaterialIssue.IssueQTY = materialTransNumber; newInMaterialIssue.IssueType = MaterialIssueType.MaterialIssueType_LineTransferIn; newInMaterialIssue.IssueStatus = MaterialIssueStatus.MaterialIssueStatus_Close; newInMaterialIssue.MaintainUser = this.GetUserCode(); newInMaterialIssue.MaintainDate = dBDateTime.DBDate; newInMaterialIssue.MaintainTime = dBDateTime.DBTime; _facade.AddMaterialIssue(newInMaterialIssue); //end //更新BigSSCode+MoCode所有的预警信息 object[] workPlanObjects = _facade.QueryWorkPlan(ViewState["bigSSCode"].ToString(), this.txtMOEdit.Text.Trim().ToUpper()); if (workPlanObjects != null) { for (int j = 0; j < workPlanObjects.Length; j++) { WorkPlan workPlanUpdate = workPlanObjects[j] as WorkPlan; //更新当前项次的数量 if (workPlanUpdate.PlanDate == Convert.ToInt32(ViewState["planDate"].ToString()) && workPlanUpdate.MoSeq == Convert.ToDecimal(ViewState["moSeq"].ToString())) { workPlanUpdate.MaterialQty += materialTransNumber; } workPlanUpdate.LastReceiveTime = dBDateTime.DBTime; workPlanUpdate.LastReqTime = 0; workPlanUpdate.PromiseTime = 0; workPlanUpdate.MaterialStatus = MaterialWarningStatus.MaterialWarningStatus_No; _facade.UpdateWorkPlan(workPlanUpdate); } } _facade.UpdateMaterialReqInfo(ViewState["bigSSCode"].ToString(), this.txtMOEdit.Text.Trim().ToUpper()); //end this.DataProvider.CommitTransaction(); } catch (Exception ex) { this.DataProvider.RollbackTransaction(); WebInfoPublish.Publish(this, ex.Message, this.languageComponent1); } this.RequestData(); }