private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0 && dataGridView1.Columns[e.ColumnIndex].Name == "colInventory") { OrderItemRecord item = dataGridView1.Rows[e.RowIndex].Tag as OrderItemRecord; ProductInventoryItemSearchCondition con = new ProductInventoryItemSearchCondition(); con.OrderItem = item.ID; con.UnShipped = true; FrmProductInventoryItemView frm = new FrmProductInventoryItemView(); frm.SearchCondition = con; frm.ShowDialog(); } if (e.RowIndex >= 0 && dataGridView1.Columns[e.ColumnIndex].Name == "colShipped") { OrderItemRecord item = dataGridView1.Rows[e.RowIndex].Tag as OrderItemRecord; ProductInventoryItemSearchCondition con = new ProductInventoryItemSearchCondition(); con.OrderItem = item.ID; con.UnShipped = false; FrmProductInventoryItemView frm = new FrmProductInventoryItemView(); frm.SearchCondition = con; frm.ShowDialog(); } if (e.RowIndex >= 0 && dataGridView1.Columns[e.ColumnIndex].Name == "colValidInventory") { OrderItemRecord item = dataGridView1.Rows[e.RowIndex].Tag as OrderItemRecord; ProductInventoryItemSearchCondition con = new ProductInventoryItemSearchCondition(); con.Products = new List <string>(); con.Products.Add(item.ProductID); con.UnShipped = true; con.UnReserved = true; FrmProductInventoryItemView frm = new FrmProductInventoryItemView(); frm.SearchCondition = con; frm.ShowDialog(); } }
private void mnu_UnReserve_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows != null && dataGridView1.SelectedRows.Count > 0) { OrderItemRecord item = dataGridView1.SelectedRows[0].Tag as OrderItemRecord; if (item.Inventory == 0) { MessageBox.Show("此订单项的还没有任何备货"); return; } FrmProductInventoryAssign frm = new FrmProductInventoryAssign(); frm.ProductID = item.ProductID; frm.MaxCount = item.NotPurchased; if (frm.ShowDialog() == DialogResult.OK) { CommandResult ret = (new ProductInventoryBLL(AppSettings.Current.ConnStr)).Reserve(frm.WarehouseID, item.ProductID, item.ID, item.SheetNo, frm.Count); if (ret.Result == ResultCode.Successful) { _Inventories = (new ProductInventoryBLL(AppSettings.Current.ConnStr)).GetItems(null).QueryObjects; _Records.Remove(item); item = (new OrderBLL(AppSettings.Current.ConnStr)).GetRecordById(item.ID).QueryObject; if (item != null) { _Records.Add(item); //更新某行数据 } FreshData(); } else { MessageBox.Show(ret.Message); } } } }
private void UpdateOrderItemRecord(OrderItemRecord orderItemRecord, IReadonlyOrderItem orderItem) { orderItemRecord.ProductId = orderItem.ProductId; orderItemRecord.StatusId = orderItem.Status; orderItemRecord.Quantity = orderItem.Quantity; orderItemRecord.UnitPrice = orderItem.UnitPrice; }
protected override void ShowItemInGridViewRow(DataGridViewRow row, object item) { OrderItemRecord info = item as OrderItemRecord; row.Tag = info; row.Cells["colOrderID"].Value = info.SheetNo; row.Cells["colCustomer"].Value = info.Customer.Name; row.Cells["colProduct"].Value = info.Product != null ? info.Product.Name : info.ProductID; row.Cells["colUnit"].Value = info.Unit; row.Cells["colSales"].Value = info.SalesPerson; row.Cells["colDemandDate"].Value = info.DemandDate; row.Cells["colCount"].Value = info.Count.Trim(); row.Cells["colState"].Value = row.Cells["colState"].Value = SheetStateDescription.GetDescription(info.State); row.Cells["colOnWay"].Value = info.OnWay.Trim(); row.Cells["colInventory"].Value = info.Inventory.Trim(); row.Cells["colShipped"].Value = info.Shipped.Trim(); row.Cells["colNotPurchased"].Value = info.NotPurchased.Trim(); //当订单的已出货加备货数小于订单数时才提示产品的有效库存,这么做也是减少垃圾信息,方便用户准确找到信息 if ((info.Inventory + info.Shipped < info.Count) && _Inventories != null && _Inventories.Count > 0) { row.Cells["colValidInventory"].Value = _Inventories.Sum(it => it.ProductID == info.ProductID ? it.Valid : 0).Trim(); } row.Cells["colMemo"].Value = info.Memo; if (info.State == SheetState.Canceled) { row.DefaultCellStyle.ForeColor = Color.Red; row.DefaultCellStyle.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Strikeout, System.Drawing.GraphicsUnit.Point, ((byte)(134))); } if (!_Records.Exists(it => it.ID == info.ID)) { _Records.Add(info); } }
private void ShowOrderItemState() { if (UpdatingItem != null) { List <string> sheets = new List <string>(); sheets.Add((UpdatingItem as Order).ID); OrderItemRecordSearchCondition con = new OrderItemRecordSearchCondition(); con.SheetNo = sheets; List <OrderItemRecord> states = (new OrderBLL(AppSettings.Current.ConnStr)).GetRecords(con).QueryObjects; if (states != null && states.Count > 0) { foreach (DataGridViewRow row in ItemsGrid.Rows) { OrderItem oi = row.Tag as OrderItem; if (oi != null) { OrderItemRecord st = states.SingleOrDefault(item => item.ID == oi.ID); row.Cells["colShipped"].Value = st != null?st.Shipped.Trim().ToString() : null; row.Cells["colOnway"].Value = st != null?st.OnWay.Trim().ToString() : null; } } } } }
private OrderItem GetOrderItem(OrderItemRecord orderItemRecord) { var id = new OrderItemIdentity(orderItemRecord.Id); var productId = new ProductIdentity(orderItemRecord.ProductId); var quantity = (int)orderItemRecord.Quantity; // TODO: VC: Make int var unitPrice = orderItemRecord.UnitPrice; var status = orderItemRecord.StatusId; return(new OrderItem(id, productId, unitPrice, quantity, status)); }
private FindOrderItemQueryResponse GetResponse(OrderItemRecord orderItemRecord) { return(new FindOrderItemQueryResponse { Id = orderItemRecord.Id, ProductId = orderItemRecord.ProductId, Quantity = orderItemRecord.Quantity, UnitPrice = orderItemRecord.UnitPrice, Status = orderItemRecord.StatusId, }); }
protected override void ShowItemInGridViewRow(DataGridViewRow row, object item) { OrderItemRecord c = item as OrderItemRecord; row.Tag = c; row.Cells["colOrderID"].Value = c.SheetNo; row.Cells["colProductName"].Value = c.Product.Name; row.Cells["colCount"].Value = c.Count.Trim(); row.Cells["colDemandDate"].Value = c.DemandDate.ToLongDateString(); row.Cells["colPrepared"].Value = (c.OnWay + c.Inventory).Trim(); row.Cells["colNotPurchased"].Value = c.NotPurchased.Trim(); row.Cells["colMemo"].Value = c.Memo; }
private void cMnu_AddOrderRecord_Click(object sender, EventArgs e) { FrmOrderRecordView frm = new FrmOrderRecordView(); frm.ForSelect = true; OrderItemRecordSearchCondition con = new OrderItemRecordSearchCondition(); con.States = new List <SheetState>(); con.States.Add(SheetState.Add); con.States.Add(SheetState.Approved); con.HasToPurchase = true; frm.SearchCondition = con; if (frm.ShowDialog() == DialogResult.OK) { OrderItemRecord oi = frm.SelectedItem as OrderItemRecord; AddPurchaseSheettem(oi); } }
public void AddPurchaseSheettem(OrderItemRecord oi) { List <PurchaseItem> sources = GetPurchaseSheetItemsFromGrid(); if (!sources.Exists(it => it.OrderItem == oi.ID)) { PurchaseItem item = new PurchaseItem(); item.ID = Guid.NewGuid(); item.ProductID = oi.ProductID; item.OrderID = oi.SheetNo; item.OrderItem = oi.ID; item.Unit = oi.Unit; item.Price = oi.Product != null ? oi.Product.Cost : 0; item.Count = oi.NotPurchased; item.Amount = item.Price * item.Count; sources.Add(item); } ShowDeliveryItemsOnGrid(sources); }
private void mnu_AddOrderItem_Click(object sender, EventArgs e) { if (Customer != null) { FrmOrderRecordView frm = new FrmOrderRecordView(); frm.ForSelect = true; OrderItemRecordSearchCondition con = new OrderItemRecordSearchCondition(); con.CustomerID = Customer.ID; con.States = new List <SheetState>(); con.States.Add(SheetState.Approved); con.HasToDelivery = true; frm.SearchCondition = con; if (frm.ShowDialog() == DialogResult.OK) { OrderItemRecord oi = frm.SelectedItem as OrderItemRecord; AddDeliveryItem(oi); } } }
public void AddDeliveryItem(OrderItemRecord oi) { List <StackOutItem> sources = GetDeliveryItemsFromGrid(); if (!sources.Exists(it => it.OrderItem != null && it.OrderItem.Value == oi.ID)) { StackOutItem item = new StackOutItem(); item.ID = Guid.NewGuid(); item.ProductID = oi.ProductID; item.Unit = oi.Unit; item.Price = oi.Price; item.Count = oi.NotShipped; item.Amount = item.Price * item.Count; item.OrderItem = oi.ID; item.OrderID = oi.SheetNo; sources.Add(item); } ShowDeliveryItemsOnGrid(sources); }
public void CreateOrderItemRecordTest() { using (var client = new TuboAllianceClient()) { var model = new CreateOrderItemRecordRequest(); model.OrderId = "123497220"; var orderItemList = new List <OrderItemRecord>(); var orderItem = new OrderItemRecord(); orderItem.CpsId = new Guid("72CF04E7-E99D-4441-80EC-BADCF8DDF953"); orderItem.DarenID = new Guid("00004371-77D8-4D26-A57E-E46426587BEA"); orderItem.Pid = "TR-CT-C2-MC5|8"; orderItem.Number = 1; orderItemList.Add(orderItem); var orderItem2 = new OrderItemRecord(); orderItem2.CpsId = new Guid("052E3B8D-5B39-4C5B-8F57-78B7BDFFD35A"); orderItem2.DarenID = new Guid("00004371-77D8-4D26-A57E-E46426587BEA"); orderItem2.Pid = "GF-MOBIL-GIFT|18"; orderItem2.Number = 1; orderItemList.Add(orderItem2); //var orderItem3 = new OrderItemRecord(); //orderItem3.CpsId = new Guid("dbcd2b00-e7e9-4d16-8fca-d92736ed48f7"); //orderItem3.DarenID = new Guid("00010D2E-F4CD-430A-BEB0-AE6674F6EA46"); //orderItem3.Pid = "LF-GiGi-G-1069|6"; ; //orderItem3.Number = 1; //orderItemList.Add(orderItem3); model.OrderItem = orderItemList; var result = client.CreateOrderItemRecordAsync(model); Assert.IsNotNull(result.Result); } }