private static void AddRecordsIntoProductBatch(int lastId, ProductBatchQuery productBatchQuery) { bool flag = true; while (flag) { try { Console.Write("Please, input corrrect existing product id: "); int id = ConsoleInput.InputInt(); Console.Write("Please, input corrrect product product quantity: "); int quantity = ConsoleInput.InputInt(); ProductBatch productBatch = new ProductBatch { BatchId_FK = lastId, ProductId_FK = id, ProductQuantity = quantity }; productBatchQuery.AddNewRecord(productBatch); } catch (Exception e) { Console.WriteLine(e.Message); } Console.Write("Add another one product to the batch? (y/n): "); string str = Console.ReadLine(); if (str == "n") { flag = false; } } }
private void SaveProductBatch() { ProductBatch oBatch = ProductBatch.Load(this.ProductBatchId); if (oBatch == null) { oBatch = new ProductBatch(); } oBatch.STKCODE = txtStkCode.Text; oBatch.APP1_COMBIN = cboAppendix1.Text; oBatch.APP2_COMBIN = cboAppendix2.Text; oBatch.APP3_COMBIN = cboAppendix3.Text; oBatch.CLASS1 = general.cboClass1.Text; oBatch.CLASS2 = general.cboClass2.Text; oBatch.CLASS3 = general.cboClass3.Text; oBatch.CLASS4 = general.cboClass4.Text; oBatch.CLASS5 = general.cboClass5.Text; oBatch.CLASS6 = general.cboClass6.Text; oBatch.Description = general.txtProductName.Text; oBatch.MAINUNIT = general.txtUnit.Text; oBatch.ALTITEM = string.Empty; oBatch.REMARKS = general.txtRemarks.Text; oBatch.MARKUP = 0; oBatch.BASPRC = (general.txtCurrentRetailPrice.Text.Length == 0) ? 0 : Convert.ToDecimal(general.txtCurrentRetailPrice.Text); oBatch.WHLPRC = (general.txtWholesalesPrice.Text.Length == 0) ? 0 : Convert.ToDecimal(general.txtWholesalesPrice.Text); oBatch.VCURR = general.cboVendorCurrency.Text; oBatch.VPRC = (general.txtVendorPrice.Text.Length == 0) ? 0 : Convert.ToDecimal(general.txtVendorPrice.Text); oBatch.NRDISC = 0; oBatch.REORDLVL = (order.txtReorderLevel.Text.Length == 0) ? 0 : Convert.ToDecimal(order.txtReorderLevel.Text); oBatch.REORDQTY = (order.txtReorderQuantity.Text.Length == 0) ? 0 : Convert.ToDecimal(order.txtReorderQuantity.Text); oBatch.SERIALFLAG = false; oBatch.NATURE = general.cboNature.Text; oBatch.REMARK1 = general.txtRemarks1.Text; oBatch.REMARK2 = general.txtRemarks2.Text; oBatch.REMARK3 = general.txtRemarks3.Text; oBatch.REMARK4 = general.txtRemarks4.Text; oBatch.REMARK5 = general.txtRemarks5.Text; oBatch.REMARK6 = general.txtRemarks6.Text; oBatch.PHOTO = misc.txtPicFileName.Text; oBatch.STK_MEMO = general.txtMemo.Text; oBatch.STATUS = cboItemStatus.Text; oBatch.DATEPOST = new DateTime(1900, 1, 1); oBatch.DATECREATE = DateTime.Now; oBatch.DATELCHG = DateTime.Now; oBatch.USERLCHG = GetStaffName(DAL.Common.Config.CurrentUserId); oBatch.RETAILITEM = general.chkRetailItem.Checked.ToString(); oBatch.BINX = general.txtBin_X.Text; oBatch.BINY = general.txtBin_Y.Text; oBatch.BINZ = general.txtBin_Z.Text; oBatch.DESC_MEMO = general.txtMemo.Text; oBatch.DESC_POLE = general.txtPole.Text; oBatch.OFF_DISPLAY_ITEM = general.chkOffDisplayItem.Checked.ToString(); oBatch.COUNTER_ITEM = general.chkCounterItem.Checked.ToString(); oBatch.ORIPRC = (general.txtOriginalRetailPrice.Text.Length == 0) ? 0 : Convert.ToDecimal(general.txtOriginalRetailPrice.Text); oBatch.Save(); this.ProductBatchId = oBatch.BatchId; }
public ActionResult DeleteConfirmed(int id) { ProductBatch productbatch = db.ProductBatches.Find(id); db.ProductBatches.Remove(productbatch); db.SaveChanges(); return(RedirectToAction("Index")); }
private void EditBatch_Load(object sender, EventArgs e) { ThemeHelper.ChangeFormBackgroundColor(this); batch = controller.GetBatchById(batchid); txtCost.Text = CostCodeController.CostToCode(batch.Cost); txtCash.Text = batch.Cash.ToString(); txtCredit.Text = batch.Credit.ToString(); txtMarkup.Text = batch.Markup.ToString(); txtStock.Text = batch.Stock.ToString(); }
public ActionResult Edit([Bind(Include = "Id,BatchInfo,Description,ActiveStatus,CreatedBy,CreatedAt,UpdatedAt")] ProductBatch productbatch) { if (ModelState.IsValid) { db.Entry(productbatch).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } //ViewBag.CreatedBy = new SelectList(db.IdentityUsers, "Id", "UserName", productbatch.CreatedBy); return(View(productbatch)); }
// GET: /ProductBatch/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ProductBatch productbatch = db.ProductBatches.Find(id); if (productbatch == null) { return(HttpNotFound()); } return(View(productbatch)); }
public int AddNewRecord(ProductBatch productBatch) { SqlCommand cmd = connection.CreateCommand(); cmd.CommandText = @"INSERT INTO ProductBatch Values(@batchId, @productId, @quantity)"; cmd.Parameters.AddWithValue("@batchId", productBatch.BatchId_FK); cmd.Parameters.AddWithValue("@productId", productBatch.ProductId_FK); cmd.Parameters.AddWithValue("@quantity", productBatch.ProductQuantity); int res = cmd.ExecuteNonQuery(); return(res); }
// GET: /ProductBatch/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ProductBatch productbatch = db.ProductBatches.Find(id); if (productbatch == null) { return(HttpNotFound()); } //ViewBag.CreatedBy = new SelectList(db.IdentityUsers, "Id", "UserName", productbatch.CreatedBy); return(View(productbatch)); }
private void LoadProductBatch() { ProductBatch oBatch = ProductBatch.Load(this.ProductBatchId); if (oBatch != null) { txtStkCode.Text = oBatch.STKCODE; cboAppendix1.Text = oBatch.APP1_COMBIN; cboAppendix2.Text = oBatch.APP2_COMBIN; cboAppendix3.Text = oBatch.APP3_COMBIN; general.cboClass1.Text = oBatch.CLASS1; general.cboClass2.Text = oBatch.CLASS2; general.cboClass3.Text = oBatch.CLASS3; general.cboClass4.Text = oBatch.CLASS4; general.cboClass5.Text = oBatch.CLASS5; general.cboClass6.Text = oBatch.CLASS6; general.txtProductName.Text = oBatch.Description; general.txtUnit.Text = oBatch.MAINUNIT; general.txtRemarks.Text = oBatch.REMARKS; general.txtCurrentRetailPrice.Text = oBatch.BASPRC.ToString("n2"); general.txtWholesalesPrice.Text = oBatch.WHLPRC.ToString("n2"); general.cboVendorCurrency.Text = oBatch.VCURR; general.txtVendorPrice.Text = oBatch.VPRC.ToString("n2"); order.txtReorderLevel.Text = oBatch.REORDLVL.ToString("n0"); order.txtReorderQuantity.Text = oBatch.REORDQTY.ToString("n0"); general.cboNature.Text = oBatch.NATURE; general.txtRemarks1.Text = oBatch.REMARK1; general.txtRemarks2.Text = oBatch.REMARK2; general.txtRemarks3.Text = oBatch.REMARK3; general.txtRemarks4.Text = oBatch.REMARK4; general.txtRemarks5.Text = oBatch.REMARK5; general.txtRemarks6.Text = oBatch.REMARK6; misc.txtPicFileName.Text = oBatch.PHOTO; cboItemStatus.Text = oBatch.STATUS; general.chkRetailItem.Checked = (oBatch.RETAILITEM == "F") ? false : true; general.txtBin_X.Text = oBatch.BINX; general.txtBin_Y.Text = oBatch.BINY; general.txtBin_Z.Text = oBatch.BINZ; general.txtMemo.Text = oBatch.DESC_MEMO; general.txtPole.Text = oBatch.DESC_POLE; general.chkOffDisplayItem.Checked = (oBatch.OFF_DISPLAY_ITEM == "F") ? false : true; general.chkCounterItem.Checked = (oBatch.COUNTER_ITEM == "F") ? false : true; general.txtOriginalRetailPrice.Text = oBatch.ORIPRC.ToString("n2"); } }
private static void AdjustSendSSBToWMS(int sysNo, string inWarehouseNumber, List <InventoryBatchDetailsInfo> batchDetailsInfoEntity, List <InventoryAdjustItemInfo> adjustCaseEntityList) { List <ECommerce.Entity.Inventory.Item> itemList = new List <ECommerce.Entity.Inventory.Item>(); // List<BatchDetailsInfoEntity> batchDetailsInfoEntity = AdjustDAL.GetBatchDetailsInfoEntityListByNumber(SysNumber); if ((batchDetailsInfoEntity != null && batchDetailsInfoEntity.Count > 0) || (adjustCaseEntityList != null && adjustCaseEntityList.Count > 0)) { if (batchDetailsInfoEntity != null && batchDetailsInfoEntity.Count > 0) { foreach (var BatchItem in batchDetailsInfoEntity) { ProductBatch pbEntity = new ProductBatch { BatchNumber = BatchItem.BatchNumber , Quantity = BatchItem.Quantity.ToString() }; ECommerce.Entity.Inventory.Item item = new ECommerce.Entity.Inventory.Item() { ProductBatch = pbEntity , ProductSysNo = BatchItem.ProductSysNo.ToString() , Quantity = BatchItem.Quantity.ToString() }; itemList.Add(item); } } if (adjustCaseEntityList != null && adjustCaseEntityList.Count > 0) { //初始非批次商品调整信息 foreach (var NOTBatchItem in adjustCaseEntityList) { ECommerce.Entity.Inventory.Item item = new ECommerce.Entity.Inventory.Item() { ProductSysNo = NOTBatchItem.ProductSysNo.ToString(), Quantity = NOTBatchItem.AdjustQuantity.ToString() }; itemList.Add(item); } } SendToWMSSSBXMLMessage sendTOWMSSSBXMLMessage = new SendToWMSSSBXMLMessage() { RequestRoot = new RequestRoot() { MessageHeader = new MessageHeader { Language = "CH", Sender = "IPP", CompanyCode = "8601", Action = "Adjust", Version = "0.1", Type = "InventoryAdjust", OriginalGUID = "" }, Body = new ECommerce.Entity.Inventory.Body { Operation = new Operation() { Type = "60", Number = sysNo.ToString(), User = "******",//ServiceContext.Current.UserDisplayName, Memo = "损益单出库给仓库发送SSB", Item = itemList, WarehouseNumber = inWarehouseNumber } } } }; string paramXml = SerializationUtility.XmlSerialize(sendTOWMSSSBXMLMessage); XmlDocument xmlD = new XmlDocument(); xmlD.LoadXml(paramXml); paramXml = "<" + xmlD.DocumentElement.Name + ">" + xmlD.DocumentElement.InnerXml + "</" + xmlD.DocumentElement.Name + ">"; if (itemList != null && itemList.Count > 0) { InventoryDA.SendSSBToWMS(paramXml); } } }
private void btnNew_Click(object sender, EventArgs e) { try { if (PermissionController.CheckPermission(PermissionType.PRODUCT_ADD)) { if (MessageHelper.AlertRegisterConfirmation() == DialogResult.Yes) { Product product = new Product(); product.Name = txtName.Text; product.Description = txtDescription.Text; product.Category = (Category)cmbCategory.SelectedItem; product.BarcodeData = txtBarcode.Text; product.ReOrderLevel = decimal.Parse(txtReOrder.Text); ProductBatch batch = new ProductBatch(); batch.Cost = CostCodeController.CodeToCost(txtCost.Text); batch.Cash = decimal.Parse(txtCash.Text); batch.Credit = decimal.Parse(txtCredit.Text); batch.Markup = decimal.Parse(txtMarkup.Text); batch.Stock = decimal.Parse(txtStock.Text); if (product.BarcodeData == "") { context.Products.Add(product); context.SaveChanges(); product.BarcodeData = product.Id.ToString(); product.BarcodeImage = BarcodeController.GetBarcodeBytes(product.BarcodeData.ToString()); context.SaveChanges(); batch.Product = product; context.ProductBatches.Add(batch); context.SaveChanges(); MessageHelper.AlertRegisterSuccess(); } else { context.Products.Add(product); context.SaveChanges(); batch.Product = product; context.ProductBatches.Add(batch); context.SaveChanges(); MessageHelper.AlertRegisterSuccess(); } if (MessageBox.Show("Do you want to print Labels", "Labels", MessageBoxButtons.YesNo) == DialogResult.Yes) { if (MessageBox.Show("Do you want to Double the Labels", "Labels", MessageBoxButtons.YesNo) == DialogResult.Yes) { BarcodeController.print_barcode(product.Id, int.Parse((batch.Stock * 2).ToString())); // BarcodeController.print_barcode_preview(product.Id); } else { BarcodeController.print_barcode(product.Id, int.Parse(batch.Stock.ToString())); //BarcodeController.print_barcode_preview(product.Id); } } Helper.ClearForm.ClearAllTextFields(this); txtDescription.Text = "-"; txtReOrder.Text = "0"; txtName.Focus(); } } else { throw new Exception("Access Denied! (PRODUCT_ADD)"); } } catch (Exception ex) { MessageHelper.AlertError(ex.Message); } }
public Task DeleteProductBatch(ProductBatch productBatch) { return(repository.Delete(productBatch)); }
public Task UpdateProductBatch(ProductBatch productBatch) { return(repository.Update(productBatch)); }
/* crud */ public Task AddProductBatch(ProductBatch productBatch) { return(repository.Add(productBatch)); }
public int Update(ProductBatch objProductBatch, long ProductID) { throw new NotImplementedException(); }