Browse Source

红旗结算导入,自定义发货导入,红旗一轿出库单导入,一次性寄售销售导入加入导入时检验物料主数据中是否存在导入的物料号

FoShanPG
44673626 2 years ago
parent
commit
78bf7fa291
  1. 21
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/HQ_H/HQ_H_PlatformAppService.cs
  2. 18
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSCusomerKanbanAppService.cs
  3. 4
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSJitAppService.cs
  4. 15
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePartAppService.cs
  5. 34
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQKBOutputAppService.cs
  6. 24
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsOneTimeSaleOutputAppService.cs
  7. 10
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpPartDapperRepository.cs

21
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/HQ_H/HQ_H_PlatformAppService.cs

@ -103,15 +103,24 @@ namespace Win.Sfs.SettleAccount.Entities.HQ_H
throw new BusinessException("导入模板数据不能为空!"); throw new BusinessException("导入模板数据不能为空!");
} }
var entityList = ObjectMapper.Map<List<HQ_H_PlatformImportDto>, List<HQ_H_Platform>>(result); var entityList_org = ObjectMapper.Map<List<HQ_H_PlatformImportDto>, List<HQ_H_Platform>>(result);
var entityList= entityList_org.Where(p => !string.IsNullOrEmpty(p.MaterialCode)).ToList();//过滤掉物料号为空的数据
var gethqimportdata = entityList.Select(p => p.MaterialCode).Distinct().ToList();
var getmaterial = _erpdapperRepository.GetMaterialListCustomerPartCode();
//和物料主数据中SAP物料号检验是否存在 //和物料主数据中SAP物料号检验是否存在
foreach (var itm in entityList) var query = from itm in gethqimportdata
join itm1 in getmaterial on itm equals itm1.CustomerPartCode into temp1
from tm1 in temp1.DefaultIfEmpty()
where tm1 == null
select itm;
foreach (var itm in query)
{ {
if (!_erpdapperRepository.GetMaterialList().Any(p => p.CustomerPartCode == itm.MaterialCode)) checkList.Add(new ErrorExportDto(version, "红旗结算导入", string.Empty, string.Empty, itm, string.Empty, string.Format("物料主数据不存在当前导入的物料号{0}!", itm), string.Empty));
{
checkList.Add(new ErrorExportDto(version, "红旗结算导入", string.Empty, string.Empty, itm.MaterialCode, string.Empty, string.Format("物料主数据不存在当前导入的物料号{0}!", itm.MaterialCode), string.Empty));
}
} }
if (checkList.Count > 0) if (checkList.Count > 0)

18
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSCusomerKanbanAppService.cs

@ -486,12 +486,20 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
var filteResult = result.Where(p =>!string.IsNullOrEmpty(p.SapMaterialCode));//过滤掉物料号为空的数据 var filteResult = result.Where(p =>!string.IsNullOrEmpty(p.SapMaterialCode));//过滤掉物料号为空的数据
//和物料主数据中SAP物料号检验是否存在 //和物料主数据中SAP物料号检验是否存在
foreach (var itm in filteResult) var gethqimportdata = filteResult.Select(p => p.SapMaterialCode).Distinct().ToList();
var getmaterial = _erpdapperRepository.GetMaterialList();
var queryCheck = from itm in gethqimportdata
join itm1 in getmaterial on itm equals itm1.MaterialCode into temp1
from tm1 in temp1.DefaultIfEmpty()
where tm1 == null
select itm;
foreach (var itm in queryCheck)
{ {
if (!_erpdapperRepository.GetMaterialList().Any(p => p.MaterialCode == itm.SapMaterialCode)) //if (!_erpdapperRepository.GetMaterialList().Any(p => p.MaterialCode == itm.SapMaterialCode))
{ //{
checkList.Add(new ErrorExportDto(version, "自定义出库单导入", string.Empty, string.Empty, itm.SapMaterialCode, string.Empty, string.Format("物料主数据不存在当前导入的物料号{0}!", itm.SapMaterialCode), string.Empty)); checkList.Add(new ErrorExportDto(version, "自定义出库单导入", string.Empty, string.Empty, itm, string.Empty, string.Format("物料主数据不存在当前导入的物料号{0}!", itm), string.Empty));
} //}
} }
//检验2:导入模板中的结算数据是否为0 //检验2:导入模板中的结算数据是否为0

4
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSJitAppService.cs

@ -55,8 +55,8 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
/// <summary> /// <summary>
/// wms出库 /// wms出库
/// </summary> /// </summary>
//[Authorize(SettleAccountPermissions.WMSJIT.Default)] [Authorize(SettleAccountPermissions.WMSJIT.Default)]
[AllowAnonymous] //[AllowAnonymous]
[Route("api/settleaccount/wmsjitoutput")] [Route("api/settleaccount/wmsjitoutput")]
public class WMSJitAppService : public class WMSJitAppService :

15
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePartAppService.cs

@ -681,14 +681,15 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
} }
//和物料主数据中SAP物料号检验是否存在 //和物料主数据中SAP物料号检验是否存在
foreach (var itm in result)
{
if (!_erpdapperRepository.GetMaterialList().Any(p => p.MaterialCode == itm.MaterialCode))
{
checkList.Add(new ErrorExportDto(version, "大众备件出库单导入", string.Empty, string.Empty, itm.MaterialCode, string.Empty, string.Format("物料主数据不存在当前导入的物料号{0}!", itm.MaterialCode), string.Empty));
}
} //foreach (var itm in result)
//{
// if (!_erpdapperRepository.GetMaterialList().Any(p => p.MaterialCode == itm.MaterialCode))
// {
// checkList.Add(new ErrorExportDto(version, "大众备件出库单导入", string.Empty, string.Empty, itm.MaterialCode, string.Empty, string.Format("物料主数据不存在当前导入的物料号{0}!", itm.MaterialCode), string.Empty));
// }
//}
if (checkList.Count > 0) if (checkList.Count > 0)
{ {

34
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQKBOutputAppService.cs

@ -269,7 +269,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
throw new BusinessException("导入模板数据不能为空!"); throw new BusinessException("导入模板数据不能为空!");
} }
//物料号不能为空,直接过滤掉,模板的中看不到有空行的情况,但是通过个IE这个插件发现有空行数据导入 //物料号不能为空,直接过滤掉,模板的中看不到有空行的情况,但是通过个IE这个插件发现有空行数据导入
var _list = _listOrgin.Where(p =>!string.IsNullOrEmpty(p.SapMaterialCode)); var _list = _listOrgin.Where(p => !string.IsNullOrEmpty(p.SapMaterialCode));
foreach (var itm in _list) foreach (var itm in _list)
{ {
@ -287,14 +287,26 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
} }
} }
//和物料主数据中SAP物料号检验是否存在 //和物料主数据中SAP物料号检验是否存在
foreach (var itm in _list) var gethqimportdata = _list.Select(p => p.SapMaterialCode).Distinct().ToList();
var getmaterial = _erpdapperRepository.GetMaterialList();
var queryCheck = from itm in gethqimportdata
join itm1 in getmaterial on itm equals itm1.MaterialCode into temp1
from tm1 in temp1.DefaultIfEmpty()
where tm1 == null
select itm;
foreach (var itm in queryCheck)
{ {
if (!_erpdapperRepository.GetMaterialList().Any(p => p.MaterialCode == itm.SapMaterialCode)) checkList.Add(new ErrorExportDto(version, "红旗一轿出库单导入", string.Empty, string.Empty, itm, string.Empty, string.Format("物料主数据不存在当前导入的物料号{0}!", itm), string.Empty));
{
checkList.Add(new ErrorExportDto(version, "红旗一轿出库单导入", string.Empty, string.Empty, itm.SapMaterialCode, string.Empty, string.Format("物料主数据不存在当前导入的物料号{0}!", itm.SapMaterialCode), string.Empty));
}
} }
//foreach (var itm in _list)
//{
// if (!_erpdapperRepository.GetMaterialList().Any(p => p.MaterialCode == itm.SapMaterialCode))
// {
// checkList.Add(new ErrorExportDto(version, "红旗一轿出库单导入", string.Empty, string.Empty, itm.SapMaterialCode, string.Empty, string.Format("物料主数据不存在当前导入的物料号{0}!", itm.SapMaterialCode), string.Empty));
// }
//}
if (checkList.Count > 0) if (checkList.Count > 0)
{ {
@ -314,11 +326,11 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
} }
} }
var getbillName = "HQVSBT";//混合数据 var getbillName = "HQVSBT";//混合数据
if(_list.FirstOrDefault().Extend== "100113") if (_list.FirstOrDefault().Extend == "100113")
{ {
getbillName = "BT";//一轿 getbillName = "BT";//一轿
} }
else if(_list.FirstOrDefault().Extend == "100053") else if (_list.FirstOrDefault().Extend == "100053")
{ {
getbillName = "HQKB";//红旗 getbillName = "HQKB";//红旗
} }
@ -346,14 +358,14 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
0, 0,
0, 0,
itm.Price, itm.Price,
Math.Round((itm.Price * itm.Qty),2) Math.Round((itm.Price * itm.Qty), 2)
); );
await _wmsRepository.GetDbContext().BulkInsertAsync(query.ToList(), new BulkConfig() { BulkCopyTimeout = 0, BatchSize = 10000 }); await _wmsRepository.GetDbContext().BulkInsertAsync(query.ToList(), new BulkConfig() { BulkCopyTimeout = 0, BatchSize = 10000 });
int _count = _wmsVersionRepository.Count(p => p.Version == version && p.BillNum == _billNum); int _count = _wmsVersionRepository.Count(p => p.Version == version && p.BillNum == _billNum);
if (_count == 0) if (_count == 0)
{ {
var _version = new WmsHQWithOutKanbanOutPut(GuidGenerator.Create(), version, _billNum, CurrentUser.Email,string.Empty); var _version = new WmsHQWithOutKanbanOutPut(GuidGenerator.Create(), version, _billNum, CurrentUser.Email, string.Empty);
await _wmsVersionRepository.InsertAsync(_version, true); await _wmsVersionRepository.InsertAsync(_version, true);
} }
return ApplicationConsts.SuccessStr; ; return ApplicationConsts.SuccessStr; ;

24
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsOneTimeSaleOutputAppService.cs

@ -234,14 +234,26 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
} }
//和物料主数据中SAP物料号检验是否存在 //和物料主数据中SAP物料号检验是否存在
foreach (var itm in _list) var gethqimportdata = _list.Select(p => p.SapMaterialCode).Distinct().ToList();
var getmaterial = _erpdapperRepository.GetMaterialList();
var queryCheck = from itm in gethqimportdata
join itm1 in getmaterial on itm equals itm1.MaterialCode into temp1
from tm1 in temp1.DefaultIfEmpty()
where tm1 == null
select itm;
foreach (var itm in queryCheck)
{ {
if (!_erpdapperRepository.GetMaterialList().Any(p => p.MaterialCode == itm.SapMaterialCode)) checkList.Add(new ErrorExportDto(version, "一次性寄售销售导入", string.Empty, string.Empty, itm, string.Empty, string.Format("物料主数据不存在当前导入的物料号{0}!", itm), string.Empty));
{
checkList.Add(new ErrorExportDto(version, "一次性寄售销售导入", string.Empty, string.Empty, itm.SapMaterialCode, string.Empty, string.Format("物料主数据不存在当前导入的物料号{0}!", itm.SapMaterialCode), string.Empty));
}
} }
//foreach (var itm in _list)
//{
// if (!_erpdapperRepository.GetMaterialList().Any(p => p.MaterialCode == itm.SapMaterialCode))
// {
// checkList.Add(new ErrorExportDto(version, "一次性寄售销售导入", string.Empty, string.Empty, itm.SapMaterialCode, string.Empty, string.Format("物料主数据不存在当前导入的物料号{0}!", itm.SapMaterialCode), string.Empty));
// }
//}
if (checkList.Count > 0) if (checkList.Count > 0)
{ {
return await ExportErrorReportAsync(checkList); return await ExportErrorReportAsync(checkList);

10
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpPartDapperRepository.cs

@ -57,6 +57,16 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
} }
/// <summary>
/// 获取客户物料号
/// </summary>
/// <returns></returns>
public virtual List<Material> GetMaterialListCustomerPartCode()
{
return DbConnection.Query<Material>("select max(Id) ID,'' Factory,CustomerPartCode,MaterialDesc,EstimateTypeDesc,EstimateType from Set_material where CustomerPartCode is not null group by CustomerPartCode, MaterialDesc, EstimateTypeDesc, EstimateType ").ToList();
}
public virtual List<ErrorBill> GetErrorBillList() public virtual List<ErrorBill> GetErrorBillList()
{ {

Loading…
Cancel
Save