采购退料单
This commit is contained in:
parent
34c32c7e46
commit
95b488f630
@ -16,6 +16,10 @@ namespace MyCode.Project.Domain.Message.Request.KingDee.SaveModel
|
||||
/// </summary>
|
||||
public int? FID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单据编号
|
||||
/// </summary>
|
||||
public string FBillNo { get; set; }
|
||||
/// <summary>
|
||||
/// 单据类型
|
||||
/// </summary>
|
||||
@ -127,6 +131,8 @@ namespace MyCode.Project.Domain.Message.Request.KingDee.SaveModel
|
||||
/// </summary>
|
||||
public class FRequireOrgId
|
||||
{
|
||||
public string FOrgId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 编码
|
||||
/// </summary>
|
||||
@ -233,6 +239,13 @@ namespace MyCode.Project.Domain.Message.Request.KingDee.SaveModel
|
||||
/// </summary>
|
||||
public class FPURMRBENTRY
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 条码
|
||||
/// </summary>
|
||||
public string Fcode { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 产品类型
|
||||
/// </summary>
|
||||
@ -248,6 +261,17 @@ namespace MyCode.Project.Domain.Message.Request.KingDee.SaveModel
|
||||
/// </summary>
|
||||
public string FMaterialDesc { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 仓库
|
||||
/// </summary>
|
||||
|
||||
public FStockID FStockID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 库存状态
|
||||
/// </summary>
|
||||
public FStockStatusId FStockStatusId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 库存单位
|
||||
/// </summary>
|
||||
@ -426,6 +450,11 @@ namespace MyCode.Project.Domain.Message.Request.KingDee.SaveModel
|
||||
/// </summary>
|
||||
public class FCARRYUNITID
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 组织内码
|
||||
/// </summary>
|
||||
public string FOrgId { get; set; }
|
||||
/// <summary>
|
||||
/// 编码
|
||||
/// </summary>
|
||||
|
||||
@ -21,14 +21,15 @@ namespace MyCode.Project.Domain.Message.Request.KingDee.SaveModel
|
||||
/// 单据编号
|
||||
/// </summary>
|
||||
public string FBillNo { get; set; }
|
||||
/// ÊÕÁÏ×éÖ¯
|
||||
/// </summary>
|
||||
public FStockOrgId FStockOrgId { get; set; }
|
||||
/// <summary>
|
||||
/// 入库日期
|
||||
/// </summary>
|
||||
public string FDate { get; set; }
|
||||
/// <summary>
|
||||
/// ÊÕÁÏ×éÖ¯
|
||||
/// </summary>
|
||||
public FStockOrgId FStockOrgId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 需求组织
|
||||
/// </summary>
|
||||
@ -142,6 +143,12 @@ namespace MyCode.Project.Domain.Message.Request.KingDee.SaveModel
|
||||
|
||||
public class FSalOutStockOrgId
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// ×éÖ¯ÄÚÂë
|
||||
/// </summary>
|
||||
public string FOrgId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 编码
|
||||
/// </summary>
|
||||
|
||||
@ -53,6 +53,13 @@ namespace MyCode.Project.Domain.Message.Response.JackYun
|
||||
/// </summary>
|
||||
public string VendCustomerName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:往来单位编号
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string VendCustomerCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 币种编号
|
||||
/// </summary>
|
||||
|
||||
@ -269,7 +269,7 @@ namespace MyCode.Project.Domain.Model
|
||||
public decimal? BaceCurrencyWithTaxAmount {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:baceCurrencyTaxAmount
|
||||
/// Desc:本币税额(货品行数据)
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
|
||||
@ -310,5 +310,13 @@ namespace MyCode.Project.Domain.Model
|
||||
/// </summary>
|
||||
public int? Status {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:
|
||||
/// Default:
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
[SugarColumn(IsIdentity=true)]
|
||||
public int SortId {get;set;}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -548,5 +548,12 @@ namespace MyCode.Project.Domain.Model
|
||||
/// </summary>
|
||||
public int? Status {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:往来单位编号
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string VendCustomerCode {get;set;}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -246,7 +246,7 @@ namespace MyCode.Project.Domain.Model
|
||||
public string FPURCHASINGWAREHOUSECODE {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:采购组织ID
|
||||
/// Desc:采购组织
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
@ -254,7 +254,7 @@ namespace MyCode.Project.Domain.Model
|
||||
public int? FPURCHASEORGID {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:采购日期
|
||||
/// Desc:开始抓采购入库单开始时间
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
|
||||
@ -389,7 +389,7 @@ namespace MyCode.Project.Services.Implementation
|
||||
|
||||
requestBizData.PageSize = 200;
|
||||
requestBizData.PageIndex = 0;
|
||||
requestBizData.SelelctFields = "recId,goodsdocNo,billNo,inOutDate,gmtCreate,inouttype,inouttypeName,vendCustomerName,currencyCode,currencyRate,userName,warehouseCode,warehouseName,comment,memo,logisticName,logisticNo,companyId,companyName,logisticType,logisticCode,inOutReason,sourceBillNo,channelId,channelCode,channelName,redStatus,field1,field2,field3,field4,field5,financeBillStatus,vendCustomerId,applyDepartId,applyDepartName,outBillNo,logisticList,gmtModified,departCode,applyCompanyName,applyCompanyCode,applyCompanyId,applyUserId,applyUserName,companyCode,goodsDocDetailList,sendCompanyName,send,sendTel,sendPhone,sendEmail,sendCountryName,sendProvinceName,sendCityName,sendTownName,sendStreetName,sendAddress,receiveCompanyName,receive,receiveTel,receivePhone,receiveEmail,receiveCountryName,receiveProvinceName,receiveCityName,receiveTownName,receiveStreetName,receiveAddress" +
|
||||
requestBizData.SelelctFields = "vendCustomerCode,recId,goodsdocNo,billNo,inOutDate,gmtCreate,inouttype,inouttypeName,vendCustomerName,currencyCode,currencyRate,userName,warehouseCode,warehouseName,comment,memo,logisticName,logisticNo,companyId,companyName,logisticType,logisticCode,inOutReason,sourceBillNo,channelId,channelCode,channelName,redStatus,field1,field2,field3,field4,field5,financeBillStatus,vendCustomerId,applyDepartId,applyDepartName,outBillNo,logisticList,gmtModified,departCode,applyCompanyName,applyCompanyCode,applyCompanyId,applyUserId,applyUserName,companyCode,goodsDocDetailList,sendCompanyName,send,sendTel,sendPhone,sendEmail,sendCountryName,sendProvinceName,sendCityName,sendTownName,sendStreetName,sendAddress,receiveCompanyName,receive,receiveTel,receivePhone,receiveEmail,receiveCountryName,receiveProvinceName,receiveCityName,receiveTownName,receiveStreetName,receiveAddress" +
|
||||
",goodsDocDetailList.recId,goodsDocDetailList.goodsId,goodsDocDetailList.goodsNo,goodsDocDetailList.goodsName,goodsDocDetailList.skuId,goodsDocDetailList.skuName,goodsDocDetailList.skuBarcode,goodsDocDetailList.unitName,goodsDocDetailList.cuPrice,goodsDocDetailList.cuValue,goodsDocDetailList.caseNumber,goodsDocDetailList.rowRemark,goodsDocDetailList.assistUnit,goodsDocDetailList.estCost,goodsDocDetailList.estTax,goodsDocDetailList.estPrice,goodsDocDetailList.estPriceNoTax,goodsDocDetailList.estCostNoTax,goodsDocDetailList.taxRate,goodsDocDetailList.batchNo,goodsDocDetailList.serialNo,goodsDocDetailList.productionDate,goodsDocDetailList.expirationDate,goodsDocDetailList.shelfLife,goodsDocDetailList.shelfLiftUnit,goodsDocDetailList.sourceDetailId,goodsDocDetailList.transNoTaxPrice,goodsDocDetailList.transNoTaxAmount,goodsDocDetailList.transHasTaxPrice,goodsDocDetailList.transHasTaxAmount" +
|
||||
",goodsDocDetailList.transTaxAmount,goodsDocDetailList.detailField1,goodsDocDetailList.detailField2,goodsDocDetailList.detailField3,goodsDocDetailList.detailField4,goodsDocDetailList.detailField5,goodsDocDetailList.isCertified,goodsDocDetailList.registrationNumber,goodsDocDetailList.approvalDate,goodsDocDetailList.productionDepart,goodsDocDetailList.batchNumber,goodsDocDetailList.quantity,goodsDocDetailList.cateId,goodsDocDetailList.cateName,goodsDocDetailList.volume,goodsDocDetailList.skuWeight";
|
||||
|
||||
@ -443,10 +443,10 @@ namespace MyCode.Project.Services.Implementation
|
||||
var warehouseCodes = shopConfigs.Select(t => t.FPURCHASINGWAREHOUSECODE).Distinct().ToList();
|
||||
var guolv = shopConfigs.Select(t => new { t.FPURCHASINGWAREHOUSECODE, t.FPURCHASEDATE }).ToList();
|
||||
trades = trades.Where(t => warehouseCodes.Contains(t.WarehouseCode)).ToList();
|
||||
foreach (var item in guolv)
|
||||
{
|
||||
trades.RemoveAll(t => item.FPURCHASINGWAREHOUSECODE == t.WarehouseCode && item.FPURCHASEDATE > t.InOutDate);
|
||||
}
|
||||
//foreach (var item in guolv)
|
||||
//{
|
||||
// trades.RemoveAll(t => item.FPURCHASINGWAREHOUSECODE == t.WarehouseCode && item.FPURCHASEDATE > t.InOutDate);
|
||||
//}
|
||||
|
||||
return trades;
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ using MyCode.Project.Domain.Model;
|
||||
using MyCode.Project.Domain.Repositories;
|
||||
using MyCode.Project.Infrastructure.Common;
|
||||
using MyCode.Project.Infrastructure.Exceptions;
|
||||
using MyCode.Project.Infrastructure.Extensions;
|
||||
using MyCode.Project.OutSideService;
|
||||
using MyCode.Project.Services.IServices;
|
||||
using System;
|
||||
@ -68,7 +69,7 @@ namespace MyCode.Project.Services.Implementation
|
||||
throw new BaseException($"未找到ID为 {id} 的采购退料单记录");
|
||||
}
|
||||
|
||||
if (outHead.Status != 0 && outHead.Status != 1)
|
||||
if (outHead.Status ==2 )
|
||||
{
|
||||
throw new BaseException($"采购退料单 {outHead.GoodsdocNo} 已经推送过,状态为:{outHead.Status},不允许重复推送");
|
||||
}
|
||||
@ -161,7 +162,7 @@ namespace MyCode.Project.Services.Implementation
|
||||
BillSave billSave = new BillSave()
|
||||
{
|
||||
Model = model,
|
||||
IsAutoSubmitAndAudit = true,
|
||||
IsAutoSubmitAndAudit = false,
|
||||
};
|
||||
|
||||
// 调用金蝶服务保存单据
|
||||
@ -197,23 +198,32 @@ namespace MyCode.Project.Services.Implementation
|
||||
decimal price = taxRate > 0 && taxPrice > 0 ? Math.Round(taxPrice / (1 + taxRate / 100), 10) : taxPrice;
|
||||
|
||||
return new FPURMRBENTRY()
|
||||
{
|
||||
{
|
||||
Fcode = detail.SkuBarcode ?? "",
|
||||
FRowType = rowType,
|
||||
FMATERIALID = new FMATERIALID()
|
||||
{
|
||||
FNumber = detail.SkuBarcode ?? ""
|
||||
},
|
||||
FMaterialDesc = detail.GoodsName ?? "",
|
||||
FUnitID = new FUnitID()
|
||||
{
|
||||
FNumber = detail.UnitName ?? DEFAULT_UNIT
|
||||
},
|
||||
//FMATERIALID = new FMATERIALID()
|
||||
//{
|
||||
// FNumber = detail.SkuBarcode ?? ""
|
||||
//},
|
||||
//FMaterialDesc = detail.GoodsName ?? "",
|
||||
//FUnitID = new FUnitID()
|
||||
//{
|
||||
// FNumber = detail.UnitName ?? DEFAULT_UNIT
|
||||
//},
|
||||
FRMREALQTY = realQty,
|
||||
FREPLENISHQTY = 0,
|
||||
FKEAPAMTQTY = 0,
|
||||
FPRICEUNITID = new FPRICEUNITID()
|
||||
//FPRICEUNITID = new FPRICEUNITID()
|
||||
//{
|
||||
// FNumber = detail.UnitName ?? DEFAULT_UNIT
|
||||
//},
|
||||
FStockID = new FStockID()
|
||||
{
|
||||
FNumber = detail.UnitName ?? DEFAULT_UNIT
|
||||
FNumber = param.FPURCHASINGWAREHOUSECODE
|
||||
},
|
||||
FStockStatusId = new FStockStatusId()
|
||||
{
|
||||
FNumber = "KCZT01_SYS"
|
||||
},
|
||||
FPrice = price,
|
||||
FExtAuxUnitQty = 0,
|
||||
@ -223,18 +233,18 @@ namespace MyCode.Project.Services.Implementation
|
||||
FPriceBaseQty = realQty,
|
||||
FCARRYUNITID = new FCARRYUNITID()
|
||||
{
|
||||
FNumber = detail.UnitName ?? DEFAULT_UNIT
|
||||
FOrgId = param.FPURCHASEORGID.SafeValue().ToString(),
|
||||
},
|
||||
FCarryQty = 0,
|
||||
FCarryBaseQty = 0,
|
||||
FPOORDERENTRYID = 0,
|
||||
FCarryQty = realQty,
|
||||
FCarryBaseQty = realQty,
|
||||
|
||||
FBILLINGCLOSE = false,
|
||||
FRMMUSTQTY = realQty,
|
||||
FAUXUNITQTY = 0,
|
||||
FOWNERTYPEID = OWNER_TYPE,
|
||||
FOWNERID = new FOwnerId()
|
||||
{
|
||||
FNumber = orgId
|
||||
FOrgId = orgId
|
||||
},
|
||||
FENTRYTAXRATE = taxRate,
|
||||
FDISCOUNTRATE = 0,
|
||||
@ -266,13 +276,14 @@ namespace MyCode.Project.Services.Implementation
|
||||
string dateStr = outDate?.ToString("yyyy-MM-dd HH:mm:ss") ?? DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
// 获取供应商编码
|
||||
string supplierCode = outHead.VendCustomerId ?? "";
|
||||
string supplierCode = outHead.VendCustomerCode ?? "";
|
||||
|
||||
// 构建收货地址(从收件人地址字段组合)
|
||||
string acceptAddress = BuildAcceptAddress(outHead);
|
||||
|
||||
return new PurchaseReturnModel()
|
||||
{
|
||||
FBillNo = outHead.GoodsdocNo,
|
||||
FID = 0,
|
||||
FBillTypeID = new FBillTypeID()
|
||||
{
|
||||
@ -283,21 +294,22 @@ namespace MyCode.Project.Services.Implementation
|
||||
FMRMODE = MR_MODE,
|
||||
FStockOrgId = new FStockOrgId()
|
||||
{
|
||||
FNumber = orgId
|
||||
FOrgId = orgId
|
||||
},
|
||||
FIsConvert = false,
|
||||
FRequireOrgId = new FRequireOrgId()
|
||||
{
|
||||
FNumber = orgId
|
||||
FOrgId = orgId
|
||||
},
|
||||
|
||||
FPurchaseOrgId = new FPurchaseOrgId()
|
||||
{
|
||||
FNumber = orgId
|
||||
FOrgId = orgId
|
||||
},
|
||||
FSupplierID = !string.IsNullOrEmpty(supplierCode) ? new FSupplierID()
|
||||
FSupplierID = new FSupplierID()
|
||||
{
|
||||
FNumber = supplierCode
|
||||
} : null,
|
||||
},
|
||||
FACCEPTORID = !string.IsNullOrEmpty(supplierCode) ? new FACCEPTORID()
|
||||
{
|
||||
FNumber = supplierCode
|
||||
@ -314,36 +326,36 @@ namespace MyCode.Project.Services.Implementation
|
||||
FOwnerTypeIdHead = OWNER_TYPE,
|
||||
FOwnerIdHead = new FOwnerIdHead()
|
||||
{
|
||||
FNumber = orgId
|
||||
FOrgId = orgId
|
||||
},
|
||||
FCDateOffsetValue = 0,
|
||||
|
||||
FAcceptorContactID = null, // 如果需要联系人,可以从其他字段获取
|
||||
FSalOutStockOrgId = new FSalOutStockOrgId()
|
||||
{
|
||||
FNumber = orgId
|
||||
FOrgId = orgId
|
||||
},
|
||||
FACCTYPE = ACCT_TYPE,
|
||||
FPURMRBFIN = new FPURMRBFIN()
|
||||
{
|
||||
FSettleOrgId = new FSettleOrgId()
|
||||
{
|
||||
FNumber = orgId
|
||||
FOrgId = orgId
|
||||
},
|
||||
FSettleCurrId = new FSettleCurrId()
|
||||
{
|
||||
FNumber = outHead.CurrencyCode ?? DEFAULT_CURRENCY
|
||||
FNumber = DEFAULT_CURRENCY
|
||||
},
|
||||
FIsIncludedTax = true,
|
||||
FPRICETIMEPOINT = "1",
|
||||
FLOCALCURRID = new FLocalCurrId()
|
||||
{
|
||||
FNumber = outHead.CurrencyCode ?? DEFAULT_CURRENCY
|
||||
FNumber = DEFAULT_CURRENCY
|
||||
},
|
||||
FEXCHANGETYPEID = new FExchangeTypeId()
|
||||
{
|
||||
FNumber = EXCHANGE_TYPE
|
||||
},
|
||||
FEXCHANGERATE = outHead.CurrencyRate ?? 1m,
|
||||
FEXCHANGERATE = 1m,
|
||||
FISPRICEEXCLUDETAX = true,
|
||||
FHSExchangeRate = 1m
|
||||
},
|
||||
|
||||
@ -259,6 +259,7 @@ namespace MyCode.Project.Services.Implementation
|
||||
|
||||
return new PurchaseStockInModel()
|
||||
{
|
||||
FBillNo= goodsDocIn.GoodsdocNo,
|
||||
FID = 0,
|
||||
FBillTypeID = new FBillTypeID()
|
||||
{
|
||||
|
||||
@ -44,7 +44,7 @@ namespace MyCode.Project.Services.Implementation
|
||||
DateTime now = DateTime.Now.Date;
|
||||
_workProcessService.Add<IJackYunTaskService>(this.MerchantId, "TaskGetJackYunOrder", "调度运行抓吉客云销售订单", now.ToString("yyyy-MM-dd"), 1);
|
||||
_workProcessService.Add<IJackYunTaskService>(this.MerchantId, "TaskGetReturnChangeList", "调度运行抓吉客云退货订单", now.ToString("yyyy-MM-dd"), 1);
|
||||
//_workProcessService.Add<IJackYunTaskService>(this.MerchantId, "GetPurchaseInboundData", "调度运行吉客云采购入库", now.ToString("yyyy-MM-dd"), 1);
|
||||
_workProcessService.Add<IJackYunTaskService>(this.MerchantId, "GetPurchaseInboundData", "调度运行吉客云采购入库", now.ToString("yyyy-MM-dd"), 1);
|
||||
//_workProcessService.Add<IJackYunTaskService>(this.MerchantId, "GetStorageGoodsDocOutV2", "获取吉客云采购退货出库单", now.ToString("yyyy-MM-dd"), 1);
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -309,10 +309,10 @@ namespace MyCode.Project.WebApi.Controllers
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 调度运行吉客云采购出库单
|
||||
#region 获取吉客云采购退料单
|
||||
|
||||
/// <summary>
|
||||
/// 调度运行吉客云采购出库单
|
||||
/// 获取吉客云采购退料单
|
||||
/// </summary>
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user