This commit is contained in:
熊帅 2025-11-17 10:15:22 +08:00
commit 4d328458ed
8 changed files with 364 additions and 75 deletions

View File

@ -37,6 +37,7 @@ namespace MyCode.Project.Domain.Message.Request.KingDee.SaveModel
public class FOwnerIdHead
{
public string FOrgId { get; set; }
public string FNumber { get; set; }
}
@ -61,6 +62,7 @@ namespace MyCode.Project.Domain.Message.Request.KingDee.SaveModel
public class FSettleOrgId
{
public string FOrgId { get; set; }
public string FNumber { get; set; }
}

View File

@ -554,6 +554,8 @@ namespace MyCode.Project.Domain.Message.Request.KingDee.SaveModel
public class FStockOrgId
{
public string FOrgId { get; set; }
/// <summary>
///
/// </summary>
@ -590,6 +592,8 @@ namespace MyCode.Project.Domain.Message.Request.KingDee.SaveModel
///
/// </summary>
public string FNumber { get; set; }
public string FOrgId { get; set; }
}
public class FSOStockId

View File

@ -1,4 +1,6 @@
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
namespace MyCode.Project.Domain.Message.Request.KingDee.SaveModel
@ -45,6 +47,7 @@ namespace MyCode.Project.Domain.Message.Request.KingDee.SaveModel
public class FSettleOrgID
{
public string FOrgId { get; set; }
public string FNumber { get; set; }
}
@ -58,7 +61,7 @@ namespace MyCode.Project.Domain.Message.Request.KingDee.SaveModel
public string FNumber { get; set; }
}
public class FSalesOutboundEntryItem
public class FSalesOutboundEntryItemOld
{
public string FRowType { get; set; }
public FMaterialID FMaterialID { get; set; }
@ -104,6 +107,231 @@ namespace MyCode.Project.Domain.Message.Request.KingDee.SaveModel
public bool? FVmiBusinessStatus { get; set; }
}
/// <summary>
/// 销售出库单明细行实体类
/// 用于描述销售出库业务中的物料明细信息
/// </summary>
public class FSalesOutboundEntryItem
{
/// <summary>
/// 条码
/// </summary>
public string Fcode { get; set; }
/// <summary>
/// 行类型
/// </summary>
public string FRowType { get; set; }
/// <summary>
/// 物料标识
/// </summary>
public FMaterialID FMaterialID { get; set; }
/// <summary>
/// 单位标识
/// </summary>
public FUnitID FUnitID { get; set; }
/// <summary>
/// 库存数量
/// </summary>
public decimal? FInventoryQty { get; set; }
/// <summary>
/// 实际出库数量
/// </summary>
public decimal? FRealQty { get; set; }
/// <summary>
/// 计价数量
/// </summary>
public decimal? FDisPriceQty { get; set; }
/// <summary>
/// 单价
/// </summary>
public decimal? FPrice { get; set; }
/// <summary>
/// 含税单价
/// </summary>
public decimal? FTaxPrice { get; set; }
/// <summary>
/// 是否赠品
/// </summary>
public bool? FIsFree { get; set; }
/// <summary>
/// 货主类型标识
/// </summary>
public string FOwnerTypeID { get; set; }
/// <summary>
/// 货主标识
/// </summary>
public FOwnerID FOwnerID { get; set; }
/// <summary>
/// 行税率
/// </summary>
public decimal? FEntryTaxRate { get; set; }
/// <summary>
/// 辅助单位数量
/// </summary>
public decimal? FAuxUnitQty { get; set; }
/// <summary>
/// 外部辅助单位数量
/// </summary>
public decimal? FExtAuxUnitQty { get; set; }
public FStockID FStockID { get; set; }
/// <summary>
/// 源单类型
/// </summary>
public string FSrcType { get; set; }
/// <summary>
/// 源单单号
/// </summary>
public string FSrcBillNo { get; set; }
/// <summary>
/// 折扣率
/// </summary>
public decimal? FDiscountRate { get; set; }
/// <summary>
/// 价格折扣
/// </summary>
public decimal? FPriceDiscount { get; set; }
/// <summary>
/// 实际数量
/// </summary>
public decimal? FActQty { get; set; }
/// <summary>
/// 销售单位标识
/// </summary>
public FSalUnitID FSalUnitID { get; set; }
/// <summary>
/// 销售单位数量
/// </summary>
public decimal? FSALUNITQTY { get; set; }
/// <summary>
/// 销售基本数量
/// </summary>
public decimal? FSALBASEQTY { get; set; }
/// <summary>
/// 价格基本数量
/// </summary>
public decimal? FPRICEBASEQTY { get; set; }
/// <summary>
/// 是否超发控制
/// </summary>
public bool? FOUTCONTROL { get; set; }
/// <summary>
/// 返修数量
/// </summary>
public decimal? FRepairQty { get; set; }
/// <summary>
/// 是否跨法人组织
/// </summary>
public bool? FIsOverLegalOrg { get; set; }
/// <summary>
/// 未参与数量
/// </summary>
public decimal? FARNOTJOINQTY { get; set; }
/// <summary>
/// 质量管理分录ID
/// </summary>
public int? FQmEntryID { get; set; }
/// <summary>
/// 转换分录ID
/// </summary>
public int? FConvertEntryID { get; set; }
/// <summary>
/// 销售订单分录ID
/// </summary>
public int? FSOEntryId { get; set; }
/// <summary>
/// 折扣前计价数量
/// </summary>
public decimal? FBeforeDisPriceQty { get; set; }
/// <summary>
/// 签收数量
/// </summary>
public decimal? FSignQty { get; set; }
/// <summary>
/// 是否检查交货
/// </summary>
public bool? FCheckDelivery { get; set; }
/// <summary>
/// 折扣前总金额
/// </summary>
public decimal? FAllAmountExceptDisCount { get; set; }
/// <summary>
/// 是否子组织结算
/// </summary>
public bool? FSettleBySon { get; set; }
/// <summary>
/// BOM分录ID
/// </summary>
public int? FBOMEntryId { get; set; }
/// <summary>
/// 自定义金额字段
/// </summary>
public decimal? F_dmi_Amount { get; set; }
/// <summary>
/// 销售物料标识
/// </summary>
public FMaterialID_Sal FMaterialID_Sal { get; set; }
/// <summary>
/// 入库分录ID
/// </summary>
public int? FInStockEntryId { get; set; }
/// <summary>
/// 收款分录ID
/// </summary>
public int? FReceiveEntryId { get; set; }
/// <summary>
/// 是否替换出库
/// </summary>
public bool? FIsReplaceOut { get; set; }
/// <summary>
/// VMI业务状态
/// </summary>
public bool? FVmiBusinessStatus { get; set; }
}
public class FMaterialID
{
public string FNumber { get; set; }
@ -111,6 +339,7 @@ namespace MyCode.Project.Domain.Message.Request.KingDee.SaveModel
public class FOwnerID
{
public string FOrgId { get; set; }
public string FNumber { get; set; }
}
@ -127,6 +356,11 @@ namespace MyCode.Project.Domain.Message.Request.KingDee.SaveModel
public class FCustomerID
{
public string FNumber { get; set; }
/// <summary>
/// 客户ID
/// </summary>
public string FCustId { get; set; }
}
public class FSaleDeptID
@ -153,5 +387,12 @@ namespace MyCode.Project.Domain.Message.Request.KingDee.SaveModel
{
public string FNumber { get; set; }
}
public class FStockID
{
public string FstockId { get; set; }
public string FNumber { get; set; }
}
}

View File

@ -35,7 +35,11 @@ namespace MyCode.Project.Domain.Message.Request.KingDee.SaveModel
}
public class FRetcustId
{
{
/// <summary>
/// ¿Í»§ID
/// </summary>
public string FCustId { get; set; }
public string FNumber { get; set; }
}
@ -56,25 +60,39 @@ namespace MyCode.Project.Domain.Message.Request.KingDee.SaveModel
public class FReceiveCustId
{
/// <summary>
/// ¿Í»§ID
/// </summary>
public string FCustId { get; set; }
public string FNumber { get; set; }
}
public class FSettleCustId
{
/// <summary>
/// ¿Í»§ID
/// </summary>
public string FCustId { get; set; }
public string FNumber { get; set; }
}
public class FPayCustId
{
public string FCustId { get; set; }
public string FNumber { get; set; }
}
public class FSalesReturnEntryItem
{
/// <summary>
/// ÌõÂë
/// </summary>
public string Fcode { get; set; }
public string FRowType { get; set; }
public FMaterialId FMaterialId { get; set; }
public FUnitID FUnitID { get; set; }
public decimal? FInventoryQty { get; set; }
//public decimal? FInventoryQty { get; set; }
public decimal? FRealQty { get; set; }
public decimal? FPrice { get; set; }
public decimal? FTaxPrice { get; set; }
@ -83,6 +101,9 @@ namespace MyCode.Project.Domain.Message.Request.KingDee.SaveModel
public FReturnType FReturnType { get; set; }
public string FOwnerTypeId { get; set; }
public FOwnerId FOwnerId { get; set; }
public FStockstatusId FStockstatusId { get; set; }
public FStockID FStockID { get; set; }
public string FDeliveryDate { get; set; }
public decimal? FDiscountRate { get; set; }
public decimal? FPriceDiscount { get; set; }
@ -96,7 +117,7 @@ namespace MyCode.Project.Domain.Message.Request.KingDee.SaveModel
public decimal? FSalBaseQty { get; set; }
public decimal? FPriceBaseQty { get; set; }
public bool? FIsOverLegalOrg { get; set; }
public int? FSOEntryId { get; set; }
//public int? FSOEntryId { get; set; }
public decimal? FARNOTJOINQTY { get; set; }
public bool? FIsReturnCheck { get; set; }
public bool? FSettleBySon { get; set; }
@ -111,5 +132,10 @@ namespace MyCode.Project.Domain.Message.Request.KingDee.SaveModel
{
public string FNumber { get; set; }
}
public class FStockstatusId
{
public string FNumber { get; set; }
}
}

View File

@ -185,7 +185,7 @@ namespace MyCode.Project.Services.Implementation
}
pushKingDeeOrders.ForEach(t =>
{
_workProcessService.Add<IOrderPushService>(this.MerchantId, "PushOrderToKingDee", "推送订单到云星空或者WMS", t.Id, 1);
//_workProcessService.Add<IOrderPushService>(this.MerchantId, "PushOrderToKingDee", "推送订单到云星空或者WMS", t.Id, 1);
Thread.Sleep(300);
});

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
};
}
}
}
}

View File

@ -131,7 +131,7 @@ namespace MyCode.Project.Services.Implementation
BillSave billSave = new BillSave()
{
Model = model,
IsAutoSubmitAndAudit = true,
IsAutoSubmitAndAudit = false,
};
var responseStatus = _kingDeeService.Save(FORM_ID, billSave);
@ -148,7 +148,7 @@ namespace MyCode.Project.Services.Implementation
decimal realQty = Math.Abs(item.SellCount);
decimal taxRate = param.FTAXRATE;
decimal taxPrice = item.SellCount != 0 ? Math.Round(Math.Abs(item.DivideSellTotal) / item.SellCount, 10) : 0;
decimal taxPrice = item.SellCount != 0 ? Math.Round(Math.Abs(item.DivideSellTotal/ item.SellCount), 10) : 0;
decimal price = taxRate > 0 && taxPrice > 0 ? Math.Round(taxPrice / (1 + taxRate / 100), 10) : taxPrice;
@ -157,21 +157,22 @@ namespace MyCode.Project.Services.Implementation
return new FSalesReturnEntryItem()
{
FRowType = rowType,
FMaterialId = new FMaterialId()
{
FNumber = item.Barcode ?? ""
},
FUnitID = new FUnitID()
{
FNumber = item.Unit ?? DEFAULT_UNIT
},
FInventoryQty = 0,
Fcode = item.Barcode ?? "",
//FRowType = rowType,
//FMaterialId = new FMaterialId()
//{
// FNumber = item.Barcode ?? ""
//},
//FUnitID = new FUnitID()
//{
// FNumber = item.Unit ?? DEFAULT_UNIT
//},
//FInventoryQty = 0,
FRealQty = realQty,
FPrice = price,
FTaxPrice = taxPrice,
FIsFree = false,
FEntryTaxRate = param.FTAXRATE,
//FIsFree = false,
//FEntryTaxRate = param.FTAXRATE,
FReturnType = new FReturnType()
{
FNumber = RETURN_TYPE_CODE
@ -179,26 +180,34 @@ namespace MyCode.Project.Services.Implementation
FOwnerTypeId = OWNER_TYPE,
FOwnerId = new FOwnerId()
{
FNumber = orgId
FOrgId = orgId
},
FStockID = new FStockID()
{
FNumber = param.FWAREHOUSECODE
},
FStockstatusId=new FStockstatusId(){
FNumber= "KCZT01_SYS"
},
FDeliveryDate = deliveryDate,
FDiscountRate = 0,
FPriceDiscount = 0,
FAuxUnitQty = 0,
FExtAuxUnitQty = 0,
FSrcBillTypeID = "",
FSrcBillNo = "",
FISCONSUMESUM = "0",
//FDiscountRate = 0,
//FPriceDiscount = 0,
//FAuxUnitQty = 0,
//FExtAuxUnitQty = 0,
//FSrcBillTypeID = "",
//FSrcBillNo = "",
//FISCONSUMESUM = "0",
FSalUnitID = new FSalUnitID()
{
FNumber = item.Unit ?? DEFAULT_UNIT
},
FSalUnitQty = realQty,
FSalBaseQty = realQty,
FPriceBaseQty = realQty,
FSalUnitQty = realQty, //
FSalBaseQty = realQty,//
FPriceBaseQty = realQty,//
FIsOverLegalOrg = false,
FSOEntryId = 0,
FARNOTJOINQTY = realQty,
//FSOEntryId = 0,
FARNOTJOINQTY = realQty, //
FIsReturnCheck = false,
FSettleBySon = false,
FBOMEntryId = 0,
@ -228,42 +237,42 @@ namespace MyCode.Project.Services.Implementation
{
FNUMBER = BILL_TYPE_CODE
},
FDate = dateStr,
FDate = dateStr,
FSaleOrgId = new FSaleOrgId()
{
FNumber = orgId
FOrgId = orgId
},
FRetcustId = new FRetcustId()
{
FNumber = customerId
},
FSaledeptid = new FSaledeptid()
{
FNumber = "02"
},
FTransferBizType = new FTransferBizType()
{
FNumber = TRANSFER_BIZ_TYPE
FCustId = customerId
},
//FSaledeptid = new FSaledeptid()
//{
// FNumber = "02"
//},
//FTransferBizType = new FTransferBizType()
//{
// FNumber = TRANSFER_BIZ_TYPE
//},
FSalesManId = new FSalesManId()
{
FNumber = salesManId
},
FStockOrgId = new FStockOrgId()
{
FNumber = orgId
FOrgId = orgId
},
FReceiveCustId = new FReceiveCustId()
{
FNumber = customerId
FCustId = customerId
},
FSettleCustId = new FSettleCustId()
{
FNumber = customerId
FCustId = customerId
},
FPayCustId = new FPayCustId()
{
FNumber = customerId
FCustId = customerId
},
FOwnerTypeIdHead = OWNER_TYPE,
FCDateOffsetValue = 0,
@ -277,7 +286,7 @@ namespace MyCode.Project.Services.Implementation
},
FSettleOrgId = new FSettleOrgId()
{
FNumber = orgId
FOrgId = orgId
},
FLocalCurrId = new FLocalCurrId()
{

View File

@ -49,7 +49,7 @@
<!-- 组织编码,启用多组织时配置对应的组织编码才有效 -->
<!--<add key="X-KDApi-OrgNum" value="*****"/>-->
<!-- 服务Url地址(私有云和公有云都须配置金蝶云星空产品地址K3Cloud/结尾)-->
<add key="X-KDApi-ServerUrl" value="http://127.0.0.1/k3Cloud/" />
<add key="X-KDApi-ServerUrl" value="https://k3.yygsbb.com/k3Cloud/" />
<!--解决swagger出错问题-->
<add key="aspnet:UseHostHeaderForRequestUrl" value="true" />
<!--当前环境,1:生产环境 0开发环境-->