44673626 2 years ago
parent
commit
540b48d354
  1. 35
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSJitAppService.cs
  2. 3
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs
  3. 21
      src/Modules/SettleAccount/src/SettleAccount.Domain/Settings/Helper.cs
  4. 79
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpPartDapperRepository.cs
  5. 450
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SyncFisService.cs

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

@ -47,6 +47,7 @@ using Win.Sfs.SettleAccount.Entities.WMS;
using Win.Sfs.SettleAccount.Entities.Wms;
using Win.Sfs.SettleAccount.Repository;
using WY.NewJit.Extends.PaiGe.WMS;
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report;
namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
{
@ -67,6 +68,10 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
private readonly ISettleAccountBranchEfCoreRepository<TaskJob, Guid> _job;
private readonly IExcelImportAppService _excelImportService;
private readonly TaskJobService _service;
private readonly ErpPartDapperRepository _repository;
/// <summary>
///
/// </summary>
@ -84,7 +89,10 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
WMSEfCoreRepository<TB_BILL> wmstbRespository,
IDistributedCache<WmsJitOutPutDetial> cache,
ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager
ICommonManager commonManager,
ErpPartDapperRepository repository
) : base(cache, excelImportService, snowflakeIdGenerator, commonManager)
{
_job = job;
@ -93,6 +101,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
_wmsVersionRepository = wmsVersionRepository;
_wmsefRespository = wmsefRespository;
_excelImportService = excelImportService;
_repository = repository;
}
@ -225,6 +234,21 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
var totalCount = await GetCountAsync(input);
var _ls = _repository.GetDic("WmsJitOutPut");
foreach (var itm in entities)
{
var _first = _ls.FirstOrDefault(p => p.BillNum == itm.BillNum);
if (_first != null)
{
itm.Extend = _first.OutputInfo;
}
}
return new PagedResultDto<WmsJitOutPut>(totalCount, entities);
}
@ -492,7 +516,6 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
//if (DateTime.Now.ToString("yyyyMM") != input.AccountDate.ToString("yyyyMM"))
//{
// throw new BusinessException("8989", "填写过账日期应该为当月!");
//}
var sql = "DECLARE @return_value int\n" +
@ -541,14 +564,6 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
return true;
}
/// <summary>
///出库界面功能, 撤销核准出库
/// </summary>

3
src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs

@ -337,6 +337,9 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
public string Creator { set; get; }
public string Extend { set; get; }
}

21
src/Modules/SettleAccount/src/SettleAccount.Domain/Settings/Helper.cs

@ -17,6 +17,27 @@ using Win.Sfs.SettleAccount.Entities.ImportMap;
namespace Win.Sfs.SettleAccount
{
public class RepeatSubmit
{
public string ClassName { set; get; }
public string ModthName { set; get; }
public DateTime SubmitDateTime{ set; get; }
}
//public static class SettleAccountHelper
//{
// List<>
//}
public class ExcelHelper
{
private IWorkbook _workbook;

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

@ -29,6 +29,15 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
}
public class OutputSumInfo
{
public string BillNum { set; get; }
public string OutputInfo { set; get; }
}
/// <summary>
/// 主数据Dapper表
@ -55,11 +64,11 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{
List<Material> _materialList = new List<Material>();
List<ErpPrice> _priceList = new List<ErpPrice>();
_materialList = DbConnection.Query<Material>("select max(Id) ID,'' Factory,MaterialCode,MaterialDesc,EstimateTypeDesc,EstimateType from Set_material group by MaterialCode,MaterialDesc,EstimateTypeDesc,EstimateType ").ToList();
_priceList = DbConnection.Query<ErpPrice>("select Price SapPrice, MaterialCode SapErpPartCode from Set_PriceList where type='10' and version=(select max(version) from Set_PriceListVersion)").ToList();
List<T> tmpList = new List<T>();
if (isNotHistoryPart == true)
{
@ -67,7 +76,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
var str = "select * from Set_ExistErpMaterialCodeDiff";
var _list = DbConnection.Query<SettleInfo>
(string.Format(str, version),null,null,true,1200).ToList();
(string.Format(str, version), null, null, true, 1200).ToList();
@ -165,7 +174,69 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
return _list.ToList();
}
public virtual List<OutputSumInfo> GetDic(string tableName)
{
/****** SSMS 的 SelectTopNRows 命令的脚本 ******/
var str = "select t1.BillNum,\n" +
"case when ISNULL(t1.[0],0)>0 then\n" +
"'未处理金额:'+cast(ISNULL(t1.[0],0) as varchar(50)) +'/行数:'+cast(ISNULL(t2.[0],0) as varchar(50))\n" +
"else '' end\n" +
"+\n" +
"' '\n" +
"+\n" +
"case when ISNULL(t1.[1],0)>0 then\n" +
"'申请金额:'+cast(ISNULL(t1.[1],0) as varchar(50)) +'/行数:'+cast(ISNULL(t2.[1],0) as varchar(50))\n" +
"else '' end\n" +
"+\n" +
"' '\n" +
"+\n" +
"case when ISNULL(t1.[2],0)>0 then\n" +
"'已出库金额:'+cast(ISNULL(t1.[2],0) as varchar(50)) +'/行数:'+cast(ISNULL(t2.[2],0) as varchar(50))\n" +
"else '' end\n" +
"+\n" +
"' '\n" +
"+\n" +
"case when ISNULL(t1.[3],0)>0 then\n" +
"'不能出库金额:'+cast(ISNULL(t1.[3],0) as varchar(50)) +'/行数:'+cast(ISNULL(t2.[3],0) as varchar(50))\n" +
"else '' end\n" +
"+\n" +
"' '\n" +
"+\n" +
"case when ISNULL(t1.[4],0)>0 then\n" +
"'取消出库金额:'+cast(ISNULL(t1.[4],0) as varchar(50)) +'/行数:'+cast(ISNULL(t2.[4],0) as varchar(50))\n" +
"else '' end\n" +
" OutPut \n" +
"from\n" +
"(select * from\n" +
"(SELECT\n" +
"BillNum,Amt,State\n" +
"FROM {0} ) a\n" +
"pivot\n" +
"(sum(amt) for state in ([0], [1], [2], [3], [4])) b ) t1\n" +
"inner join\n" +
"(\n" +
"select\n" +
"*\n" +
"from\n" +
"(\n" +
"SELECT\n" +
"BillNum,\n" +
"1 LineNumber,\n" +
"State\n" +
"FROM\n" +
"{0} ) a\n" +
"pivot\n" +
"(count(LineNumber) for state in ([0], [1], [2], [3], [4])) b\n" +
") t2 on\n" +
"t1.BillNum = t2.BillNum\n";
var _list = DbConnection.Query<OutputSumInfo>(string.Format(str, tableName));
return _list.ToList();
}
}

450
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SyncFisService.cs

@ -0,0 +1,450 @@
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel;
using Shouldly;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TaskJob.EventArgs;
using TaskJob.Interfaces;
using Volo.Abp.BlobStoring;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Uow;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report;
namespace SettleAccount.Job.Services.Report
{
public class SyncFisService : ITransientDependency, IExportJob
{
private readonly HQHSettledDetailDapperRepository _hqkanbanDapper;
private readonly KanbanUnSettledDapperRepository _kanbanDapper;
private readonly UnSettledDetailDapperRepository _dapper;
private readonly WmsDapperRepository _wmsDapper;
private readonly OutputService _outputService;
private readonly ErpPartDapperRepository _erpDapper;
private readonly SettleSparePartDapperReportRepository _sparepartdapper;
private readonly IBlobContainer<MyFileContainer> _fileContainer;
public SyncFisService(
HQHSettledDetailDapperRepository hqkanbanDapper,
KanbanUnSettledDapperRepository kanbanDapper,
UnSettledDetailDapperRepository dapper,
OutputService outputService,
ErpPartDapperRepository erpDapper,
WmsDapperRepository wmsDapper,
SettleSparePartDapperReportRepository sparepartdapper,
IBlobContainer<MyFileContainer> fileContainer
)
{
_wmsDapper = wmsDapper;
_hqkanbanDapper = hqkanbanDapper;
_kanbanDapper = kanbanDapper;
_dapper = dapper;
_outputService = outputService;
_erpDapper = erpDapper;
_sparepartdapper = sparepartdapper;
_fileContainer = fileContainer;
}
[UnitOfWork(false)]
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> p_list)
{
var _lsExport= GetReport(id,exportName,p_list);
var _lsleft = GetLeftReport(id, exportName, p_list);
//ExcelExporter _exporter = new ExcelExporter();//导出Excel
//var result = _exporter.Append(_lsExport, "汇总核对表1")
////.SeparateBySheet()
////.Append(_lsleft, "汇总核对表2")
//.ExportAppendDataAsByteArray();
//result.ShouldNotBeNull();
//_fileContainer.SaveAsync(String.Format("结算未结寄售核对表{0}.xlsx",Guid.NewGuid().ToString("N")), result.Result, true);
var _first = exportName.FirstOrDefault();
_outputService.Export<UnSettledSum>(id, _first, _lsExport);
return id.ToString();
}
[UnitOfWork(false)]
public List<UnSettledSum> GetFisSum(Guid id, List<string> exportName, List<CustomCondition> p_list)
{
var _first = exportName.FirstOrDefault();
var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value;
var materailCode = p_list.Where(p => p.Name == "MaterialCode").FirstOrDefault().Value;
var materialGroup = p_list.Where(p => p.Name == "MaterialGroup").FirstOrDefault().Value;
//var sapcode = p_list.Where(p => p.Name == "SapMaterialCode").FirstOrDefault().Value;
var begin = p_list.Where(p => p.Name == "Begin").FirstOrDefault().Value;
var end = p_list.Where(p => p.Name == "End").FirstOrDefault().Value;
//var kenncode = p_list.Where(p => p.Name == "KennCode").FirstOrDefault().Value;
//var chassisNumber = p_list.Where(p => p.Name == "ChassisNumber").FirstOrDefault().Value;
//var sapCode = p_list.Where(p => p.Name == "SapCode").FirstOrDefault().Value;
//var cp7begin = p_list.Where(p => p.Name == "CP7Begin").FirstOrDefault().Value;
//var cp7end = p_list.Where(p => p.Name == "CP7End").FirstOrDefault().Value;
var datestr = version.Substring(0, 4) + "-" + version.Substring(4, 2) + "-01";
var date = DateTime.Parse(datestr).AddMonths(1).AddDays(-1);
var datetime = date.ToShortDateString() + " 23:59:59 ";
var _list = _dapper.GetDiffReport(DateTime.Now.Year.ToString(), begin, datetime, "", version, materailCode, materialGroup, "");
var _ls = _list.Where(p => p.Flag != "L").Where(p => p.ParentSapMaterialCode != p.SapMaterialCode).GroupBy(p => new { p.KENNCode, p.ChassisNumber, p.ParentSapMaterialCode }).Select(p => p.FirstOrDefault()).ToList();
var _lst = _erpDapper.GetSapList(_ls, version, false);
_lst.ForEach(p =>
{
p.Qty = 1;
p.DiffAMT = Math.Round(p.Qty * p.Price, 2);
p.DiffQty = 1;
}
);
_list.AddRange(_lst);
_list = _list.Where(p => p.SapMaterialCode == p.ParentSapMaterialCode).ToList();
if (!string.IsNullOrEmpty(materialGroup))
{
var _groupList = materialGroup.Split(new char[] { ',' }).Distinct().ToList();
if (_groupList.Count() > 0)
{
_list = _list.Where(p => _groupList.Contains(p.MaterialGroup)).ToList();
}
}
//if (!string.IsNullOrEmpty(kenncode))
//{
// var _groupList = kenncode.Split(new char[] { '\n' }).Distinct().ToList();
// if (_groupList.Count() > 0)
// {
// _list = _list.Where(p => _groupList.Contains(p.KENNCode)).ToList();
// }
//}
//if (!string.IsNullOrEmpty(chassisNumber))
//{
// var _groupList = chassisNumber.Split(new char[] { '\n' }).Distinct().ToList();
// if (_groupList.Count() > 0)
// {
// _list = _list.Where(p => _groupList.Contains(p.ChassisNumber)).ToList();
// }
//}
//if (!string.IsNullOrEmpty(sapCode))
//{
// var _groupList = sapCode.Split(new char[] { '\n' }).Distinct().ToList();
// if (_groupList.Count() > 0)
// {
// _list = _list.Where(p => _groupList.Contains(p.SapMaterialCode)).ToList();
// }
//}
if (!string.IsNullOrEmpty(materailCode))
{
var _groupList = materailCode.Split(new char[] { '\n' }).Distinct().ToList();
if (_groupList.Count() > 0)
{
_list = _list.Where(p => _groupList.Contains(p.SapMaterialCode)).ToList();
}
}
var _fislist =_list.GroupBy(p => new { p.SapMaterialCode, p.MaterialDesc, p.MaterialGroup, p.MaterialCode })
.Select(p => new UnSettledSum
{
= "PLJS",
= version,
= p.Key.SapMaterialCode,
//客户物料 = p.Key.MaterialCode,
= p.Key.MaterialDesc,
= p.Key.MaterialGroup,
SAS未结明细汇总 = p.Sum(p => p.Qty).ToString()
}).ToList();
return _fislist;
}
/// <summary>
/// 大众看板未结数据
/// </summary>
/// <param name="id"></param>
/// <param name="exportName"></param>
/// <param name="p_list"></param>
/// <returns></returns>
public List<UnSettledSum> GetKanbanSum(Guid id, List<string> exportName, List<CustomCondition> p_list)
{
var _filename = exportName.FirstOrDefault();
var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value;
var begin = p_list.Where(p => p.Name == "Begin").FirstOrDefault().Value;
var end = p_list.Where(p => p.Name == "End").FirstOrDefault().Value;
var materailCode = p_list.Where(p => p.Name == "MaterialCode").FirstOrDefault().Value;
var materialGroup = p_list.Where(p => p.Name == "MaterialGroup").FirstOrDefault().Value;
//var sapCode = p_list.Where(p => p.Name == "SAPCode").FirstOrDefault().Value;
//var iscontionversion = p_list.Where(p => p.Name == "IsContainVersion").FirstOrDefault().Value;
var iscontionversion = "1";//不分版本,全查
//var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value;
//var customerCode = p_list.Where(p => p.Name == "CustomerCode").FirstOrDefault().Value;
//var materailCode = p_list.Where(p => p.Name == "MaterialCode").FirstOrDefault().Value;
//var materialGroup = p_list.Where(p => p.Name == "MaterialGroup").FirstOrDefault().Value;
//var sapcode = p_list.Where(p => p.Name == "SapMaterialCode").FirstOrDefault().Value;
//var begin = p_list.Where(p => p.Name == "Begin").FirstOrDefault().Value;
//var end = p_list.Where(p => p.Name == "End").FirstOrDefault().Value;
//var kenncode = p_list.Where(p => p.Name == "KennCode").FirstOrDefault().Value;
//var chassisNumber = p_list.Where(p => p.Name == "ChassisNumber").FirstOrDefault().Value;
//var sapCode = p_list.Where(p => p.Name == "SapCode").FirstOrDefault().Value;
var datestr = version.Substring(0, 4) + "-" + version.Substring(4, 2) + "-01";
var date = DateTime.Parse(datestr).AddMonths(1).AddDays(-1);
var datetime = date.ToShortDateString() + " 23:59:59 ";
var _ls = _kanbanDapper.GetKanbanReportList(version, begin, datetime, iscontionversion);
//if (!string.IsNullOrEmpty(sapCode))
//{
// var _groupList = sapCode.Split(new char[] { '\n' }).Distinct().ToList();
// if (_groupList.Count() > 0)
// {
// _ls = _ls.Where(p => _groupList.Contains(p.SapCode)).ToList();
// }
//}
if (!string.IsNullOrEmpty(materailCode))
{
var _groupList = materailCode.Split(new char[] { '\n' }).Distinct().ToList();
if (_groupList.Count() > 0)
{
_ls = _ls.Where(p => _groupList.Contains(p.CustomerPartCode)).ToList();
}
}
if (!string.IsNullOrEmpty(materialGroup))
{
var _groupList = materialGroup.Split(new char[] { ',' }).Distinct().ToList();
if (_groupList.Count() > 0)
{
_ls = _ls.Where(p => _groupList.Contains(p.MaterialGroup)).ToList();
}
}
//DiffQty 为实际发货数量=发货数量-结算数量-退货数量 财务要求
var kanbanList = _ls.GroupBy(p => new { p.SapCode, p.MaterialDesc, p.MaterialGroup, p.CustomerPartCode })
.Select(p => new UnSettledSum
{
= "PLJS",
= version,
= p.Key.SapCode,
//客户物料 = p.Key.CustomerPartCode,
= p.Key.MaterialDesc,
= p.Key.MaterialGroup,
SAS未结明细汇总 = p.Sum(p => p.DiffQty).ToString()
}).ToList();
return kanbanList;
}
/// <summary>
/// 红旗看板未结明细
/// </summary>
/// <param name="id"></param>
/// <param name="exportName"></param>
/// <param name="p_list"></param>
/// <returns></returns>
public List<UnSettledSum> GetHQKanbanSum(Guid id, List<string> exportName, List<CustomCondition> p_list)
{
var _filename = exportName.FirstOrDefault();
var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value;
var materialCode = p_list.Where(p => p.Name == "MaterialCode").FirstOrDefault().Value;
//var kanban = p_list.Where(p => p.Name == "Kanban").FirstOrDefault().Value;
var begin = p_list.Where(p => p.Name == "Begin").FirstOrDefault().Value;
var end = p_list.Where(p => p.Name == "End").FirstOrDefault().Value;
var materialGroup = p_list.Where(p => p.Name == "MaterialGroup").FirstOrDefault().Value;
//var acceptNo = p_list.Where(p => p.Name == "AcceptNo").FirstOrDefault().Value;
var sapCode = p_list.Where(p => p.Name == "SapCode").FirstOrDefault().Value;
//var warehouseDesc = p_list.Where(p => p.Name == "WarehouseDesc").FirstOrDefault().Value;
//var iscontionversion = p_list.Where(p => p.Name == "IsContainVersion").FirstOrDefault().Value;
var iscontionversion = "1";//不分区间,全查
//有发货无结算,单独拿出去,财务要求
var datestr = version.Substring(0, 4) + "-" + version.Substring(4, 2) + "-01";
var date = DateTime.Parse(datestr).AddMonths(1).AddDays(-1);
var datetime = date.ToShortDateString() + " 23:59:59 ";
var _ls = _hqkanbanDapper.GetReverseSettledDetailDiffReportList(version, materialCode, begin, datetime, materialGroup, iscontionversion);
if (!string.IsNullOrEmpty(sapCode))
{
var _groupList = sapCode.Split(new char[] { '\n' }).Distinct().ToList();
if (_groupList.Count() > 0)
{
_ls = _ls.Where(p => _groupList.Contains(p.Sap编码)).ToList();
}
}
var kanbanList = _ls.GroupBy(p => new { p.Sap编码, p., p., p. })
.Select(p => new UnSettledSum
{
="PLJS",
=version,
= p.Key.Sap编码,
//客户物料 = p.Key.客户物料号,
= p.Key.,
= p.Key.,
SAS未结明细汇总 = p.Sum(p => p.).ToString()
}).ToList();
return kanbanList;
}
/// <summary>
/// 大众备件未对
/// </summary>
/// <param name="id"></param>
/// <param name="exportName"></param>
/// <param name="p_list"></param>
/// <returns></returns>
public List<UnSettledSum> GetSparePartSum(Guid id, List<string> exportName, List<CustomCondition> p_list)
{
var fileName = exportName.FirstOrDefault();
//var purchaseOrderNo = p_list.Where(p => p.Name == "PurchaseOrderNo").FirstOrDefault().Value;
var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value;
var sapCode = p_list.Where(p => p.Name == "SapCode").FirstOrDefault().Value;
var matialCode = p_list.Where(p => p.Name == "MaterialCode").FirstOrDefault().Value;
var beginTime = p_list.Where(p => p.Name == "Begin").FirstOrDefault().Value;
var endTime = p_list.Where(p => p.Name == "End").FirstOrDefault().Value;
var datestr = version.Substring(0, 4) + "-" + version.Substring(4, 2) + "-01";
var date = DateTime.Parse(datestr).AddMonths(1).AddDays(-1);
var datetime = date.ToShortDateString() + " 23:59:59 ";
//var _ls = _sparepartdapper.GetReverseWithCodeSettleSparePartReportList(purchaseOrderNo, version, sapCode, matialCode, beginTime, endTime);
var _ls = _sparepartdapper.GetReverseWithCodeSettleSparePartReportList("", version, sapCode, matialCode, beginTime, datetime);
if (!string.IsNullOrEmpty(sapCode))
{
var _groupList = sapCode.Split(new char[] { '\n' }).Distinct().ToList();
if (_groupList.Count() > 0)
{
_ls = _ls.Where(p => _groupList.Contains(p.SAP编码)).ToList();
}
}
//说明 为实际发货数量=发货数量-结算数量-退货数量 财务要求
var kanbanList = _ls.GroupBy(p => new { p.SAP编码, p., p. })
.Select(p => new UnSettledSum
{
= "BJJS",
= version,
= p.Key.SAP编码,
//客户物料 = p.Key.物料代码,
= p.Key.,
= string.Empty,
SAS未结明细汇总 = p.Sum(p =>Convert.ToDecimal(p.)).ToString()
}).ToList();
return kanbanList;
}
public List<UnSettledSum> GetReport(Guid id, List<string> exportName, List<CustomCondition> p_list)
{
var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value;
List<UnSettledSum> _ls = new List<UnSettledSum>();
_ls.AddRange(GetFisSum(id, exportName, p_list));
_ls.AddRange(GetHQKanbanSum(id, exportName, p_list));
_ls.AddRange(GetKanbanSum(id, exportName, p_list));
_ls.AddRange(GetSparePartSum(id, exportName, p_list));//大众备件未结
var _lst = _wmsDapper.GetSalesStockSum(version);
var query = from itm in _lst
join itm1 in _ls
on new { Version = itm.Version, PartCode = itm.PartCode.Trim(), LocCode= itm.LocCode.ToUpper()} equals new { Version = itm1., PartCode = itm1..Trim(), LocCode = itm1.}
into temp
from tm in temp.DefaultIfEmpty()
select new UnSettledSum
{
= itm.Version,
= itm.PartCode,
= itm.PartDesc,
= itm.PartGroup,
= itm.PartGroupDesc,
SAS未结明细汇总 = tm == null ? "0" : tm.SAS未结明细汇总,
WMS期初库存 = itm.StartQty.ToString(),
WMS期末库存 = itm.EndQty.ToString(),
= itm.LocCode,
= itm.OutQty.ToString(),
= itm.InQty.ToString(),
= (itm.EndQty- decimal.Parse( tm == null ? "0" : tm.SAS未结明细汇总)).ToString()
};
return query.ToList();
}
public List<UnSettledSum> GetLeftReport(Guid id, List<string> exportName, List<CustomCondition> p_list)
{
var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value;
List<UnSettledSum> _ls = new List<UnSettledSum>();
_ls.AddRange(GetFisSum(id, exportName, p_list));
_ls.AddRange(GetHQKanbanSum(id, exportName, p_list));
_ls.AddRange(GetKanbanSum(id, exportName, p_list));
_ls.AddRange(GetSparePartSum(id, exportName, p_list));//大众备件未结
var _lst = _wmsDapper.GetSalesStockSum(version);
var query = from itm in _ls
join itm1 in _lst
on new { Version = itm., PartCode = itm..Trim(), LocCode = itm. } equals
new { Version = itm1.Version, PartCode = itm1.PartCode.Trim(), LocCode = itm1.LocCode.ToUpper() }
into temp
from tm in temp.DefaultIfEmpty()
select new UnSettledSum
{
= itm.,
= itm.,
= itm.,
= itm.,
= itm.,
SAS未结明细汇总 = tm == null ? "0" : tm.EndQty.ToString(),
WMS期初库存 = tm == null ? "0" : tm.StartQty.ToString(),
WMS期末库存 = tm == null ? "0" : tm.EndQty.ToString(),
= itm.,
= tm == null ? "0" : tm.OutQty.ToString(),
= tm == null ? "0" : tm.InQty.ToString(),
= ((tm == null ? 0 : tm.EndQty) - decimal.Parse(tm == null ? "0" : itm.SAS未结明细汇总)).ToString()
};
return query.ToList();
}
}
}
Loading…
Cancel
Save