22
This commit is contained in:
parent
f1aab7790a
commit
7d3a84e9b0
@ -174,7 +174,10 @@ namespace MyCode.Project.Domain.Message.Response.InvoiceOrder
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string FPurchaseOrgName { get; set; }
|
public string FPurchaseOrgName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 每包数量
|
||||||
|
/// </summary>
|
||||||
|
public decimal CuseQty { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -191,5 +191,12 @@ namespace MyCode.Project.Domain.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int? EntityId {get;set;}
|
public int? EntityId {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:每包数量
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public decimal? CuseQty {get;set;}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ namespace MyCode.Project.Repositories
|
|||||||
,[Remark]
|
,[Remark]
|
||||||
,b.[PurchaseOrderId]
|
,b.[PurchaseOrderId]
|
||||||
,[InvoiceOrderId]
|
,[InvoiceOrderId]
|
||||||
|
,b.CuseQty
|
||||||
,[UnitName]
|
,[UnitName]
|
||||||
,[TaxRate]
|
,[TaxRate]
|
||||||
,[FBillTaxAmount]
|
,[FBillTaxAmount]
|
||||||
|
@ -240,57 +240,68 @@ namespace MyCode.Project.Services.Implementation
|
|||||||
{
|
{
|
||||||
throw new BaseException("不正确的ID值");
|
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>();
|
List<TiaoMa> addList = new List<TiaoMa>();
|
||||||
// 条码 :物料编码,数量,收料通知单号,供应商批号,key
|
if (orderItem.CuseQty == act.CuseQty)
|
||||||
for (int i = 0; i < baoShu; i++)
|
|
||||||
{
|
{
|
||||||
|
var barcodeList = _tiaoMaRepository.Queryable().Where(t => t.InvoceOrderItemId == orderItem.Id).ToList();
|
||||||
string FBarCode = $@"{orderItem.MaterialCode}*{act.CuseQty.ToString("F2")}*{orderItem.FBillNo}*{orderItem.FSupplierLot}";
|
addList = barcodeList;
|
||||||
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)
|
else
|
||||||
{
|
|
||||||
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,
|
orderItem.CuseQty = act.CuseQty;
|
||||||
FBarCodeRule = "03",
|
_invoiceOrderItemRepository.Update(orderItem);
|
||||||
FBillCode = t.FBillNo,
|
var order = _invoiceOrderRepository.Queryable().Where(t => t.Id == orderItem.InvoiceOrderId).First();
|
||||||
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);
|
|
||||||
|
|
||||||
|
decimal zongQty = orderItem.Qty.SafeValue();
|
||||||
|
int yu = (int)Math.Ceiling(zongQty % act.CuseQty);
|
||||||
|
int baoShu = 0;
|
||||||
|
baoShu = (int)(zongQty / act.CuseQty);
|
||||||
|
|
||||||
|
// 条码 :物料编码,数量,收料通知单号,供应商批号,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();
|
TiaoMaResp result = new TiaoMaResp();
|
||||||
result.Id = orderItem.Id;
|
result.Id = orderItem.Id;
|
||||||
result.BarCodeList = addList.Select(t => t.FBarCode).ToList();
|
result.BarCodeList = addList.Select(t => t.FBarCode).ToList();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user