推送销售出库单

This commit is contained in:
2025-11-15 17:56:13 +08:00
parent 3a564d5b91
commit 5e087459df
5 changed files with 279 additions and 28 deletions

View File

@@ -25,7 +25,7 @@ namespace MyCode.Project.Services.Implementation
private const string EXCHANGE_TYPE = "HLTX01_SYS";
private const string DEFAULT_ORG = "100";
private const string DEFAULT_CURRENCY = "PRE001";
private const string DEFAULT_UNIT = "Pcs";
private const string DEFAULT_UNIT = "";
private const string ROW_TYPE_STANDARD = "Standard";
private const string ROW_TYPE_SERVICE = "Service";
private const string FORM_ID = "SAL_OUTSTOCK";
@@ -65,7 +65,7 @@ namespace MyCode.Project.Services.Implementation
throw new BaseException($"未找到ID为 {id} 的销售出库单记录");
}
if (orderHead.Status != 0)
if (orderHead.Status == 2)
{
throw new BaseException($"销售出库单 {orderHead.Sheet} 已经推送过,状态为:{orderHead.Status},不允许重复推送");
}
@@ -129,10 +129,11 @@ namespace MyCode.Project.Services.Implementation
// 获取销售组织ID
string orgId = param.FSALEORGID?.ToString() ?? DEFAULT_ORG;
// 获取仓库编码
string warehouseCode = orderHead.WarehouseCode ?? param.FWAREHOUSECODE ?? "";
// 获取仓库编码
//string warehouseCode = orderHead.WarehouseCode ?? param.FWAREHOUSECODE ?? "";
string warehouseCode = param.FWAREHOUSECODE ;
// 数据校验
if (string.IsNullOrEmpty(warehouseCode))
{
@@ -154,7 +155,7 @@ namespace MyCode.Project.Services.Implementation
BillSave billSave = new BillSave()
{
Model = model,
IsAutoSubmitAndAudit = true,
IsAutoSubmitAndAudit = false,
};
// 调用金蝶服务保存单据
@@ -184,15 +185,16 @@ namespace MyCode.Project.Services.Implementation
return new FSalesOutboundEntryItem()
{
Fcode= item.Barcode ?? "",
FRowType = rowType,
FMaterialID = new FMaterialID()
{
FNumber = item.Barcode ?? ""
},
FUnitID = new FUnitID()
{
FNumber = item.Unit ?? DEFAULT_UNIT
},
//FMaterialID = new FMaterialID()
//{
// FNumber = item.Barcode ?? ""
//},
//FUnitID = new FUnitID()
//{
// FNumber = item.Unit ?? DEFAULT_UNIT
//},
FInventoryQty = 0,
FRealQty = realQty,
FDisPriceQty = 0,
@@ -202,7 +204,11 @@ namespace MyCode.Project.Services.Implementation
FOwnerTypeID = OWNER_TYPE,
FOwnerID = new FOwnerID()
{
FNumber = orgId
FOrgId = orgId
},
FStockID=new FStockID()
{
FNumber = param.FWAREHOUSECODE
},
FEntryTaxRate = param.FTAXRATE,
FAuxUnitQty = 0,
@@ -264,16 +270,16 @@ namespace MyCode.Project.Services.Implementation
FDate = dateStr,
FSaleOrgId = new FSaleOrgId()
{
FNumber = orgId
FOrgId = orgId
},
FCustomerID = new FCustomerID()
{
FNumber = customerId
},
FSaleDeptID = new FSaleDeptID()
{
FNumber = "02"
FCustId = customerId
},
//FSaleDeptID = new FSaleDeptID()
//{
// FNumber = "02"
//},
FReceiverID = new FReceiverID()
{
FNumber = customerId
@@ -284,7 +290,7 @@ namespace MyCode.Project.Services.Implementation
},
FStockOrgId = new FStockOrgId()
{
FNumber = orgId
FOrgId = orgId
},
FSettleID = new FSettleID()
{
@@ -295,13 +301,14 @@ namespace MyCode.Project.Services.Implementation
FNumber = customerId
},
FOwnerTypeIdHead = OWNER_TYPE,
FOwnerIdHead = new FOwnerIdHead()
{
FNumber = orgId
FOrgId = orgId
},
FCDateOffsetValue = 0,
FIsTotalServiceOrCost = false,
F_dmi_Combo = "标准出库",
//F_dmi_Combo = "标准出库",
SubHeadEntity = new FSubHeadEntity()
{
FSettleCurrID = new FSettleCurrID()
@@ -310,7 +317,7 @@ namespace MyCode.Project.Services.Implementation
},
FSettleOrgID = new FSettleOrgID()
{
FNumber = orgId
FOrgId = orgId
},
FIsIncludedTax = false,
FLocalCurrID = new FLocalCurrID()
@@ -327,7 +334,7 @@ namespace MyCode.Project.Services.Implementation
},
FEntity = entryList
};
}
}
}
}