private void waybillProductionCompleted(IDAL dal, ProductionOrder po) { MikroOperations mikro = new MikroOperations(dal); // önceki tamamlanan kayıtları oku, son satır numarasını almak için IEnumerable <MikroWaybill> currentwb = mikro.ReadWaybill(DateTime.Now, "OPR", (int)po.ProductionOrderId); var item = currentwb.OrderByDescending(x => x.DocumentRowNo).First(); // sistemsel olarak kalan ama gerçekte kayıptan dolayı kalmamış olan giriş ürünlerini 0'la. MikroWaybill wb = new MikroWaybill(); wb.TransactionDate = DateTime.Now; wb.TransactionKind = (int)TransactionKind.Uretim; wb.TransactionType = (int)TransactionType.Cikis; wb.DocumentDate = DateTime.Now; wb.DocumentSerial = "OPR"; wb.DocumentNo = (int)po.ProductionOrderId; wb.DocumentType = (int)DocumentType.UretimFisi; wb.IsRefund = false; wb.ReceiverWarehouse = 1; wb.SenderWarehouse = (int)WarehouseList.Production; wb.IntakeShipmentDate = DateTime.Now; int rowno; rowno = item.DocumentRowNo + 1; IUniParameter prmProduction = dal.CreateParameter("Production", po.Production); IEnumerable <ProductionContent> contents = dal.List <ProductionContent>("WHS_LST_PRODUCTIONCONTENT_SP", prmProduction).ToList(); foreach (ProductionContent p in contents) { decimal completed = (decimal)po.CompletedQuantity; wb.Quantity = p.AllocatedQuantity; Product pInfo = dal.Read <Product>(p.Product); wb.ProductCode = pInfo.Code; switch (pInfo.SaleVAT) { case 0: wb.VATCode = 1; break; case 1: wb.VATCode = 2; break; case 8: wb.VATCode = 3; break; case 18: wb.VATCode = 4; break; default: wb.VATCode = 0; break; } wb.DocumentRowNo = rowno++; mikro.CreateWaybill(wb); } }
private void waybillFromMainWHtoProductionWH(IDAL dal, ProductionOrder po) { MikroOperations mikro = new MikroOperations(dal); MikroWaybill wb = new MikroWaybill(); wb.TransactionDate = DateTime.Now; wb.TransactionKind = (int)TransactionKind.Transfer; wb.TransactionType = (int)TransactionType.DepoTransfer; wb.DocumentDate = DateTime.Now; wb.DocumentSerial = "OMP"; wb.DocumentNo = (int)po.ProductionOrderId; wb.DocumentType = (int)DocumentType.DepoTransferFisi; wb.IsRefund = false; wb.ReceiverWarehouse = (int)WarehouseList.Production; wb.SenderWarehouse = (int)WarehouseList.Main; wb.IntakeShipmentDate = DateTime.Now; int rowno = 1; foreach (ProductionContent p in po.contents) { wb.Quantity = p.RequiredPackage * p.UnitWeight; Product pInfo = dal.Read <Product>(p.Product); wb.ProductCode = pInfo.Code; switch (pInfo.SaleVAT) { case 0: wb.VATCode = 1; break; case 1: wb.VATCode = 2; break; case 8: wb.VATCode = 3; break; case 18: wb.VATCode = 4; break; default: wb.VATCode = 0; break; } wb.DocumentRowNo = rowno++; mikro.CreateWaybill(wb); } }
private void waybillProduction(IDAL dal, ProductionOrder po) { MikroOperations mikro = new MikroOperations(dal); // önceki tamamlanan kayıtları oku, son satır numarasını almak için IEnumerable <MikroWaybill> currentwb = mikro.ReadWaybill(DateTime.Now, "OPR", (int)po.ProductionOrderId); int lastRowNo = 0; if (currentwb.Count() > 0) { var item = currentwb.OrderByDescending(x => x.DocumentRowNo).First(); lastRowNo = item.DocumentRowNo + 1; } // Üretim depoya giriş satırını oluştur MikroWaybill wb = new MikroWaybill(); wb.TransactionDate = DateTime.Now; wb.TransactionKind = (int)TransactionKind.Uretim; wb.TransactionType = (int)TransactionType.Giris; wb.DocumentDate = DateTime.Now; wb.DocumentSerial = "OPR"; wb.DocumentNo = (int)po.ProductionOrderId; wb.DocumentType = (int)DocumentType.UretimFisi; wb.IsRefund = false; wb.ReceiverWarehouse = (int)WarehouseList.Production; wb.SenderWarehouse = 1; wb.IntakeShipmentDate = DateTime.Now; Production prInfo = dal.Read <Production>(po.Production); Product prProductInfo = dal.Read <Product>(prInfo.Product); wb.ProductCode = prProductInfo.Code; wb.Quantity = (decimal)po.PartialCompletion; int rowno; wb.DocumentRowNo = lastRowNo; mikro.CreateWaybill(wb); rowno = lastRowNo + 1; // üretim sırasında tüketilen ürünlerin çıkışını yap. IUniParameter prmProduction = dal.CreateParameter("Production", po.Production); IEnumerable <ProductionContent> contents = dal.List <ProductionContent>("WHS_LST_PRODUCTIONCONTENT_SP", prmProduction).ToList(); foreach (ProductionContent p in contents) { wb.ReceiverWarehouse = 1; wb.SenderWarehouse = (int)WarehouseList.Production; wb.TransactionType = (int)TransactionType.Cikis; wb.Quantity = (decimal)po.PartialCompletion * p.ShareRate / 100; Product pInfo = dal.Read <Product>(p.Product); wb.ProductCode = pInfo.Code; switch (pInfo.SaleVAT) { case 0: wb.VATCode = 1; break; case 1: wb.VATCode = 2; break; case 8: wb.VATCode = 3; break; case 18: wb.VATCode = 4; break; default: wb.VATCode = 0; break; } wb.DocumentRowNo = rowno++; mikro.CreateWaybill(wb); } // üretim depodan merkez depoya aktarımı yap. wb.TransactionKind = (int)TransactionKind.Transfer; wb.TransactionType = (int)TransactionType.DepoTransfer; wb.DocumentType = (int)DocumentType.DepoTransferFisi; wb.ReceiverWarehouse = (int)WarehouseList.Main; wb.SenderWarehouse = (int)WarehouseList.Production; wb.ProductCode = prProductInfo.Code; wb.Quantity = (decimal)po.PartialCompletion; wb.DocumentRowNo = rowno++; mikro.CreateWaybill(wb); }