Browse Source

更新版本

FoShanPG
Administrator 3 years ago
parent
commit
187b50555e
  1. 6
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsUnInterface.cs
  2. 37
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/WmsDapperRepository.cs
  3. 65
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/WmsOutputSumDapperRepository.cs
  4. 177
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettledSumService.cs
  5. 10
      src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobModule.cs

6
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsUnInterface.cs

@ -305,11 +305,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
checkList.Add(new ErrorExportDto() { Message = string.Format("结算号:{0}物料号:{1}实际出库数量不等于结算数量不能同步Sap", itm.BillNum, itm.MaterialCode) });
}
var _count = entities.Count(p => p.State==2);
if (_count > 1)
{
throw new BusinessException("8989", "记录中有已经完成记录!");
@ -350,7 +346,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
_erpDapper.InsertWmsSum(entities, _version, _accountDate);
}
}
return ApplicationConsts.SuccessStr; ;
return ApplicationConsts.SuccessStr;
}
[HttpPost]
[Route("Export")]

37
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/WmsDapperRepository.cs

@ -16,7 +16,30 @@ using Win.Sfs.SettleAccount.Reports;
namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{
public class SalesStockSum
{
public string Version {set;get;}
public string PartCode {set;get;}
public string LocCode {set;get;}
public decimal StartQty {set;get;}
public decimal InQty {set;get;}
public decimal OutQty {set;get;}
public decimal EndQty {set;get;}
public string Remark {set;get;}
public DateTime CreateTime {set;get;}
public string OperName {set;get;}
public DateTime StartTime { set; get; }
public DateTime EndTime { set; get; }
}
public class SalesStock
{
@ -43,6 +66,18 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
return _list.ToList();
}
public virtual List<SalesStockSum> GetSalesStockSum(string locCode)
{
string str = " select * from TM_PG_TIME_STOCK_DETAIL where LocCode ='{0}'";
str=string.Format(str, locCode);
var _list = DbConnection.Query<SalesStockSum>(str);
return _list.ToList();
}
//public virtual Dictionary<string,decimal> GetSapList<T>(List<T> childList, string version, bool isNotHistoryPart = false) where T : ReportDetailBase, new()

65
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/WmsOutputSumDapperRepository.cs

@ -572,6 +572,29 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" SapMaterialCode,\n" +
" IsBack,\n" +
" Price \n" +
" union all\n" +
" SELECT\n" +
" '4009' LOGN,\n" +
" '一次性销售' AS Type,\n" +
" '一次性销售' Client,\n" +
" 'Z15' CODE,\n" +
" '10' SaleCode,\n" +
" Extend ClientCode,\n" +
" BillNum,\n" +
" SapMaterialCode,\n" +
" SUM( Qty ) Qty,\n" +
" 0 IsBack,\n" +
" Price \n" +
" FROM\n" +
" Set_WmsOneTimeSaleOutPutDetial\n" +
" WHERE\n" +
" \n" +
" VERSION = '{0}' \n" +
" GROUP BY\n" +
" BillNum,\n" +
" SapMaterialCode,\n" +
" Price, \n" +
" Extend\n" +
" ) temp\n" +
" LEFT JOIN ( SELECT max( Id ) Id, MaterialCode, MaterialDesc, EstimateType, EstimateTypeDesc FROM Set_material GROUP BY MaterialCode, MaterialDesc, EstimateTypeDesc, EstimateType ) temp2 ON temp.MaterialCode = temp2.MaterialCode \n" +
" ) t1 UNION ALL\n" +
@ -819,6 +842,36 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" SapMaterialCode,\n" +
" IsBack,\n" +
" Price \n" +
" union all\n" +
" SELECT\n" +
" '4009' LOGN,\n" +
" '一次性销售' AS Type,\n" +
" '一次性销售' Client,\n" +
" 'Z15' CODE,\n" +
" '10' SaleCode,\n" +
" Extend ClientCode,\n" +
" BillNum,\n" +
" SapMaterialCode,\n" +
" SUM( RealityNumber ) Qty,\n" +
" 0 IsBack,\n" +
" Price \n" +
" FROM\n" +
" Set_WmsOneTimeSaleOutPutDetial\n" +
" WHERE\n" +
" \n" +
" VERSION = '{0}' \n" +
" AND State = 2 \n" +
" GROUP BY\n" +
" BillNum,\n" +
" SapMaterialCode,\n" +
" Price, \n" +
" Extend \n"+
" ) temp\n" +
" LEFT JOIN ( SELECT max( Id ) Id, MaterialCode, MaterialDesc, EstimateType, EstimateTypeDesc FROM Set_material GROUP BY MaterialCode, MaterialDesc, EstimateTypeDesc, EstimateType ) temp2 ON temp.MaterialCode = temp2.MaterialCode \n" +
" ) t2 \n" +
@ -826,6 +879,18 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" ORDER BY\n" +
" 客户,出库类型,结算单;";
_sql = string.Format(_sql, version);
var _query = DbConnection.Query<WmsOutputSumReport>(_sql, null, null, true, 1200, null);
return _query.ToList();

177
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettledSumService.cs

@ -5,12 +5,17 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TaskJob.EventArgs;
using TaskJob.Interfaces;
using Volo.Abp.DependencyInjection;
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report;
namespace SettleAccount.Job.Services.Report
{
public class UnSettledSum
{
[ExporterHeader(DisplayName = "版本")]
public string { set; get; }
[ExporterHeader(DisplayName = "库位 ")]
public string {set;get;}
[ExporterHeader(DisplayName = "物料组编码 ")]
@ -37,11 +42,12 @@ namespace SettleAccount.Job.Services.Report
public string { set; get; }
}
public class UnSettledSumService
public class UnSettledSumService : 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;
public UnSettledSumService(
@ -49,7 +55,8 @@ namespace SettleAccount.Job.Services.Report
KanbanUnSettledDapperRepository kanbanDapper,
UnSettledDetailDapperRepository dapper,
OutputService outputService,
ErpPartDapperRepository erpDapper
ErpPartDapperRepository erpDapper,
WmsDapperRepository _wmsDapper
)
{
_hqkanbanDapper = hqkanbanDapper;
@ -59,27 +66,38 @@ namespace SettleAccount.Job.Services.Report
_erpDapper = erpDapper;
}
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> p_list)
{
GetReport(id,exportName,p_list);
return id.ToString();
}
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 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 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 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 _list = _dapper.GetDiffReport(DateTime.Now.Year.ToString(), begin, end, customerCode, version, materailCode, materialGroup, sapcode);
var _list = _dapper.GetDiffReport(DateTime.Now.Year.ToString(), begin, end, "", 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 =>
@ -99,30 +117,30 @@ namespace SettleAccount.Job.Services.Report
_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(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();
@ -131,13 +149,15 @@ namespace SettleAccount.Job.Services.Report
_list = _list.Where(p => _groupList.Contains(p.SapMaterialCode)).ToList();
}
}
var _fislist= _lst.GroupBy(p =>new { p.SapMaterialCode,p.MaterialDesc,p.MaterialGroup,p.MaterialCode })
.Select(p => new UnSettledSum
{ = p.Key.SapMaterialCode,
=p.Key.MaterialCode,
=p.Key.MaterialDesc,
=p.Key.MaterialGroup,
SAS未结明细汇总= p.Sum(p => p.Qty).ToString()
var _fislist = _lst.GroupBy(p => new { p.SapMaterialCode, p.MaterialDesc, p.MaterialGroup, p.MaterialCode })
.Select(p => new UnSettledSum
{
= version,
= p.Key.SapMaterialCode,
= p.Key.MaterialCode,
= p.Key.MaterialDesc,
= p.Key.MaterialGroup,
SAS未结明细汇总 = p.Sum(p => p.Qty).ToString()
}).ToList();
return _fislist;
@ -146,15 +166,13 @@ namespace SettleAccount.Job.Services.Report
{
var _filename = exportName.FirstOrDefault();
var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value;
var begin = p_list.Where(p => p.Name == "BegingTime").FirstOrDefault().Value;
var end = p_list.Where(p => p.Name == "EndTime").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 materialCode = p_list.Where(p => p.Name == "MatialCode").FirstOrDefault().Value;
var sapCode = p_list.Where(p => p.Name == "SAPCode").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 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;
@ -166,24 +184,21 @@ namespace SettleAccount.Job.Services.Report
//var chassisNumber = p_list.Where(p => p.Name == "ChassisNumber").FirstOrDefault().Value;
//var sapCode = p_list.Where(p => p.Name == "SapCode").FirstOrDefault().Value;
var _ls = _kanbanDapper.GetKanbanReportList(version, begin, end, 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(materialCode))
//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 = materialCode.Split(new char[] { '\n' }).Distinct().ToList();
var _groupList = materailCode.Split(new char[] { '\n' }).Distinct().ToList();
if (_groupList.Count() > 0)
{
_ls = _ls.Where(p => _groupList.Contains(p.CustomerPartCode)).ToList();
@ -199,9 +214,10 @@ namespace SettleAccount.Job.Services.Report
}
var kanbanList= _ls.GroupBy(p => new { p.SapCode, p.MaterialDesc, p.MaterialGroup, p.CustomerPartCode })
var kanbanList = _ls.GroupBy(p => new { p.SapCode, p.MaterialDesc, p.MaterialGroup, p.CustomerPartCode })
.Select(p => new UnSettledSum
{
= version,
= p.Key.SapCode,
= p.Key.CustomerPartCode,
= p.Key.MaterialDesc,
@ -223,8 +239,8 @@ namespace SettleAccount.Job.Services.Report
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 == "BeginTime").FirstOrDefault().Value;
var end = p_list.Where(p => p.Name == "EndTime").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;
@ -244,6 +260,7 @@ namespace SettleAccount.Job.Services.Report
var kanbanList = _ls.GroupBy(p => new { p.Sap编码, p., p., p. })
.Select(p => new UnSettledSum
{
=version,
= p.Key.Sap编码,
= p.Key.,
= p.Key.,
@ -254,6 +271,42 @@ namespace SettleAccount.Job.Services.Report
return kanbanList;
}
public List<UnSettledSum> GetReport(Guid id, List<string> exportName, List<CustomCondition> p_list)
{
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));
var _lst = _wmsDapper.GetSalesStockSum("pljs");
var query = from itm in _ls join itm1 in _lst on new { Version = itm., PartCode = itm. } equals new { Version = itm1.Version, PartCode = itm1.PartCode }
into temp from tm in temp.DefaultIfEmpty()
select new UnSettledSum {
= itm.,
= itm.,
= itm.,
= itm.,
= itm.,
SAS未结明细汇总 = itm.SAS未结明细汇总,
WMS期初库存 = tm == null ? "0" : tm.StartQty.ToString(),
WMS期末库存 = tm == null ? "0" : tm.EndQty.ToString(),
= tm == null ? "" : tm.LocCode,
= tm == null ? "" : tm.OutQty.ToString(),
= tm == null ? "" : tm.InQty.ToString(),
};
return query.ToList();
}
}
}

10
src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobModule.cs

@ -219,10 +219,20 @@ namespace Win.Sfs.SettleAccount
{
return implementationFactory.GetService<FisUpdateExportService>();
}
if (key.Equals(typeof(UnSettledSumService).FullName))
{
return implementationFactory.GetService<UnSettledSumService>();
}
else
{
throw new ArgumentException($"Not Support key:{key}");
}
}; return accesor;
});

Loading…
Cancel
Save