public void InitPageParameter(string itemCode) { OrderLocationTransaction currentOrderLocTrans = TheOrderLocationTransactionMgr.LoadOrderLocationTransaction(this.LocTransId); OrderHead orderHead = currentOrderLocTrans.OrderDetail.OrderHead; //IList<BomDetail> bomDetailList = new List<BomDetail>(); IList <BomDetail> bomDetailList = TheBomDetailMgr.GetBomDetailListForAbstractItem(itemCode, orderHead.Routing, orderHead.StartTime, currentOrderLocTrans.OrderDetail.DefaultLocationFrom); IList <OrderLocationTransaction> orderLocTransList = new List <OrderLocationTransaction>(); // OrderLocationTransaction orderLocTrans = OrderLocationTransactionMgr.LoadOrderLocationTransaction(this.LocTransId); foreach (BomDetail bomDetail in bomDetailList) { OrderLocationTransaction newOrderLocTrans = TheOrderLocationTransactionMgr.LoadOrderLocationTransaction(this.LocTransId); newOrderLocTrans.Id = 0; newOrderLocTrans.Item = bomDetail.Item; newOrderLocTrans.Uom = bomDetail.Item.Uom; newOrderLocTrans.BomDetail = bomDetail; newOrderLocTrans.Operation = bomDetail.Operation; newOrderLocTrans.Location = bomDetail.Location; newOrderLocTrans.OrderedQty = newOrderLocTrans.OrderedQty * bomDetail.RateQty; newOrderLocTrans.AccumulateQty = newOrderLocTrans.AccumulateQty == null ? null : newOrderLocTrans.AccumulateQty * bomDetail.RateQty; newOrderLocTrans.AccumulateRejectQty = newOrderLocTrans.AccumulateRejectQty == null ? null : newOrderLocTrans.AccumulateRejectQty * bomDetail.RateQty; newOrderLocTrans.AccumulateScrapQty = newOrderLocTrans.AccumulateScrapQty == null ? null : newOrderLocTrans.AccumulateScrapQty * bomDetail.RateQty; orderLocTransList.Add(newOrderLocTrans); } this.OrderLocTransList = orderLocTransList; this.GV_List.DataSource = orderLocTransList; this.GV_List.DataBind(); }
public IList <ReceiptDetail> PopulateReceiptDetailList() { IList <ReceiptDetail> receiptDetailList = new List <ReceiptDetail>(); for (int i = 0; i < this.GV_List.Rows.Count; i++) { GridViewRow row = this.GV_List.Rows[i]; HiddenField hfId = (HiddenField)row.FindControl("hfId"); HiddenField hfOrderDetailId = (HiddenField)row.FindControl("hfOrderDetailId"); TextBox tbHuId = (TextBox)row.FindControl("tbHuId"); TextBox tbHuReceiveQty = (TextBox)row.FindControl("tbHuReceiveQty"); TextBox tbReceiveQty = (TextBox)row.FindControl("tbReceiveQty"); TextBox tbRejectQty = (TextBox)row.FindControl("tbRejectQty"); TextBox tbScrapQty = (TextBox)row.FindControl("tbScrapQty"); decimal reveiveQty = tbHuId.Text != string.Empty ? (tbHuReceiveQty.Text.Trim() != string.Empty ? Decimal.Parse(tbHuReceiveQty.Text.Trim()) : 0) : (tbReceiveQty.Text.Trim() != string.Empty ? Decimal.Parse(tbReceiveQty.Text.Trim()) : 0); decimal rejectQty = tbRejectQty.Text.Trim() == string.Empty ? 0 : Decimal.Parse(tbRejectQty.Text.Trim()); decimal scrapQty = tbScrapQty.Text.Trim() == string.Empty ? 0 : Decimal.Parse(tbScrapQty.Text.Trim()); if (reveiveQty != 0 || rejectQty != 0 || scrapQty != 0) { ReceiptDetail receiptDetail = new ReceiptDetail(); receiptDetail.OrderLocationTransaction = TheOrderLocationTransactionMgr.LoadOrderLocationTransaction(Int32.Parse(hfId.Value)); receiptDetail.ReceivedQty = reveiveQty; receiptDetail.RejectedQty = rejectQty; receiptDetail.ScrapQty = scrapQty; receiptDetail.HuId = tbHuId.Text.Trim() == string.Empty ? null : tbHuId.Text.Trim(); receiptDetailList.Add(receiptDetail); } } return(receiptDetailList); }
protected void lbtnDelete_Click(object sender, EventArgs e) { int id = int.Parse(((LinkButton)sender).CommandArgument); OrderLocationTransaction orderLocationTrans = TheOrderLocationTransactionMgr.LoadOrderLocationTransaction(id); try { TheOrderMgr.DeleteOrderLocationTransaction(id, this.CurrentUser.Code); ShowSuccessMessage("MasterData.Order.LocTrans.Delete.Successfully"); UpdateRoutingEvent(this.OrderNo, e); UpdateView(); } catch (BusinessErrorException ex) { ShowErrorMessage(ex); } }
protected void btnSave_Click(object sender, EventArgs e) { int currentLocTransId = -1; foreach (GridViewRow row in this.GV_List.Rows) { RadioButton rbSelect = (RadioButton)row.FindControl("rbSelect"); HiddenField hfRowIndex = (HiddenField)row.FindControl("hfRowIndex"); if (rbSelect.Checked) { currentLocTransId = int.Parse(hfRowIndex.Value); break; } } if (currentLocTransId == -1) { ShowErrorMessage("Common.Message.Record.Not.Select"); } else { OrderLocationTransaction currentLocationTrans = OrderLocTransList[currentLocTransId]; OrderLocationTransaction oldLocationTrans = TheOrderLocationTransactionMgr.LoadOrderLocationTransaction(this.LocTransId); OrderDetail orderDetail = TheOrderDetailMgr.LoadOrderDetail(oldLocationTrans.OrderDetail.Id, true); orderDetail.OrderHead = TheOrderHeadMgr.LoadOrderHead(orderDetail.OrderHead.OrderNo, true, true, true); oldLocationTrans.OrderDetail = orderDetail; try { TheOrderLocationTransactionMgr.ReplaceAbstractItem(oldLocationTrans, currentLocationTrans.BomDetail); if (SaveEvent != null) { SaveEvent(currentLocationTrans.OrderDetail.OrderHead.OrderNo, e); this.Visible = false; } } catch (BusinessErrorException ex) { ShowErrorMessage(ex); } } }
public void SaveAllDetail() { IList <OrderLocationTransaction> orderLocTransList = new List <OrderLocationTransaction>(); int count = this.GV_List.Rows.Count; if (!this.IsReuse) { count = count - 1; } for (int i = 0; i < count; i++) { GridViewRow row = this.GV_List.Rows[i]; HiddenField hfId = (HiddenField)row.FindControl("hfId"); OrderLocationTransaction orderLocTrans = TheOrderLocationTransactionMgr.LoadOrderLocationTransaction(int.Parse(hfId.Value)); orderLocTrans.IsAssemble = ((CheckBox)row.FindControl("cbIsAssemble")).Checked; orderLocTrans.OrderedQty = decimal.Parse(((TextBox)row.FindControl("tbOrderdQty")).Text.Trim()); orderLocTrans.UnitQty = decimal.Parse(((TextBox)row.FindControl("tbUnitQty")).Text.Trim()); orderLocTrans.ItemVersion = ((TextBox)row.FindControl("tbUnitQty")).Text.Trim(); Controls_TextBox tbLocation = (Controls_TextBox)row.FindControl("tbLocation"); if (tbLocation.Text.Trim() != string.Empty) { orderLocTrans.Location = TheLocationMgr.LoadLocation(tbLocation.Text.Trim()); } orderLocTrans.NeedPrint = ((CheckBox)row.FindControl("cbNeedPrint")).Checked; orderLocTransList.Add(orderLocTrans); } //更新orderloctrans foreach (OrderLocationTransaction orderLocTrans in orderLocTransList) { TheOrderLocationTransactionMgr.UpdateOrderLocationTransaction(orderLocTrans); } // ShowSuccessMessage("MasterData.Order.LocTrans.Update.Successfully"); }
protected void btnConfirm_Click(object sender, EventArgs e) { try { IList<TransformerDetail> transformerDetailList = this.ucList.PopulateTransformerDetailList(); IList<OrderDetail> orderDetailList = new List<OrderDetail>(); string currentFlow = string.Empty; foreach (TransformerDetail transformerDetail in transformerDetailList) { if (transformerDetail.CurrentQty != transformerDetail.AdjustQty) { OrderLocationTransaction orderLocTrans = TheOrderLocationTransactionMgr.LoadOrderLocationTransaction(transformerDetail.OrderLocTransId); if (currentFlow == string.Empty) { currentFlow = orderLocTrans.OrderDetail.OrderHead.Flow; } OrderDetail orderDetail = new OrderDetail(); orderDetail.Item = TheItemMgr.LoadItem(transformerDetail.ItemCode); orderDetail.Uom = TheUomMgr.LoadUom(transformerDetail.UomCode); if (transformerDetail.HuId != null && transformerDetail.HuId.Trim() != string.Empty) { Hu hu = this.TheHuMgr.CheckAndLoadHu(transformerDetail.HuId.Trim()); orderDetail.OrderedQty = transformerDetail.AdjustQty - hu.Qty; } else { orderDetail.OrderedQty = transformerDetail.AdjustQty - transformerDetail.CurrentQty; } orderDetail.UnitCount = transformerDetail.UnitCount; orderDetail.HuId = transformerDetail.HuId; orderDetail.HuLotNo = transformerDetail.LotNo; if (transformerDetail.LocationFromCode != null) { orderDetail.LocationFrom = TheLocationMgr.LoadLocation(transformerDetail.LocationFromCode); } if (transformerDetail.LocationToCode != null) { orderDetail.LocationTo = TheLocationMgr.LoadLocation(transformerDetail.LocationToCode); } orderDetailList.Add(orderDetail); } } if (orderDetailList.Count > 0) { Receipt receipt = TheOrderMgr.QuickReceiveOrder(currentFlow, orderDetailList, this.CurrentUser.Code, BusinessConstants.CODE_MASTER_ORDER_SUB_TYPE_VALUE_ADJ, DateTime.Now, DateTime.Now, false, this.ReceiptNo, null); this.Visible = false; ShowSuccessMessage("MasterData.Receipt.Adjust.Successfully", this.ReceiptNo); if (AdjustEvent != null) { AdjustEvent(receipt.ReceiptNo, e); } } else { ShowSuccessMessage("MasterData.Receipt.NoDetail.Adjust", this.ReceiptNo); } } catch (BusinessErrorException ex) { ShowErrorMessage(ex); } }