public void Save() { Shift shift = TheShiftMgr.LoadShift(ShiftCode); decimal planQty = this.tbPlanQty.Text.Trim() != string.Empty ? decimal.Parse(this.tbPlanQty.Text) : 0; ShiftPlanSchedule sps = new ShiftPlanSchedule(); if (ShiftPlanScheduleId > 0) { //Update sps = TheShiftPlanScheduleMgr.LoadShiftPlanSchedule(ShiftPlanScheduleId); if (sps.Shift == null) { sps.Shift = shift; } sps.PlanQty = planQty; TheShiftPlanScheduleMgr.UpdateShiftPlanSchedule(sps); } else { if (planQty > 0) { //Create sps.FlowDetail = TheFlowDetailMgr.LoadFlowDetail(FlowDetailId); sps.ReqDate = ReqDate; sps.Shift = shift; sps.Sequence = 0;//todo sps.PlanQty = planQty; sps.LastModifyDate = DateTime.Now; sps.LastModifyUser = this.CurrentUser; TheShiftPlanScheduleMgr.CreateShiftPlanSchedule(sps); } } }
protected void ODS_FlowDetail_Updated(object sender, ObjectDataSourceStatusEventArgs e) { EditEvent(sender, e); FlowDetail flowDetail = TheFlowDetailMgr.LoadFlowDetail(this.FlowDetailId); decimal unitCount = flowDetail.UnitCount; decimal orderLotSize = flowDetail.OrderLotSize == null ? 0 : (decimal)flowDetail.OrderLotSize; if (unitCount != 0 && orderLotSize != 0 && orderLotSize % unitCount != 0) { ShowWarningMessage("MasterData.Flow.FlowDetail.AddFlowDetail.Successfully.UC.Not.Divisible", flowDetail.Sequence.ToString()); } else { ShowSuccessMessage("MasterData.Flow.FlowDetail.UpdateFlowDetail.Successfully", flowDetail.Sequence.ToString()); } }
protected void FV_FlowDetail_DataBound(object sender, EventArgs e) { if (FlowDetailId == 0) { return; } FlowDetail flowDetail = TheFlowDetailMgr.LoadFlowDetail(FlowDetailId); Flow flow = flowDetail.Flow; ((Controls_TextBox)(this.FV_FlowDetail.FindControl("tbItemCode"))).Text = flowDetail.Item.Code; if (flowDetail.Uom != null) { ((Controls_TextBox)(this.FV_FlowDetail.FindControl("tbUom"))).Text = flowDetail.Uom.Code; } Controls_TextBox tbRefItemCode = (Controls_TextBox)(this.FV_FlowDetail.FindControl("tbRefItemCode")); tbRefItemCode.Text = flowDetail.ReferenceItemCode;//djin 20120802 参考物料号 tbRefItemCode.ServiceParameter = "string:#tbItemCode,string:" + flow.PartyFrom.Code + ",string:" + flow.PartyTo.Code; tbRefItemCode.DataBind(); if (this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_PROCUREMENT || this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_CUSTOMERGOODS || this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_SUBCONCTRACTING) { this.FV_FlowDetail.FindControl("fdProcurement").Visible = true; Controls_TextBox tbLocTo = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbProcurementLocTo"); tbLocTo.ServiceParameter = "string:" + flow.PartyTo.Code; tbLocTo.DataBind(); tbLocTo.Text = flowDetail.LocationTo == null ? string.Empty : flowDetail.LocationTo.Code; if (this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_PROCUREMENT || this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_SUBCONCTRACTING) { BillSettleTermDataBind(); DropDownList ddlBillSettleTerm = (DropDownList)this.FV_FlowDetail.FindControl("ddlBillSettleTerm"); ddlBillSettleTerm.Text = flowDetail.BillSettleTerm; ddlBillSettleTerm.Visible = true; this.FV_FlowDetail.FindControl("lblBillSettleTerm").Visible = true; ((Literal)this.FV_FlowDetail.FindControl("lblNeedInspect")).Visible = true; ((CheckBox)(this.FV_FlowDetail.FindControl("cbNeedInspect"))).Visible = true; Literal lblIdMark = ((Literal)this.FV_FlowDetail.FindControl("lblIdMark")); TextBox tbIdMark = ((TextBox)this.FV_FlowDetail.FindControl("tbIdMark")); Literal lblBarCodeType = ((Literal)this.FV_FlowDetail.FindControl("lblBarCodeType")); com.Sconit.Control.CodeMstrDropDownList ddlBarCodeType = (com.Sconit.Control.CodeMstrDropDownList) this.FV_FlowDetail.FindControl("ddlBarCodeType"); lblIdMark.Visible = true; tbIdMark.Visible = true; lblBarCodeType.Visible = true; ddlBarCodeType.Visible = true; if (flowDetail.BarCodeType != string.Empty) { ddlBarCodeType.Text = flowDetail.BarCodeType; } } } else if (this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_DISTRIBUTION) { BillSettleTermDataBind(); DropDownList ddlBillSettleTerm = (DropDownList)this.FV_FlowDetail.FindControl("ddlBillSettleTerm"); ddlBillSettleTerm.Text = flowDetail.BillSettleTerm; ddlBillSettleTerm.Visible = true; this.FV_FlowDetail.FindControl("lblBillSettleTerm").Visible = true; DropDownList ddlOddShipOption = (DropDownList)this.FV_FlowDetail.FindControl("ddlOddShipOption"); ddlOddShipOption.Text = flowDetail.OddShipOption; ddlOddShipOption.Visible = true; this.FV_FlowDetail.FindControl("lblOddShipOption").Visible = true; this.FV_FlowDetail.FindControl("fdDistribution").Visible = true; Controls_TextBox tbLocFrom = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbDistributionLocFrom"); tbLocFrom.ServiceParameter = "string:" + flow.PartyFrom.Code; tbLocFrom.DataBind(); tbLocFrom.Text = flowDetail.LocationFrom == null ? string.Empty : flowDetail.LocationFrom.Code; this.FV_FlowDetail.FindControl("fdFordEDIOption").Visible = true; ((System.Web.UI.HtmlControls.HtmlSelect) this.FV_FlowDetail.FindControl("tbPackagingCode")).Value = flowDetail.PackagingCode; ((System.Web.UI.HtmlControls.HtmlSelect) this.FV_FlowDetail.FindControl("tbTransModeCode")).Value = flowDetail.TransModeCode; } else if (this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_PRODUCTION) { this.FV_FlowDetail.FindControl("fdProduction").Visible = true; this.FV_FlowDetail.FindControl("trBom").Visible = true; this.FV_FlowDetail.FindControl("lblCustomer").Visible = true; this.FV_FlowDetail.FindControl("lblCustomerItemCode").Visible = true; this.FV_FlowDetail.FindControl("tbCustomerItemCode").Visible = true; ((Controls_TextBox)this.FV_FlowDetail.FindControl("tbBom")).Text = flowDetail.Bom == null ? string.Empty : flowDetail.Bom.Code; ((TextBox)(this.FV_FlowDetail.FindControl("tbBatchSize"))).Text = string.Empty; Controls_TextBox tbCustomer = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbCustomer"); tbCustomer.ServiceParameter = "string:" + BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_CUSTOMERGOODS + ",string:" + this.CurrentUser.Code; tbCustomer.DataBind(); tbCustomer.Visible = true; tbCustomer.Text = flowDetail.Customer == null ? string.Empty : flowDetail.Customer.Code; Controls_TextBox tbLocFrom = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbProductionLocFrom"); tbLocFrom.ServiceParameter = "string:" + flow.PartyFrom.Code; tbLocFrom.DataBind(); tbLocFrom.Text = flowDetail.LocationFrom == null ? string.Empty : flowDetail.LocationFrom.Code; Controls_TextBox tbLocTo = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbProductionLocTo"); tbLocTo.ServiceParameter = "string:" + flow.PartyTo.Code; tbLocTo.DataBind(); tbLocTo.Text = flowDetail.LocationTo == null ? string.Empty : flowDetail.LocationTo.Code; ((Literal)this.FV_FlowDetail.FindControl("lblNeedInspect")).Visible = true; ((CheckBox)(this.FV_FlowDetail.FindControl("cbNeedInspect"))).Visible = true; Literal lblIdMark = ((Literal)this.FV_FlowDetail.FindControl("lblIdMark")); TextBox tbIdMark = ((TextBox)this.FV_FlowDetail.FindControl("tbIdMark")); Literal lblBarCodeType = ((Literal)this.FV_FlowDetail.FindControl("lblBarCodeType")); com.Sconit.Control.CodeMstrDropDownList ddlBarCodeType = (com.Sconit.Control.CodeMstrDropDownList) this.FV_FlowDetail.FindControl("ddlBarCodeType"); lblIdMark.Visible = true; tbIdMark.Visible = true; lblBarCodeType.Visible = true; ddlBarCodeType.Visible = true; lblIdMark.Text = "${MasterData.Flow.FlowDetail.IdMark.Production}"; ddlBarCodeType.Code = "FGBarCodeType"; ddlBarCodeType.DataBind(); if (flowDetail.BarCodeType != string.Empty) { ddlBarCodeType.Text = flowDetail.BarCodeType; } } else if (this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_TRANSFER) { this.FV_FlowDetail.FindControl("fdTransfer").Visible = true; DropDownList ddlOddShipOption = (DropDownList)this.FV_FlowDetail.FindControl("ddlOddShipOption"); ddlOddShipOption.Text = flowDetail.OddShipOption; ddlOddShipOption.Visible = true; this.FV_FlowDetail.FindControl("lblOddShipOption").Visible = true; Controls_TextBox tbLocFrom = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbTransferLocFrom"); tbLocFrom.ServiceParameter = "string:" + flow.PartyFrom.Code; tbLocFrom.DataBind(); tbLocFrom.Text = flowDetail.LocationFrom == null ? string.Empty : flowDetail.LocationFrom.Code; Controls_TextBox tbLocTo = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbTransferLocTo"); tbLocTo.ServiceParameter = "string:" + flow.PartyTo.Code; tbLocTo.DataBind(); tbLocTo.Text = flowDetail.LocationTo == null ? string.Empty : flowDetail.LocationTo.Code; this.FV_FlowDetail.FindControl("lblIsMrp").Visible = true; this.FV_FlowDetail.FindControl("cbIsMrp").Visible = true; } }
protected void ODS_FlowDetail_Updating(object sender, ObjectDataSourceMethodEventArgs e) { FlowDetail flowDetail = (FlowDetail)e.InputParameters[0]; FlowDetail oldFLowDetail = TheFlowDetailMgr.LoadFlowDetail(this.FlowDetailId); Flow flow = TheFlowMgr.LoadFlow(FlowCode, true); flowDetail.Flow = flow; flowDetail.CreateDate = oldFLowDetail.CreateDate; flowDetail.CreateUser = oldFLowDetail.CreateUser; flowDetail.LastModifyDate = DateTime.Now; flowDetail.LastModifyUser = this.CurrentUser; flowDetail.Version = oldFLowDetail.Version + 1; //seq if (flowDetail.Sequence == 0) { flowDetail.Sequence = TheFlowDetailMgr.LoadFlowDetail(this.FlowDetailId).Sequence; } Controls_TextBox tbItemCode = (Controls_TextBox)(this.FV_FlowDetail.FindControl("tbItemCode")); Controls_TextBox tbUom = (Controls_TextBox)(this.FV_FlowDetail.FindControl("tbUom")); if (tbItemCode != null && tbItemCode.Text.Trim() != string.Empty) { flowDetail.Item = TheItemMgr.LoadItem(tbItemCode.Text.Trim()); } if (tbUom != null && tbUom.Text.Trim() != string.Empty) { flowDetail.Uom = TheUomMgr.LoadUom(tbUom.Text.Trim()); } if (this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_PROCUREMENT || this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_CUSTOMERGOODS || this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_SUBCONCTRACTING) { Controls_TextBox tbLocTo = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbProcurementLocTo"); if (tbLocTo != null && tbLocTo.Text.Trim() != string.Empty) { flowDetail.LocationTo = TheLocationMgr.LoadLocation(tbLocTo.Text.Trim()); } //djin 20120802 保存参考物料号 Controls_TextBox tbRefItemCode = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbRefItemCode"); if (tbRefItemCode != null && tbRefItemCode.Text.Trim() != string.Empty) { flowDetail.ReferenceItemCode = tbRefItemCode.Text.Trim(); } //end if (this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_PROCUREMENT) { DropDownList ddlBillSettleTerm = (DropDownList)this.FV_FlowDetail.FindControl("ddlBillSettleTerm"); if (ddlBillSettleTerm.SelectedIndex != -1) { if (ddlBillSettleTerm.SelectedValue == string.Empty) { flowDetail.BillSettleTerm = null; } else { flowDetail.BillSettleTerm = ddlBillSettleTerm.SelectedValue; } } com.Sconit.Control.CodeMstrDropDownList ddlBarCodeType = (com.Sconit.Control.CodeMstrDropDownList) this.FV_FlowDetail.FindControl("ddlBarCodeType"); if (ddlBarCodeType.SelectedIndex != -1) { flowDetail.BarCodeType = ddlBarCodeType.SelectedValue; } } } else if (this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_DISTRIBUTION) { Controls_TextBox tbLocFrom = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbDistributionLocFrom"); if (tbLocFrom != null && tbLocFrom.Text.Trim() != string.Empty) { flowDetail.LocationFrom = TheLocationMgr.LoadLocation(tbLocFrom.Text.Trim()); } DropDownList ddlBillSettleTerm = (DropDownList)this.FV_FlowDetail.FindControl("ddlBillSettleTerm"); if (ddlBillSettleTerm.SelectedIndex != -1) { flowDetail.BillSettleTerm = ddlBillSettleTerm.SelectedValue; } DropDownList ddlOddShipOption = (DropDownList)this.FV_FlowDetail.FindControl("ddlOddShipOption"); if (ddlOddShipOption.SelectedIndex != -1) { flowDetail.OddShipOption = ddlOddShipOption.SelectedValue; } flowDetail.PackagingCode = ((System.Web.UI.HtmlControls.HtmlSelect) this.FV_FlowDetail.FindControl("tbPackagingCode")).Value; flowDetail.TransModeCode = ((System.Web.UI.HtmlControls.HtmlSelect) this.FV_FlowDetail.FindControl("tbTransModeCode")).Value; } else if (this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_PRODUCTION) { Controls_TextBox tbBom = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbBom"); if (tbBom != null && tbBom.Text.Trim() != string.Empty) { flowDetail.Bom = TheBomMgr.LoadBom(tbBom.Text.Trim()); } TextBox tbBatchSize = (TextBox)this.FV_FlowDetail.FindControl("tbBatchSize"); Controls_TextBox tbLocFrom = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbProductionLocFrom"); if (tbBatchSize.Text.Trim() != string.Empty) { flowDetail.BatchSize = decimal.Parse(tbBatchSize.Text.Trim()); } if (tbLocFrom != null && tbLocFrom.Text.Trim() != string.Empty) { flowDetail.LocationFrom = TheLocationMgr.LoadLocation(tbLocFrom.Text.Trim()); } Controls_TextBox tbLocTo = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbProductionLocTo"); if (tbLocTo != null && tbLocTo.Text.Trim() != string.Empty) { flowDetail.LocationTo = TheLocationMgr.LoadLocation(tbLocTo.Text.Trim()); } Controls_TextBox tbCustomer = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbCustomer"); if (tbCustomer != null && tbCustomer.Text.Trim() != string.Empty) { flowDetail.Customer = TheCustomerMgr.LoadCustomer(tbCustomer.Text.Trim()); } com.Sconit.Control.CodeMstrDropDownList ddlBarCodeType = (com.Sconit.Control.CodeMstrDropDownList) this.FV_FlowDetail.FindControl("ddlBarCodeType"); if (ddlBarCodeType.SelectedIndex != -1) { flowDetail.BarCodeType = ddlBarCodeType.SelectedValue; } } else if (this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_TRANSFER) { Controls_TextBox tbLocFrom = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbTransferLocFrom"); if (tbLocFrom != null && tbLocFrom.Text.Trim() != string.Empty) { flowDetail.LocationFrom = TheLocationMgr.LoadLocation(tbLocFrom.Text.Trim()); } Controls_TextBox tbLocTo = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbTransferLocTo"); if (tbLocTo != null && tbLocTo.Text.Trim() != string.Empty) { flowDetail.LocationTo = TheLocationMgr.LoadLocation(tbLocTo.Text.Trim()); } DropDownList ddlOddShipOption = (DropDownList)this.FV_FlowDetail.FindControl("ddlOddShipOption"); if (ddlOddShipOption.SelectedIndex != -1) { flowDetail.OddShipOption = ddlOddShipOption.SelectedValue; } } }
//返回订单明细 private IList <FlowDetail> PopulateFlowDetailList(bool includeBlank) { if (this.GV_List.Rows != null && this.GV_List.Rows.Count > 0) { Flow flow = null; DateTime? winTime = null; IList <FlowDetail> flowDetailList = new List <FlowDetail>(); if (this.tbWinTime.Text.Trim() != string.Empty) { winTime = DateTime.Parse(this.tbWinTime.Text.Trim()); } int seqInterval = int.Parse(TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_SEQ_INTERVAL).Value); int lastSeq = 0; foreach (GridViewRow row in this.GV_List.Rows) { HiddenField hfId = (HiddenField)row.FindControl("hfId"); TextBox tbLotNo = (TextBox)row.FindControl("tbLotNo"); TextBox tbOrderQty = (TextBox)row.FindControl("tbOrderQty"); if (hfId.Value != string.Empty && hfId.Value != "0") { FlowDetail flowDetail = TheFlowDetailMgr.LoadFlowDetail(int.Parse(hfId.Value)); flowDetail.HuLotNo = tbLotNo.Text.Trim() != string.Empty ? tbLotNo.Text.Trim() : null; flowDetail.OrderedQty = tbOrderQty.Text != string.Empty ? decimal.Parse(tbOrderQty.Text) : decimal.Zero; flowDetailList.Add(flowDetail); lastSeq = flowDetail.Sequence; if (flow == null) { flow = flowDetail.Flow; } if (flow.Type != BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PRODUCTION) { flowDetail.HuLotNo = tbLotNo.Text.Trim() != string.Empty ? tbLotNo.Text.Trim() : null; } else { flowDetail.HuLotNo = LotNoHelper.GenerateLotNo(winTime.Value); flowDetail.HuShiftCode = this.ucShift.ShiftCode; } } else { if (!includeBlank) { continue; } if (flow == null) { flow = this.TheFlowMgr.LoadFlow(this.FlowCode); } TextBox tbNewSeq = (TextBox)row.FindControl("tbSeq"); Controls_TextBox tbNewItemCode = (Controls_TextBox)row.FindControl("tbItemCode"); Controls_TextBox tbNewUom = (Controls_TextBox)row.FindControl("tbUom"); com.Sconit.Control.CodeMstrDropDownList ddlPackageType = (com.Sconit.Control.CodeMstrDropDownList)row.FindControl("ddlPackageType"); TextBox tbNewUnitCount = (TextBox)row.FindControl("tbUnitCount"); TextBox tbNewOrderQty = (TextBox)row.FindControl("tbOrderQty"); FlowDetail newFlowDetail = new FlowDetail(); newFlowDetail.Sequence = tbNewSeq.Text != string.Empty ? int.Parse(tbNewSeq.Text) : (lastSeq + seqInterval); newFlowDetail.Item = this.TheItemMgr.LoadItem(tbNewItemCode.Text.Trim()); newFlowDetail.Uom = this.TheUomMgr.LoadUom(tbNewUom.Text.Trim()); newFlowDetail.PackageType = ddlPackageType.SelectedValue; newFlowDetail.UnitCount = tbNewUnitCount.Text.Trim() != string.Empty ? decimal.Parse(tbNewUnitCount.Text) : 1; newFlowDetail.OrderedQty = tbNewOrderQty.Text.Trim() == string.Empty ? 0 : decimal.Parse(tbNewOrderQty.Text.Trim()); newFlowDetail.Flow = flow; newFlowDetail.IsBlankDetail = true; if (flow.Type != BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PRODUCTION) { newFlowDetail.HuLotNo = tbLotNo.Text.Trim() != string.Empty ? tbLotNo.Text.Trim() : null; } else { newFlowDetail.HuLotNo = LotNoHelper.GenerateLotNo(winTime.Value); newFlowDetail.HuShiftCode = this.ucShift.ShiftCode; } flowDetailList.Add(newFlowDetail); } } return(flowDetailList); } return(null); }