From 1cd4e66b490e4b6cc3368771cdff164990e152e7 Mon Sep 17 00:00:00 2001
From: cdk <2441919651@qq.com>
Date: 星期一, 22 十二月 2025 17:35:57 +0800
Subject: [PATCH] 接口增加单位换算,dab增加两个字段
---
MES.Service/service/BasicData/ProductionOrderManager.cs | 41 +++++++++++++++++++++++++++++++++--------
1 files changed, 33 insertions(+), 8 deletions(-)
diff --git a/MES.Service/service/BasicData/ProductionOrderManager.cs b/MES.Service/service/BasicData/ProductionOrderManager.cs
index 9c3cd46..c0e43e8 100644
--- a/MES.Service/service/BasicData/ProductionOrderManager.cs
+++ b/MES.Service/service/BasicData/ProductionOrderManager.cs
@@ -14,12 +14,14 @@
private readonly ProductionOrderSubManager _productionOrderSubManager =
new();
+ private string ORDERNO = "";
+
//ErpWYOrder
public bool Save(ErpWYOrder wyOrder)
{
var erpProductionOrderDto = wyOrder.OrderDto;
- var mesRohIn = ConvertErpToProductionOrder(erpProductionOrderDto);
+ var mesRohIn = ConvertErpToProductionOrder(erpProductionOrderDto, wyOrder.Items[0].FBILLNO);
var mesRohInDatas =
ConvertErpToProductionOrderSub(wyOrder.Items);
@@ -33,7 +35,11 @@
// ? 1
// : 0;
case "3":
- return UpdateData(db, mesRohIn, mesRohInDatas) ? 1 : 0;
+ //return UpdateData(db, mesRohIn, mesRohInDatas) ? 1 : 0;//鏀逛负涓嶅垹闄�
+ return SaveOrUpdateData(db, mesRohIn, mesRohInDatas,
+ erpProductionOrderDto.Type)
+ ? 1
+ : 0;
case "2":
case "4":
return SaveOrUpdateData(db, mesRohIn, mesRohInDatas,
@@ -68,6 +74,12 @@
private bool SaveOrUpdateData(SqlSugarScope db, ProductionOrder mesRohIn,
List<ProductionOrderSub> mesRohInDatas, string type)
{
+ if(type == "3" || (mesRohIn.DocumentStatus != null && mesRohIn.DocumentStatus != "C"))
+ {
+ mesRohIn.Typea = "3"; // 鏂板瀛楁璧嬪��
+ mesRohIn.OrderNo = mesRohIn.OrderNo + "F" + mesRohIn.ErpProductionEntryCode;
+ }
+
if (StringUtil.CheckGuid(mesRohIn.Guid))
db.Deleteable<ProductionOrder>()
.Where(s => s.Guid == mesRohIn.Guid)
@@ -84,9 +96,14 @@
var baOrUpdate = db.Insertable(mesRohInDatas).PageSize(1)
.IgnoreColumnsNull()
.ExecuteCommand() > 0;
-
- if (orUpdate && baOrUpdate) return true;
+ if (orUpdate && baOrUpdate)
+ {
+ db.Ado.ExecuteCommand("exec [dbo].[prc_unit_check] @billno, @ModuleType",
+ new { billno = mesRohIn.OrderNo, ModuleType = "濮斿宸ュ崟" });
+
+ return true;
+ }
throw new NotImplementedException("鎻掑叆鎴栨洿鏂板け璐�");
}
@@ -98,7 +115,7 @@
}
private ProductionOrder ConvertErpToProductionOrder(
- ErpProductionOrderDto erpDto)
+ ErpProductionOrderDto erpDto,string SUBBOM)
{
DateTime parsedDate;
@@ -116,7 +133,7 @@
var productionOrder = new ProductionOrder
{
- OrderNo = erpDto.FBillNo,
+ OrderNo = SUBBOM,
Warehouse = erpDto.FStockID,
OrderDate = ParseDateTime(erpDto.FDate) ?? null,
OrderType = erpDto.FBillType,
@@ -162,10 +179,18 @@
ReqSrc = erpDto.FReqSrc,
SrcSplitSeq = erpDto.SrcSplitSeq,
Typea = erpDto.TypeA,
+ DocumentStatus = erpDto.FDocumentStatus
+
};
- var single = base.GetSingle(it => it.ErpId == erpDto.FID);
- if (single != null) productionOrder.Guid = single.Guid;
+ var single = base.GetSingle(it => it.ErpProductionEntryCode == erpDto.FSUBENTRYID);
+ if (single != null)
+ {
+ productionOrder.Guid = single.Guid;
+ productionOrder.AuditDate = single.AuditDate;
+ productionOrder.AuditStatus = single.AuditStatus;
+ productionOrder.Auditor = single.Auditor;
+ }
return productionOrder;
}
--
Gitblit v1.9.3