33333
This commit is contained in:
@@ -34,12 +34,13 @@ namespace MyCode.Project.Services.Implementation
|
||||
private IPurchaseOrderItemRepository _purchaseOrderItemRepository;
|
||||
private IInvoiceOrderItemRepository _invoiceOrderItemRepository;
|
||||
private IInvoiceOrderRepository _invoiceOrderRepository;
|
||||
private ITiaoMaRepository _tiaoMaRepository;
|
||||
|
||||
|
||||
public InvoiceOrderService(IPurchaseOrderRepository purchaseOrderRepository
|
||||
, IPurchaseOrderItemRepository purchaseOrderItemRepository
|
||||
, IInvoiceOrderItemRepository invoiceOrderItemRepository
|
||||
, IInvoiceOrderRepository invoiceOrderRepository
|
||||
, ITiaoMaRepository tiaoMaRepository
|
||||
, IWorkProcessService workProcessService
|
||||
, IKingDeeService kingDeeService)
|
||||
{
|
||||
@@ -47,6 +48,7 @@ namespace MyCode.Project.Services.Implementation
|
||||
_purchaseOrderRepository = purchaseOrderRepository;
|
||||
_invoiceOrderItemRepository = invoiceOrderItemRepository;
|
||||
_invoiceOrderRepository = invoiceOrderRepository;
|
||||
_tiaoMaRepository = tiaoMaRepository;
|
||||
_workProcessService = workProcessService;
|
||||
_kingDeeService = kingDeeService;
|
||||
}
|
||||
@@ -201,21 +203,100 @@ namespace MyCode.Project.Services.Implementation
|
||||
}
|
||||
_invoiceOrderItemRepository.Update(oldOrderItemList);
|
||||
//物料编码,数量,收料通知单号,供应商批号,key
|
||||
AddTiaoMa addTiao = new AddTiaoMa();
|
||||
List<AddTiaoMa> addTiaoMas = new List<AddTiaoMa>();
|
||||
addTiaoMas = oldOrderItemList.Select(t => new AddTiaoMa
|
||||
{
|
||||
FBarCode = $@"{t.MaterialCode}*{t.Qty.Value.ToString("F2")}*{sheetOrder.FBillNo}*{t.FSupplierLot}",
|
||||
FBarCodeRule = "03",
|
||||
FBillCode = sheetOrder.FBillNo,
|
||||
FSupplierLot = t.FSupplierLot == null ? "" : t.FSupplierLot,
|
||||
FMaterialId = t.MaterialCode,
|
||||
FLot=t.MSSSupplierLot,
|
||||
FQty = t.Qty.Value.ToString()
|
||||
}).ToList();
|
||||
_workProcessService.Add<IKingDeeService>(this.MerchantId, "AddTiaoMa", "生成条码档案", JsonHelper.ToJson(addTiaoMas), 5);
|
||||
//AddTiaoMa addTiao = new AddTiaoMa();
|
||||
//List<AddTiaoMa> addTiaoMas = new List<AddTiaoMa>();
|
||||
//addTiaoMas = oldOrderItemList.Select(t => new AddTiaoMa
|
||||
//{
|
||||
// FBarCode = $@"{t.MaterialCode}*{t.Qty.Value.ToString("F2")}*{sheetOrder.FBillNo}*{t.FSupplierLot}",
|
||||
// FBarCodeRule = "03",
|
||||
// FBillCode = sheetOrder.FBillNo,
|
||||
// FSupplierLot = t.FSupplierLot == null ? "" : t.FSupplierLot,
|
||||
// FMaterialId = t.MaterialCode,
|
||||
// FLot=t.MSSSupplierLot,
|
||||
// FQty = t.Qty.Value.ToString()
|
||||
//}).ToList();
|
||||
//_workProcessService.Add<IKingDeeService>(this.MerchantId, "AddTiaoMa", "生成条码档案", JsonHelper.ToJson(addTiaoMas), 5);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region SetBaoShuTiaoMa(根据每包数量得到全部包裹打印条码)
|
||||
/// <summary>
|
||||
/// 根据每包数量得到全部包裹打印条码
|
||||
/// </summary>
|
||||
/// <param name="act"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="BaseException"></exception>
|
||||
[TransactionCallHandler]
|
||||
public TiaoMaResp SetBaoShuTiaoMa(TiaoMaAct act)
|
||||
{
|
||||
if (act.CuseQty <= 0)
|
||||
{
|
||||
throw new BaseException("每包数量必须大于0");
|
||||
}
|
||||
_tiaoMaRepository.Delete(t => t.InvoceOrderItemId == act.Id);
|
||||
var orderItem = _invoiceOrderItemRepository.Queryable().Where(t => t.Id == act.Id).First();
|
||||
if (orderItem == null)
|
||||
{
|
||||
throw new BaseException("不正确的ID值");
|
||||
}
|
||||
var order = _invoiceOrderRepository.Queryable().Where(t => t.Id == orderItem.InvoiceOrderId).First();
|
||||
|
||||
decimal zongQty = orderItem.Qty.SafeValue();
|
||||
int yu =(int) Math.Ceiling( zongQty % act.CuseQty);
|
||||
int baoShu = 0;
|
||||
baoShu = (int)(zongQty / act.CuseQty);
|
||||
List<TiaoMa> addList = new List<TiaoMa>();
|
||||
// 条码 :物料编码,数量,收料通知单号,供应商批号,key
|
||||
for (int i = 0; i < baoShu; i++)
|
||||
{
|
||||
|
||||
string FBarCode = $@"{orderItem.MaterialCode}*{act.CuseQty.ToString("F2")}*{orderItem.FBillNo}*{orderItem.FSupplierLot}";
|
||||
TiaoMa tiaoMa = new TiaoMa();
|
||||
tiaoMa = AutoMapperHelper.AutoMappToSingle<TiaoMa, InvoiceOrderItem>(orderItem);
|
||||
tiaoMa.Id = Guid.NewGuid();
|
||||
tiaoMa.FBarCode = FBarCode;
|
||||
tiaoMa.Qty = act.CuseQty;
|
||||
tiaoMa.SortNum = i+1;
|
||||
tiaoMa.PurchaseBillNo = orderItem.FBillNo;
|
||||
tiaoMa.FBillNo = order.FBillNo;
|
||||
addList.Add(tiaoMa);
|
||||
}
|
||||
if (yu > 0)
|
||||
{
|
||||
string FBarCode = $@"{orderItem.MaterialCode}*{decimal.Parse(yu.ToString()).ToString("F2")}*{orderItem.FBillNo}*{orderItem.FSupplierLot}";
|
||||
TiaoMa tiaoMa = new TiaoMa();
|
||||
tiaoMa = AutoMapperHelper.AutoMappToSingle<TiaoMa, InvoiceOrderItem>(orderItem);
|
||||
tiaoMa.Id = Guid.NewGuid();
|
||||
tiaoMa.FBarCode = FBarCode;
|
||||
tiaoMa.Qty = yu;
|
||||
tiaoMa.SortNum = baoShu+1;
|
||||
tiaoMa.PurchaseBillNo = orderItem.FBillNo;
|
||||
tiaoMa.FBillNo = order.FBillNo;
|
||||
addList.Add(tiaoMa);
|
||||
}
|
||||
|
||||
_tiaoMaRepository.Add(addList);
|
||||
|
||||
List<AddTiaoMa> addTiaoMas = new List<AddTiaoMa>();
|
||||
addTiaoMas = addList.Select(t => new AddTiaoMa
|
||||
{
|
||||
FBarCode =t.FBarCode,
|
||||
FBarCodeRule = "03",
|
||||
FBillCode = t.FBillNo,
|
||||
FSupplierLot = t.FSupplierLot == null ? "" : t.FSupplierLot,
|
||||
FMaterialId = t.MaterialCode,
|
||||
FLot = t.MSSSupplierLot,
|
||||
FQty = t.Qty.Value.ToString()
|
||||
}).ToList();
|
||||
_workProcessService.Add<IKingDeeService>(this.MerchantId, "AddTiaoMa", "生成条码档案", JsonHelper.ToJson(addTiaoMas), 5);
|
||||
|
||||
TiaoMaResp result = new TiaoMaResp();
|
||||
result.Id = orderItem.Id;
|
||||
result.BarCodeList = addList.Select(t => t.FBarCode).ToList();
|
||||
return result;
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user