采购退料单
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user