diff --git a/MyCode.Project.Domain/Message/Act/PurchaseOrder/UpdateTime.cs b/MyCode.Project.Domain/Message/Act/PurchaseOrder/UpdateTime.cs
index 2818919..243231e 100644
--- a/MyCode.Project.Domain/Message/Act/PurchaseOrder/UpdateTime.cs
+++ b/MyCode.Project.Domain/Message/Act/PurchaseOrder/UpdateTime.cs
@@ -51,6 +51,20 @@ namespace MyCode.Project.Domain.Message.Act.PurchaseOrder
public string FSupplierLot { get; set; }
}
+
+ public class TiaoMaAct
+ {
+ ///
+ /// 明细主键ID
+ ///
+ public Guid Id { get; set; }
+
+ ///
+ /// 每包数量
+ ///
+ public decimal CuseQty { get; set; }
+ }
+
public class PushReceiveAct
{
///
diff --git a/MyCode.Project.Domain/Message/Response/InvoiceOrder/TiaoMaResp.cs b/MyCode.Project.Domain/Message/Response/InvoiceOrder/TiaoMaResp.cs
new file mode 100644
index 0000000..b7cb3c2
--- /dev/null
+++ b/MyCode.Project.Domain/Message/Response/InvoiceOrder/TiaoMaResp.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MyCode.Project.Domain.Message.Response.InvoiceOrder
+{
+ public class TiaoMaResp
+ {
+ ///
+ /// 明细主键ID
+ ///
+ public Guid Id { get; set; }
+
+ ///
+ /// 对应的条码数组
+ ///
+ public List BarCodeList { get; set; }
+ }
+}
diff --git a/MyCode.Project.Domain/Model/TiaoMa.cs b/MyCode.Project.Domain/Model/TiaoMa.cs
new file mode 100644
index 0000000..a5efac7
--- /dev/null
+++ b/MyCode.Project.Domain/Model/TiaoMa.cs
@@ -0,0 +1,139 @@
+using System;
+using System.Linq;
+using System.Text;
+using SqlSugar;
+
+namespace MyCode.Project.Domain.Model
+{
+ ///
+ ///
+ ///
+ [SugarTable("TiaoMa")]
+ public partial class TiaoMa
+ {
+ public TiaoMa(){
+
+
+ }
+ ///
+ /// Desc:
+ /// Default:
+ /// Nullable:False
+ ///
+ [SugarColumn(IsPrimaryKey=true)]
+ public Guid Id {get;set;}
+
+ ///
+ /// Desc:金蝶的收料通知单ID
+ /// Default:
+ /// Nullable:True
+ ///
+ public int? Fid {get;set;}
+
+ ///
+ /// Desc:物料编码
+ /// Default:
+ /// Nullable:True
+ ///
+ public string MaterialCode {get;set;}
+
+ ///
+ /// Desc:物料名称
+ /// Default:
+ /// Nullable:True
+ ///
+ public string MaterialName {get;set;}
+
+ ///
+ /// Desc:规格型号
+ /// Default:
+ /// Nullable:True
+ ///
+ public string SpecificationModel {get;set;}
+
+ ///
+ /// Desc:发货数量
+ /// Default:
+ /// Nullable:True
+ ///
+ public decimal? Qty {get;set;}
+
+ ///
+ /// Desc:单价
+ /// Default:
+ /// Nullable:True
+ ///
+ public decimal? UnitPrice {get;set;}
+
+ ///
+ /// Desc:排序字段
+ /// Default:
+ /// Nullable:True
+ ///
+ public int? SortNum {get;set;}
+
+ ///
+ /// Desc:采购明细单主键ID
+ /// Default:
+ /// Nullable:True
+ ///
+ public Guid? PurchaseOrderItemId {get;set;}
+
+ ///
+ /// Desc:采购明细单主键ID
+ /// Default:
+ /// Nullable:True
+ ///
+ public Guid? InvoceOrderItemId {get;set;}
+
+ ///
+ /// Desc:条码
+ /// Default:
+ /// Nullable:True
+ ///
+ public string FBarCode {get;set;}
+
+ ///
+ /// Desc:供应商批号
+ /// Default:
+ /// Nullable:True
+ ///
+ public string FSupplierLot {get;set;}
+
+ ///
+ /// Desc:美塞斯批号
+ /// Default:
+ /// Nullable:True
+ ///
+ public string MSSSupplierLot {get;set;}
+
+ ///
+ /// Desc:金蝶的采购明细主键ID
+ /// Default:
+ /// Nullable:True
+ ///
+ public int? PurchaseEntityId {get;set;}
+
+ ///
+ /// Desc:发货日期
+ /// Default:
+ /// Nullable:True
+ ///
+ public DateTime? DeliveryDate {get;set;}
+
+ ///
+ /// Desc:金蝶的采购订单号,PO 号
+ /// Default:
+ /// Nullable:True
+ ///
+ public string PurchaseBillNo {get;set;}
+
+ ///
+ /// Desc:金蝶的收料订单号
+ /// Default:
+ /// Nullable:True
+ ///
+ public string FBillNo {get;set;}
+
+ }
+}
diff --git a/MyCode.Project.Domain/MyCode.Project.Domain.csproj b/MyCode.Project.Domain/MyCode.Project.Domain.csproj
index 5266c56..5ff9619 100644
--- a/MyCode.Project.Domain/MyCode.Project.Domain.csproj
+++ b/MyCode.Project.Domain/MyCode.Project.Domain.csproj
@@ -141,6 +141,7 @@
+
@@ -155,6 +156,7 @@
+
@@ -165,6 +167,7 @@
+
diff --git a/MyCode.Project.Domain/Repositories/ITiaoMaRepository.cs b/MyCode.Project.Domain/Repositories/ITiaoMaRepository.cs
new file mode 100644
index 0000000..bd7bf1c
--- /dev/null
+++ b/MyCode.Project.Domain/Repositories/ITiaoMaRepository.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using MyCode.Project.Infrastructure;
+using MyCode.Project.Domain;
+using MyCode.Project.Domain.Model;
+using MyCode.Project.Infrastructure.Common;
+using MyCode.Project.Domain.Message;
+
+namespace MyCode.Project.Domain.Repositories
+{
+ public interface ITiaoMaRepository : IRepository
+ {
+
+ }
+}
diff --git a/MyCode.Project.Repositories/MyCode.Project.Repositories.csproj b/MyCode.Project.Repositories/MyCode.Project.Repositories.csproj
index 90d70a2..2bbf2da 100644
--- a/MyCode.Project.Repositories/MyCode.Project.Repositories.csproj
+++ b/MyCode.Project.Repositories/MyCode.Project.Repositories.csproj
@@ -91,6 +91,7 @@
+
diff --git a/MyCode.Project.Repositories/TiaoMaRepository.cs b/MyCode.Project.Repositories/TiaoMaRepository.cs
new file mode 100644
index 0000000..31bd1c4
--- /dev/null
+++ b/MyCode.Project.Repositories/TiaoMaRepository.cs
@@ -0,0 +1,26 @@
+using MyCode.Project.Repositories.Common;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using MyCode.Project.Domain.Message;
+using MyCode.Project.Domain.Model;
+using MyCode.Project.Domain.Repositories;
+using MyCode.Project.Infrastructure.Common;
+using MyCode.Project.Infrastructure.Search;
+
+namespace MyCode.Project.Repositories
+{
+ public class TiaoMaRepository: Repository, ITiaoMaRepository
+ {
+ public TiaoMaRepository(MyCodeSqlSugarClient context) : base(context)
+ { }
+
+
+
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/MyCode.Project.ScheduleTask/App.config b/MyCode.Project.ScheduleTask/App.config
index e40164c..54a2014 100644
--- a/MyCode.Project.ScheduleTask/App.config
+++ b/MyCode.Project.ScheduleTask/App.config
@@ -38,7 +38,7 @@
-
+
diff --git a/MyCode.Project.Services/IServices/IInvoiceOrderService.cs b/MyCode.Project.Services/IServices/IInvoiceOrderService.cs
index 17e19cf..f33a12b 100644
--- a/MyCode.Project.Services/IServices/IInvoiceOrderService.cs
+++ b/MyCode.Project.Services/IServices/IInvoiceOrderService.cs
@@ -1,4 +1,5 @@
-using MyCode.Project.Domain.Message.Common;
+using MyCode.Project.Domain.Message.Act.PurchaseOrder;
+using MyCode.Project.Domain.Message.Common;
using MyCode.Project.Domain.Message.Request.InvoiceOrder;
using MyCode.Project.Domain.Message.Response.InvoiceOrder;
using MyCode.Project.Domain.Message.Response.User;
@@ -35,5 +36,12 @@ namespace MyCode.Project.Services
///
///
void SetMSSSupplierLot(string sheet);
+
+ ///
+ /// 根据每包数量得到全部包裹打印条码
+ ///
+ ///
+ ///
+ TiaoMaResp SetBaoShuTiaoMa(TiaoMaAct act);
}
}
diff --git a/MyCode.Project.Services/Implementation/InvoiceOrder/InvoiceOrderService.cs b/MyCode.Project.Services/Implementation/InvoiceOrder/InvoiceOrderService.cs
index a2aabc5..2f9cefb 100644
--- a/MyCode.Project.Services/Implementation/InvoiceOrder/InvoiceOrderService.cs
+++ b/MyCode.Project.Services/Implementation/InvoiceOrder/InvoiceOrderService.cs
@@ -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 addTiaoMas = new List();
- 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(this.MerchantId, "AddTiaoMa", "生成条码档案", JsonHelper.ToJson(addTiaoMas), 5);
+ //AddTiaoMa addTiao = new AddTiaoMa();
+ //List addTiaoMas = new List();
+ //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(this.MerchantId, "AddTiaoMa", "生成条码档案", JsonHelper.ToJson(addTiaoMas), 5);
}
}
#endregion
+
+ #region SetBaoShuTiaoMa(根据每包数量得到全部包裹打印条码)
+ ///
+ /// 根据每包数量得到全部包裹打印条码
+ ///
+ ///
+ ///
+ ///
+ [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 addList = new List();
+ // 条码 :物料编码,数量,收料通知单号,供应商批号,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(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(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 addTiaoMas = new List();
+ 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(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
}
}
diff --git a/MyCode.Project.Services/Implementation/PurchaseOrder/PurchaseOrderService.cs b/MyCode.Project.Services/Implementation/PurchaseOrder/PurchaseOrderService.cs
index 6a3b7a7..c453a8c 100644
--- a/MyCode.Project.Services/Implementation/PurchaseOrder/PurchaseOrderService.cs
+++ b/MyCode.Project.Services/Implementation/PurchaseOrder/PurchaseOrderService.cs
@@ -148,7 +148,7 @@ namespace MyCode.Project.Services.Implementation
,FSupplierLot,FLot,FBaseDeliveryMaxQty,FBaseJoinQty
,FEntryNote,FBillAllAmount_LC,FMaterialId.FNAME,FQty,FEntryNote,FUnitId.fname,FDeliveryDate,FMaterialId.FSpecification,FPurchaserId.fname,FSupplierId.FNumber,FMaterialId.FNumber
,FSettleCurrId.fname,FBillTaxAmount,FExchangeTypeId.fname,FExchangeRate,FEntryTaxRate,FPrice,FAllAmount,FEntryAmount,FEntryTaxAmount,FReceiveQty,FMRPCloseStatus
- ,FPurchaseOrgId,FPurchaseOrgId.FName
+ ,FPurchaseOrgId,FPurchaseOrgId.FName,FPOORDERENTRY_D.FDeliveryDate
,FCancelStatus,FRemainReceiveQty",
//FieldKeys ="",
TopRowCount = 100000,
@@ -468,7 +468,7 @@ namespace MyCode.Project.Services.Implementation
userList.ForEach(t =>
{
var maxDate = _purchaseOrderRepository.Queryable().Where(h => h.SupplierId == t.SupplierId).Max(h => h.FModifyDate);
- DateTime begin = DateTime.Parse("2023-01-01");
+ DateTime begin = DateTime.Parse("2024-01-01");
if (maxDate.HasValue)
{
begin = maxDate.Value.Date;
@@ -583,14 +583,14 @@ namespace MyCode.Project.Services.Implementation
purchaseOrderItem.Remark = item["FEntryNote"];
purchaseOrderItem.SupplierId = t.SupplierId;
purchaseOrderItem.UnitName = item["FUnitId.fname"];
- purchaseOrderItem.FDeliveryDate = item["FDeliveryDate"];
+ purchaseOrderItem.FDeliveryDate = item["FPOORDERENTRY_D.FDeliveryDate"];
purchaseOrderItem.TaxRate = item["FEntryTaxRate"];
purchaseOrderItem.FBillTaxAmount = item["FEntryTaxAmount"];
purchaseOrderItem.FRemainReceiveQty = item["FBaseDeliveryMaxQty"];
purchaseOrderItem.FReceiveQty = item["FBaseJoinQty"];
purchaseOrderItem.FRemainReceiveQty = purchaseOrderItem.Qty - purchaseOrderItem.FReceiveQty.SafeValue();
purchaseOrderItem.FMRPCloseStatus = item["FMRPCloseStatus"];
- purchaseOrderItem.EntityId = item["FPOOrderEntry.FEntryId"];
+ purchaseOrderItem.EntityId = item["FPOOrderEntry_FEntryId"];
purchaseOrderItem.MSSSupplierLot = item["FLot"];
purchaseOrderItem.SpecificationModel = item["FMaterialId.FSpecification"];
_purchaseOrderItemRepository.Add(purchaseOrderItem);
@@ -607,7 +607,7 @@ namespace MyCode.Project.Services.Implementation
oldItem.Remark = item["FEntryNote"];
oldItem.SupplierId = t.SupplierId;
oldItem.UnitName = item["FUnitId.fname"];
- oldItem.FDeliveryDate = item["FDeliveryDate"];
+ oldItem.FDeliveryDate = item["FPOORDERENTRY_D.FDeliveryDate"];
oldItem.TaxRate = item["FEntryTaxRate"];
oldItem.FBillTaxAmount = item["FEntryTaxAmount"];
oldItem.FReceiveQty = item["FBaseJoinQty"];
@@ -616,10 +616,8 @@ namespace MyCode.Project.Services.Implementation
//oldItem.FRemainReceiveQty = item["FBaseDeliveryMaxQty"];
//purchaseOrderItem.FReceiveQty = item["FBaseDeliveryMaxQty"];
oldItem.FReceiveQty = oldItem.Qty - oldItem.FRemainReceiveQty.SafeValue();
-
-
oldItem.FMRPCloseStatus = item["FMRPCloseStatus"];
- oldItem.EntityId = item["FPOOrderEntry.FEntryId"];
+ oldItem.EntityId = item["FPOOrderEntry_FEntryId"];
oldItem.MSSSupplierLot = item["FLot"];
_purchaseOrderItemRepository.Update(oldItem);
}
@@ -641,8 +639,9 @@ namespace MyCode.Project.Services.Implementation
// end = DateTime.Now.AddDays(-1);
// begin = end;
//}
+ Thread.Sleep(500);
}
- Thread.Sleep(500);
+
keyValuePairs.Keys.ForEach(key =>
{
List templist = keyValuePairs[key];
@@ -695,24 +694,7 @@ namespace MyCode.Project.Services.Implementation
- // {
- //"EntryIds": "100016,100017",
- //"TargetFormId": "PUR_ReceiveBill",
- //"IsEnableDefaultRule": "true",
- //"CustomParams": {
- // "AutoAudit":"true",
- // "ScanEntry": [
- // {
- // "FENTRYID": 100016,
- // "Qty": 15
-
- // },
- // {
- // "FENTRYID": 100017,
- // "Qty": 15
- // }
- // ]
- //}
+
}
}
diff --git a/MyCode.Project.WebApi/Areas/Admin/Controllers/InvoiceOrderController.cs b/MyCode.Project.WebApi/Areas/Admin/Controllers/InvoiceOrderController.cs
index a795948..49826bd 100644
--- a/MyCode.Project.WebApi/Areas/Admin/Controllers/InvoiceOrderController.cs
+++ b/MyCode.Project.WebApi/Areas/Admin/Controllers/InvoiceOrderController.cs
@@ -52,9 +52,22 @@ namespace MyCode.Project.WebApi.Areas.Admin.Controllers
///
///
[HttpPost]
- public void DeleteOrder(IdAct act )
+ public void DeleteOrder(IdAct act)
{
- _invoiceOrderService.DeleteOrder(act,this.CurrentLogin);
+ _invoiceOrderService.DeleteOrder(act, this.CurrentLogin);
+ }
+ #endregion
+
+ #region SetBaoShuTiaoMa(根据每包数量得到全部包裹打印条码)
+ ///
+ /// 根据每包数量得到全部包裹打印条码
+ ///
+ ///
+ ///
+ [HttpPost]
+ public TiaoMaResp SetBaoShuTiaoMa(TiaoMaAct act)
+ {
+ return _invoiceOrderService.SetBaoShuTiaoMa(act);
}
#endregion
}