44673626 3 years ago
parent
commit
099af58d80
  1. 2
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanAppService.cs
  2. 78
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePartAppService.cs
  3. 97
      src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs
  4. 26
      src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml
  5. 91
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs
  6. 63
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs
  7. 202
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartExtendDapperReportRepository.cs
  8. 8
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettledDetailDapperRepository.cs
  9. 86
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/WmsDapperRepository.cs
  10. 37
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/KanBanUnSettledExport.cs
  11. 8
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnsettledDetailReport.cs

2
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanAppService.cs

@ -505,8 +505,6 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
{
checkList.Add(new ErrorExportDto() { Message = string.Format("出库单号:{0}重复记录数:{1}条", itm.BillNum, itm.Number) });
}
if (checkList.Count > 0)
{

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

@ -59,7 +59,6 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
public class WMSSharePartAppService :
SettleAccountApplicationBase<WmsSharePartOutPutDetial>
{
private readonly ISettleAccountBranchEfCoreRepository<WmsSharePartOutPutDetial, Guid> _wmsRepository;
private readonly ISettleAccountBranchEfCoreRepository<WmsSharePartOutPut, Guid> _wmsVersionRepository;
private readonly WMSEfCoreRepository<WmsSharePartOutPutDetial> _wmsefRespository;
@ -182,7 +181,6 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
public async Task<string> WmsSharePartOutPut(WmsJitRequestDto input)
{
var _billNum = "B" + DateTime.Now.ToString("yyyyMMddhhmmss");
var _joblist = _job.Where(p => input.Guids.Contains(p.Id) && p.FileName == "已确认").ToList();
if (_joblist.Count() > 0)
{
@ -193,26 +191,54 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
string fileSavePath = Environment.CurrentDirectory + @"\wwwroot\files\host\my-file-container\" + filename;
ExcelHelper _excelHelper = new ExcelHelper(fileSavePath);
var _list = _excelHelper.ExcelToList<WmsSharePartOutPutDetial>();
foreach (var itm in _list)
if (_list.Count() > 0)
{
itm.SetId(GuidGenerator.Create());
var _lsAry = _list.GroupBy(p => new
{
p.MaterialCode,
p.MaterialGroup,
p.OrderBillNum,
p.MaterialDesc,
p.Version,
p.WmsBillNum,
}).Select(p => new
WmsSharePartOutPutDetial(
GuidGenerator.Create(),
p.Key.WmsBillNum,
p.Key.OrderBillNum,
p.Key.MaterialCode,
p.Key.MaterialDesc,
p.Key.MaterialGroup,
string.Empty,
string.Empty,
0,
string.Empty,
string.Empty,
string.Empty,
p.Key.MaterialCode,
_billNum,
GuidGenerator.Create(),
string.Empty,
p.Sum(itm => itm.Qty)
));
_lst.AddRange(_lsAry.ToArray());
}
_lst.AddRange(_list.ToArray());
}
var _ls1 = _lst.Where(p => p.ParentMaterialCode == p.MaterialCode).ToList();
var outPutDetail = await _wmsRepository.Where(p => p.Version == input.Version).ToListAsync();
var error = from itm1 in outPutDetail
join itm2 in _ls1 on
var error = from itm1 in outPutDetail
join itm2 in _lst on
new { itm1.MaterialCode, itm1.OrderBillNum }
equals
new { itm2.MaterialCode, itm2.OrderBillNum }
select itm1;
var errList = error.GroupBy(p => new { p.BillNum }).Select(p => new { BillNum = p.Key.BillNum, Number = p.Sum(itm => itm.Qty) });
if (errList.Count() == 0)
{
var query = from itm1 in _ls1
var query = from itm1 in _lst
join itm2 in outPutDetail on
new { itm1.MaterialCode, itm1.OrderBillNum }
equals
@ -221,6 +247,35 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
where tm1 == null
select itm1;
var _wmslst = query.ToList();
_wmslst = _wmslst.GroupBy(p => new
{
p.MaterialCode,
p.MaterialGroup,
p.OrderBillNum,
p.MaterialDesc,
p.Version,
p.WmsBillNum,
}).Select(p => new
WmsSharePartOutPutDetial(
GuidGenerator.Create(),
p.Key.WmsBillNum,
p.Key.OrderBillNum,
p.Key.MaterialCode,
p.Key.MaterialDesc,
p.Key.MaterialGroup,
string.Empty,
string.Empty,
0,
string.Empty,
string.Empty,
string.Empty,
p.Key.MaterialCode,
_billNum,
GuidGenerator.Create(),
string.Empty,
p.Sum(itm => itm.Qty)
)).ToList();
foreach (var itm in _wmslst)
{
itm.BillNum = _billNum;
@ -361,6 +416,9 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
ExportImporter _exportImporter = new ExportImporter();
var result = await _exportImporter.ExtendExcelImport<WmsSharePartOutPutDetial>(files, _excelImportService);
List<WmsSharePartOutPutDetial> _lst = new List<WmsSharePartOutPutDetial>();
var _lsCopy = new List<WmsSharePartOutPutDetial>();
foreach (var itm in result)
{
@ -382,7 +440,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
itm.BillNum,
GuidGenerator.Create()
, string.Empty
, itm.Qty.Value
, itm.Qty
);
_lsCopy.Add(_detail);
}

97
src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs

@ -167,7 +167,7 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
customConditionList.Add(new CustomCondition() { Name = "BegingTime", Value = input.Begin.ToString() });
customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = input.End.ToString() });
var _taskid = await _service.ExportEnqueueAsync("无条码看板结算输出", ExportExtentsion.Excel, input.Version, string.Empty, CurrentUser, typeof(SettleKBWithOutCodeExportService), customConditionList, (rs) =>
var _taskid = await _service.ExportEnqueueAsync("无条码看板结算输出", ExportExtentsion.Excel, input.Version,string.Empty, CurrentUser, typeof(SettleKBWithOutCodeExportService), customConditionList, (rs) =>
{
});
return _taskid;
@ -211,28 +211,103 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
});
return _taskid;
}
/// <summary>
/// 无订单备件结算输出
/// </summary>
/// <param name="purchaseOrderNo">采购订单号</param>
/// <param name="sapCode">厂内物料号</param>
/// <param name="version">版本</param>
/// <param name="customerCode"></param>
/// <param name="factory"></param>
/// <param name="matialCode">物料代码</param>
/// <param name="state"></param>
/// <param name="begin"></param>
/// <param name="end"></param>
/// <returns></returns>
[HttpGet]
[Route("SettleSparePartExportExtend")]
[DisableRequestSizeLimit]
public async Task<string> SettledSparePartExtend(string purchaseOrderNo, string sapCode, string version, string customerCode, string factory, string matialCode,
string state, DateTime begin, DateTime end)
{
List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty });
customConditionList.Add(new CustomCondition() { Name = "PurchaseOrderNo", Value = purchaseOrderNo ?? string.Empty });
customConditionList.Add(new CustomCondition() { Name = "SAPCode", Value = sapCode ?? string.Empty });
customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = customerCode ?? string.Empty });
customConditionList.Add(new CustomCondition() { Name = "State", Value = state ?? "0" });
customConditionList.Add(new CustomCondition() { Name = "MatialCode", Value = matialCode ?? "0" });
customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "大众备件结算核对" });
customConditionList.Add(new CustomCondition() { Name = "BegingTime", Value = begin.ToString() });
customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = end.ToString() });
var _taskid = await _service.ExportEnqueueAsync("无订单备件结算输出", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(SettleSparePartExportService), customConditionList, (rs) =>
{
});
return _taskid;
}
#endregion
[HttpGet]
[Route("SettleSparePartExport")]
[Route("SharePartUnSettledExport")]
[DisableRequestSizeLimit]
public async Task<string> SharePartUnSettled( string sapCode, string version,
DateTime begin, DateTime end)
{
List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty });
customConditionList.Add(new CustomCondition() { Name = "SAPCode", Value = sapCode ?? string.Empty });
customConditionList.Add(new CustomCondition() { Name = "BegingTime", Value = begin.ToString() });
customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = end.ToString() });
var _taskid = await _service.ExportEnqueueAsync("备件未结明细", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(SharePartUnSettledExport), customConditionList, (rs) =>
{
});
return _taskid;
}
var _taskid = await _service.ExportEnqueueAsync("备件未结对比", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(SharePartUnSettledExport), customConditionList, (rs) =>
/// <summary>
/// 看板未结输出
/// </summary>
/// <param name="sapCode"></param>
/// <param name="version"></param>
/// <param name="begin"></param>
/// <param name="end"></param>
/// <param name="materialGroup"></param>
/// <returns></returns>
[HttpGet]
[Route("KanbanUnSettledExport")]
[DisableRequestSizeLimit]
public async Task<string> KanbanUnSettled(string sapCode, string version,
DateTime begin, DateTime end,string materialGroup)
{
List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty });
customConditionList.Add(new CustomCondition() { Name = "SAPCode", Value = sapCode ?? string.Empty });
customConditionList.Add(new CustomCondition() { Name = "BegingTime", Value = begin.ToString() });
customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = end.ToString() });
customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = materialGroup });
var _taskid = await _service.ExportEnqueueAsync("看板未结明细", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(KanBanUnSettledExport), customConditionList, (rs) =>
{
});
@ -241,6 +316,10 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
/// <summary>
/// 未结算对比
/// </summary>
@ -446,7 +525,6 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
customConditionList.Add(new CustomCondition() { Name = "Cp7EndTime", Value = string.IsNullOrEmpty(request.Cp7End) ? string.Empty : request.Cp7End });
customConditionList.Add(new CustomCondition() { Name = "KennCode", Value = string.IsNullOrEmpty(request.Kenncode) ? string.Empty : request.Kenncode });
customConditionList.Add(new CustomCondition() { Name = "ChassisNumber", Value = string.IsNullOrEmpty(request.ChassisNumber) ? string.Empty : request.ChassisNumber });
customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(request.MaterialGroup) ? string.Empty : request.MaterialGroup });
customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(request.SapCode) ? string.Empty : request.SapCode });
var _taskid = await _service.ExportEnqueueAsync("准时化结算数量差异比对输出", ExportExtentsion.Excel,request.Version, string.IsNullOrEmpty(request.MaterialGroup) ? string.Empty : request.MaterialGroup, CurrentUser, typeof(UnInvoiceSettledDetailDiffExportService), customConditionList, (rs) =>
@ -479,7 +557,6 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = !string.IsNullOrEmpty(input.MaterialCode)? input.MaterialCode :string.Empty });
customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = !string.IsNullOrEmpty(input.MaterialGroup)? input.MaterialGroup :string.Empty });
customConditionList.Add(new CustomCondition() { Name = "SapMaterialCode", Value =string.Empty });
customConditionList.Add(new CustomCondition() { Name = "Begin", Value = !string.IsNullOrEmpty(input.Begin)?string.Empty: input.Begin });
customConditionList.Add(new CustomCondition() { Name = "End", Value = !string.IsNullOrEmpty(input.End)?string.Empty: input.End });
customConditionList.Add(new CustomCondition() { Name = "KennCode", Value = string.IsNullOrEmpty(input.Kenncode) ? string.Empty : input.Kenncode });

26
src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml

@ -2969,6 +2969,32 @@
<param name="end"></param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.SettledSparePartExtend(System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.DateTime,System.DateTime)">
<summary>
无订单备件结算输出
</summary>
<param name="purchaseOrderNo">采购订单号</param>
<param name="sapCode">厂内物料号</param>
<param name="version">版本</param>
<param name="customerCode"></param>
<param name="factory"></param>
<param name="matialCode">物料代码</param>
<param name="state"></param>
<param name="begin"></param>
<param name="end"></param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.KanbanUnSettled(System.String,System.String,System.DateTime,System.DateTime,System.String)">
<summary>
看板未结输出
</summary>
<param name="sapCode"></param>
<param name="version"></param>
<param name="begin"></param>
<param name="end"></param>
<param name="materialGroup"></param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.InvoiceSettledDiffMake(System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String)">
<summary>
1.大众发票与结算核对汇总表

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

@ -308,7 +308,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
/// <summary>
/// 扩展字段2
/// </summary>
[ImporterHeader(Name = "扩展字段2", IsIgnore = true)]
[ImporterHeader(Name = "订单日期")]
public string Extend2 { set; get; }
/// <summary>
/// 扩展字段3
@ -439,7 +439,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
[ImporterHeader(Name = "版本号",IsIgnore =true)]
public string Version { set; get; }
[ImporterHeader(Name = "开票数量")]
public decimal? Qty { set; get; }
public decimal Qty { set; get; }
[ImporterHeader(Name = "数量", IsIgnore = true)]
public string BillNum { set; get; }
@ -454,7 +454,94 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
public class WmsSharePartOutPutDetial2: FullAuditedAggregateRootBase<Guid>
{
public WmsSharePartOutPutDetial2()
{
}
public WmsSharePartOutPutDetial2(Guid id, string wmsBillNum, string orderBillNum, string materialCode, string materialDesc, string materialGroup, string outPut, string inPut, int state, string extend1, string extend2, string extend3, string parentMaterialCode, string billNum, Guid taskId, string remark, decimal qty)
{
Id = id;
//WmsBillNum = wmsBillNum;
//OrderBillNum = orderBillNum;
MaterialCode = materialCode;
MaterialDesc = materialDesc;
//MaterialGroup = materialGroup;
OutPut = outPut;
InPut = inPut;
State = state;
Extend1 = extend1;
Extend2 = extend2;
Version = extend3;
//ParentMaterialCode = parentMaterialCode;
BillNum = billNum;
TaskId = taskId;
Remark = remark;
Qty = qty;
}
public void SetId(Guid id)
{
Id = id;
}
//[ImporterHeader(Name = "组件组物料")]
//public string ParentMaterialCode { set; get; }
//[ImporterHeader(Name = "交货单号")]
//public string WmsBillNum { set; get; }
//[ImporterHeader(Name = "采购订单号")]
////KENN号
//public string OrderBillNum { set; get; }
[ImporterHeader(Name = "SAP编码")]
//物料号
public string MaterialCode { set; get; }
[ImporterHeader(Name = "物料描述")]
//物料描述
public string MaterialDesc { set; get; }
//[ImporterHeader(Name = "物料组(车型)",IsIgnore =true)]
////物料组(车型)
//public string MaterialGroup { set; get; }
[ImporterHeader(Name = "出库库位", IsIgnore = true)]
//出库库位
public string OutPut { set; get; }
[ImporterHeader(Name = "入库库位", IsIgnore = true)]
//入库库位
public string InPut { set; get; }
[ImporterHeader(Name = "状态", IsIgnore = true)]
public int State { get; set; }
[ImporterHeader(Name = "物料代码")]
/// <summary>
/// 扩展字段1
/// </summary>
public string Extend1 { set; get; }
/// <summary>
/// 扩展字段2
/// </summary>
[ImporterHeader(Name = "扩展字段2", IsIgnore = true)]
public string Extend2 { set; get; }
/// <summary>
/// 扩展字段3
/// </summary>
[ImporterHeader(Name = "版本号", IsIgnore = true)]
public string Version { set; get; }
[ImporterHeader(Name = "开票数量")]
public decimal InvoiceQty { set; get; }
[ImporterHeader(Name = "出库数量", IsIgnore = true)]
public decimal Qty { set; get; }
[ImporterHeader(Name = "已出数量", IsIgnore = true)]
public decimal OutQty { set; get; }
[ImporterHeader(Name = "数量", IsIgnore = true)]
public string BillNum { set; get; }
public Guid TaskId { set; get; }
}

63
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs

@ -102,6 +102,69 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
}
public virtual List<SettleSparePartExport> GetSettleSparePartNoOrderList(string purchaseOrderNo, string version, string sapCode, string matialCode,
string begintime, string endtime)
{
string sqlString = " SELECT \n" +
" * , \n" +
" (Price-InvoicePrice) as InvoiceDiffPrice, --单价差异 \n" +
" ISNULL( Price * ReceiptQty-InvoiceMoney, 0 ) AS SumDiffMoney --总金额差异 \n" +
" FROM \n" +
" ( \n" +
" SELECT \n" +
" c.Period as WMSDeliveryDate,--交货日期 \n" +
" c.WMSDeliveryNote,--交货单号 \n" +
" c.SpareDate as OrderDate,--订单日期 \n" +
" a.PurchaseOrderNo,--采购订单号 \n" +
" b.MaterialCode as SAPCode,--SAP编码,即厂内物料号 \n" +
" a.MaterialCode,--物料代码 \n" +
" b.MaterialDesc,--物料描述 \n" +
" a.PurchaseOrderNoText,--采购订单文本 \n" +
" c.ReceiptQty,-- 发货数量 \n" +
" a.InvoicedQty as InvoicedQty,--开票数量 \n" +
" (c.ReceiptQty-d.Amt) as SettleInvoiceDiffQty,--发货与开票差异 \n" +
" d.InvoicePrice,--开票单价 \n" +
" 0 as InvoiceMoney --开票金额 \n" +
" \n" +
" FROM \n" +
" Set_SparePart AS a \n" +
" LEFT JOIN Set_material AS b ON a.MaterialCode= b.CustomerPartCode \n" +
" LEFT JOIN Set_WMSSparePart c ON a.PurchaseOrderNo= c.WMSDeliveryNote \n" +
" AND a.MaterialCode= c.MaterialCode \n" +
" LEFT JOIN ( SELECT SUM ( amt ) / SUM ( Qty ) InvoicePrice, MaterialCode,Amt FROM set_invoice WHERE version = '{0}' GROUP BY materialcode,Amt ) d ON a.MaterialCode= d.MaterialCode \n" +
" ) TEMP1 \n" +
" LEFT JOIN ( SELECT Price, --定价 \n" +
" MaterialCode --厂内物料号 \n" +
" FROM Set_PriceList WHERE version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) TEMP2 ON TEMP1.SAPCode= TEMP2.MaterialCode ";
string addwhere = string.Empty;
string addSqlStr = string.Format(sqlString, version);
//if (!string.IsNullOrEmpty(purchaseOrderNo))
//{
// addwhere += string.Format(" AND PurchaseOrderNo LIKE '{0}%' ", purchaseOrderNo);
//}
//else if (!string.IsNullOrEmpty(sapCode))
//{
// addwhere += string.Format(" AND SAPCode LIKE '{0}%' ", sapCode);
//}
//else if (!string.IsNullOrEmpty(matialCode))
//{
// addwhere += string.Format(" AND MaterialCode LIKE '{0}%' ", matialCode);
//}
//else if (!string.IsNullOrEmpty(begintime)&& !string.IsNullOrEmpty(endtime))
//{
// addwhere += string.Format(" AND OrderDate BETWEEN '{0}' AND '{1}' ", begintime, endtime);
//}
string _sql = string.Format(addSqlStr, addwhere);
//string _sql = string.Format(sqlString, version);
var _query = DbConnection.Query<SettleSparePartExport>(_sql, null, null, true, 1200, null);
return _query.ToList();
}
}
/// <summary>

202
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartExtendDapperReportRepository.cs

@ -0,0 +1,202 @@
using Dapper;
using Magicodes.ExporterAndImporter.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories.Dapper;
using Volo.Abp.EntityFrameworkCore;
namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{
public class SettleSparePartExtendDapperReportRepository : DapperRepository<SettleAccountDbContext>, ITransientDependency
{
public SettleSparePartExtendDapperReportRepository(IDbContextProvider<SettleAccountDbContext> dbContextProvider)
: base(dbContextProvider)
{ }
//public async Task<string> SettledSparePart(string purchaseOrderNo, string sapCode, string version, string customerCode, string factory, string matialCode,
//string state, DateTime begin, DateTime end)
public virtual List<SettleSparePartExport> GetSettleSparePartReportList(string purchaseOrderNo, string version, string sapCode, string matialCode,
string begintime, string endtime)
{
string sqlString = " SELECT \n" +
" * , \n" +
" (Price-InvoicePrice) as InvoiceDiffPrice, --单价差异 \n" +
" ISNULL( Price * ReceiptQty-InvoiceMoney, 0 ) AS SumDiffMoney --总金额差异 \n" +
" FROM \n" +
" ( \n" +
" SELECT \n" +
" c.Period as WMSDeliveryDate,--交货日期 \n" +
" c.WMSDeliveryNote,--交货单号 \n" +
" c.SpareDate as OrderDate,--订单日期 \n" +
" a.PurchaseOrderNo,--采购订单号 \n" +
" b.MaterialCode as SAPCode,--SAP编码,即厂内物料号 \n" +
" a.MaterialCode,--物料代码 \n" +
" b.MaterialDesc,--物料描述 \n" +
" a.PurchaseOrderNoText,--采购订单文本 \n" +
" c.ReceiptQty,-- 发货数量 \n" +
" a.InvoicedQty as InvoicedQty,--开票数量 \n" +
" (c.ReceiptQty-d.Amt) as SettleInvoiceDiffQty,--发货与开票差异 \n" +
" d.InvoicePrice,--开票单价 \n" +
" 0 as InvoiceMoney --开票金额 \n" +
" \n" +
" FROM \n" +
" Set_SparePart AS a \n" +
" LEFT JOIN Set_material AS b ON a.MaterialCode= b.CustomerPartCode \n" +
" LEFT JOIN Set_WMSSparePart c ON a.PurchaseOrderNo= c.WMSDeliveryNote \n" +
" AND a.MaterialCode= c.MaterialCode \n" +
" LEFT JOIN ( SELECT SUM ( amt ) / SUM ( Qty ) InvoicePrice, MaterialCode,Amt FROM set_invoice WHERE version = '{0}' GROUP BY materialcode,Amt ) d ON a.MaterialCode= d.MaterialCode \n" +
" ) TEMP1 \n" +
" LEFT JOIN ( SELECT Price, --定价 \n" +
" MaterialCode --厂内物料号 \n" +
" FROM Set_PriceList WHERE version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) TEMP2 ON TEMP1.SAPCode= TEMP2.MaterialCode ";
string addwhere = string.Empty;
string addSqlStr = string.Format(sqlString, version);
//if (!string.IsNullOrEmpty(purchaseOrderNo))
//{
// addwhere += string.Format(" AND PurchaseOrderNo LIKE '{0}%' ", purchaseOrderNo);
//}
//else if (!string.IsNullOrEmpty(sapCode))
//{
// addwhere += string.Format(" AND SAPCode LIKE '{0}%' ", sapCode);
//}
//else if (!string.IsNullOrEmpty(matialCode))
//{
// addwhere += string.Format(" AND MaterialCode LIKE '{0}%' ", matialCode);
//}
//else if (!string.IsNullOrEmpty(begintime)&& !string.IsNullOrEmpty(endtime))
//{
// addwhere += string.Format(" AND OrderDate BETWEEN '{0}' AND '{1}' ", begintime, endtime);
//}
string _sql = string.Format(addSqlStr, addwhere);
//string _sql = string.Format(sqlString, version);
var _query = DbConnection.Query<SettleSparePartExport>(_sql, null, null, true, 1200, null);
return _query.ToList();
}
public virtual List<SettleSparePartExport> GetSettleSparePartNoOrderList(string purchaseOrderNo, string version, string sapCode, string matialCode,
string begintime, string endtime)
{
string sqlString = " SELECT \n" +
" * , \n" +
" (Price-InvoicePrice) as InvoiceDiffPrice, --单价差异 \n" +
" ISNULL( Price * ReceiptQty-InvoiceMoney, 0 ) AS SumDiffMoney --总金额差异 \n" +
" FROM \n" +
" ( \n" +
" SELECT \n" +
" c.Period as WMSDeliveryDate,--交货日期 \n" +
" c.WMSDeliveryNote,--交货单号 \n" +
" c.SpareDate as OrderDate,--订单日期 \n" +
" a.PurchaseOrderNo,--采购订单号 \n" +
" b.MaterialCode as SAPCode,--SAP编码,即厂内物料号 \n" +
" a.MaterialCode,--物料代码 \n" +
" b.MaterialDesc,--物料描述 \n" +
" a.PurchaseOrderNoText,--采购订单文本 \n" +
" c.ReceiptQty,-- 发货数量 \n" +
" a.InvoicedQty as InvoicedQty,--开票数量 \n" +
" (c.ReceiptQty-d.Amt) as SettleInvoiceDiffQty,--发货与开票差异 \n" +
" d.InvoicePrice,--开票单价 \n" +
" 0 as InvoiceMoney --开票金额 \n" +
" \n" +
" FROM \n" +
" Set_SparePart AS a \n" +
" LEFT JOIN Set_material AS b ON a.MaterialCode= b.CustomerPartCode \n" +
" LEFT JOIN Set_WMSSparePart c ON a.PurchaseOrderNo= c.WMSDeliveryNote \n" +
" AND a.MaterialCode= c.MaterialCode \n" +
" LEFT JOIN ( SELECT SUM ( amt ) / SUM ( Qty ) InvoicePrice, MaterialCode,Amt FROM set_invoice WHERE version = '{0}' GROUP BY materialcode,Amt ) d ON a.MaterialCode= d.MaterialCode \n" +
" ) TEMP1 \n" +
" LEFT JOIN ( SELECT Price, --定价 \n" +
" MaterialCode --厂内物料号 \n" +
" FROM Set_PriceList WHERE version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) TEMP2 ON TEMP1.SAPCode= TEMP2.MaterialCode ";
string addwhere = string.Empty;
string addSqlStr = string.Format(sqlString, version);
//if (!string.IsNullOrEmpty(purchaseOrderNo))
//{
// addwhere += string.Format(" AND PurchaseOrderNo LIKE '{0}%' ", purchaseOrderNo);
//}
//else if (!string.IsNullOrEmpty(sapCode))
//{
// addwhere += string.Format(" AND SAPCode LIKE '{0}%' ", sapCode);
//}
//else if (!string.IsNullOrEmpty(matialCode))
//{
// addwhere += string.Format(" AND MaterialCode LIKE '{0}%' ", matialCode);
//}
//else if (!string.IsNullOrEmpty(begintime)&& !string.IsNullOrEmpty(endtime))
//{
// addwhere += string.Format(" AND OrderDate BETWEEN '{0}' AND '{1}' ", begintime, endtime);
//}
string _sql = string.Format(addSqlStr, addwhere);
//string _sql = string.Format(sqlString, version);
var _query = DbConnection.Query<SettleSparePartExport>(_sql, null, null, true, 1200, null);
return _query.ToList();
}
}
///// <summary>
///// 大众看板有条码报表
///// </summary>
////[ExcelExporter(Name = "未结明细", AutoFitAllColumn = true, MaxRowNumberOnASheet = 500000)]
//public class SettleSparePartExport
//{
// [ExporterHeader(DisplayName = "交货日期")]
// public string WMSDeliveryDate { set; get; }
// [ExporterHeader(DisplayName = "交货单号")]
// public string DeliveryOrderNo { set; get; }
// [ExporterHeader(DisplayName = "订单日期")]
// public DateTime OrderDate{ set; get; }
// [ExporterHeader(DisplayName = "采购订单号")]
// public string PurchaseOrderNo { set; get; }
// [ExporterHeader(DisplayName = "SAP编码")]
// public string SAPCode { set; get; }
// [ExporterHeader(DisplayName = "物料代码")]
// public string MaterialCode { set; get; }
// [ExporterHeader(DisplayName = "物料描述")]
// public string MaterialDesc { set; get; }
// [ExporterHeader(DisplayName = "采购订单文本")]
// public string PurchaseOrderNoText { set; get; }
// [ExporterHeader(DisplayName = "发货数量")]
// public decimal ReceiptQty { set; get; }
// [ExporterHeader(DisplayName = "开票数量")]
// public decimal InvoicedQty { set; get; }
// [ExporterHeader(DisplayName = "发货与开票差异")]
// public decimal SettleInvoiceDiffQty { set; get; }
// [ExporterHeader(DisplayName = "开票单价")]
// public decimal InvoicePrice { set; get; }
// [ExporterHeader(DisplayName = "开票金额")]
// public decimal InvoiceMoney { set; get; }
// [ExporterHeader(DisplayName = "定价")]
// public decimal Price { set; get; }
// [ExporterHeader(DisplayName = "单价差异")]
// public decimal InvoiceDiffPrice { set; get; }
// [ExporterHeader(DisplayName = "总金额差异")]
// public decimal SumDiffMoney { set; get; }
//}
}

8
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettledDetailDapperRepository.cs

@ -39,10 +39,10 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{
str += string.Format(" and beginTime<'{0}' ", end);
}
if (!string.IsNullOrEmpty(materialCode))
{
str += string.Format(" and ItemCode='{0}' ", materialCode);
}
//if (!string.IsNullOrEmpty(materialCode))
//{
// str += string.Format(" and ItemCode='{0}' ", materialCode);
//}
//string str2 = " ";
//if (!string.IsNullOrEmpty(sapCode))
//{

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

@ -0,0 +1,86 @@
using Dapper;
using Magicodes.ExporterAndImporter.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories.Dapper;
using Volo.Abp.EntityFrameworkCore;
using Win.Sfs.SettleAccount.Entities;
using Win.Sfs.SettleAccount.Entities.Materials;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.Reports;
namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{
public class SalesStock
{
public string SapCode { set; get; }
public decimal Qty { set; get; }
}
/// <summary>
/// 主数据Dapper表
/// </summary>
public class WmsDapperRepository : DapperRepository<WMSDbContext>, ITransientDependency
{
public WmsDapperRepository(IDbContextProvider<WMSDbContext> dbContextProvider) : base(dbContextProvider)
{
}
public virtual List<SalesStock> GetSalesStock()
{
string str = " select SUM(Qty) Qty,PartCode SapCode from TS_STOCK_DETAIL where AreaCode='SALE' group by PartCode ";
var _list = DbConnection.Query<SalesStock>(str);
return _list.ToList();
}
//public virtual Dictionary<string,decimal> GetSapList<T>(List<T> childList, string version, bool isNotHistoryPart = false) where T : ReportDetailBase, new()
//{
// return tmpList;
//}
//public virtual List<ErpPrice> GetErpPartCodePriceList(string version)
//{
// string str = "SELECT\n" +
// " ErpMaterialCode SapErpPartCode,\n" +
// " SUM( PRICE ) SapPrice \n" +
// " FROM \n" +
// " Set_MaterialRelationshipDetail A\n" +
// " LEFT JOIN ( SELECT SUM( AMT )/ SUM( Qty ) PRICE, MaterialCode FROM Set_Invoice WHERE VERSION = '{0}' GROUP BY MaterialCode ) B ON A.SettleMaterialCode = B.MaterialCode \n" +
// "GROUP BY\n" +
// " ErpMaterialCode";
// var _list = DbConnection.Query<ErpPrice>(string.Format(str, version));
// return _list.ToList();
//}
//public virtual List<InvoiceSettleDiff> GetSettleInvoiceDiff(string version)
//{
// var str = "SELECT\n" +
// " * \n" +
// " FROM\n" +
// " (\n" +
// " SELECT\n" +
// " b.MaterialCode,\n" +
// " InvocieQty-SettleQty DiffQty \n" +
// " FROM\n" +
// " ( SELECT sum( Qty ) SettleQty, MaterialCode FROM Set_Settle a WHERE version = '{0}' GROUP BY MaterialCode ) a\n" +
// " INNER JOIN ( SELECT SUM( QTY ) InvocieQty, MaterialCode FROM Set_Invoice WHERE version = '{0}' GROUP BY MaterialCode ) b ON a.MaterialCode = b.MaterialCode \n" +
// " ) temp \n" +
// " WHERE\n" +
// " temp.DiffQty <>0";
// var _list = DbConnection.Query<InvoiceSettleDiff>(string.Format(str, version));
// return _list.ToList();
//}
}
}

37
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/KanBanUnSettledExport.cs

@ -37,13 +37,8 @@ namespace SettleAccount.Job.Services.Report
{
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 begin = p_list.Where(p => p.Name == "BeginTime").FirstOrDefault().Value;
var end = p_list.Where(p => p.Name == "EndTime").FirstOrDefault().Value;
var cp7begin = p_list.Where(p => p.Name == "Cp7BeginTime").FirstOrDefault().Value;
var cp7end = p_list.Where(p => p.Name == "Cp7EndTime").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 materialGroup = p_list.Where(p => p.Name == "MaterialGroup").FirstOrDefault().Value;
var sapCode = p_list.Where(p => p.Name == "SapCode").FirstOrDefault().Value;
var _ls = _dapper.GetKanbanReportList(version, begin,end);
@ -55,15 +50,15 @@ namespace SettleAccount.Job.Services.Report
{
_ls = _ls.Where(p => _groupList.Contains(p.MaterialGroup)).ToList();
}
}
if (!string.IsNullOrEmpty(materialCode))
{
var _groupList = materialCode.Split(new char[] { '\n' }).Distinct().ToList();
if (_groupList.Count() > 0)
{
_ls = _ls.Where(p => _groupList.Contains(p.CustomerPartCode)).ToList();
}
}
//if (!string.IsNullOrEmpty(materialCode))
//{
// var _groupList = materialCode.Split(new char[] { '\n' }).Distinct().ToList();
// if (_groupList.Count() > 0)
// {
// _ls = _ls.Where(p => _groupList.Contains(p.CustomerPartCode)).ToList();
// }
//}
if (!string.IsNullOrEmpty(sapCode))
{
var _groupList = sapCode.Split(new char[] { '\n' }).Distinct().ToList();
@ -80,14 +75,14 @@ namespace SettleAccount.Job.Services.Report
_lst = _lst.Where(p => _groupList.Contains(p.MaterialGroup)).ToList();
}
}
if (!string.IsNullOrEmpty(materialCode))
{
var _groupList = materialCode.Split(new char[] { '\n' }).Distinct().ToList();
if (_groupList.Count() > 0)
{
_lst = _lst.Where(p => _groupList.Contains(p.MaterialCode)).ToList();
}
}
//if (!string.IsNullOrEmpty(materialCode))
//{
// var _groupList = materialCode.Split(new char[] { '\n' }).Distinct().ToList();
// if (_groupList.Count() > 0)
// {
// _lst = _lst.Where(p => _groupList.Contains(p.MaterialCode)).ToList();
// }
//}
if (!string.IsNullOrEmpty(sapCode))
{
var _groupList = sapCode.Split(new char[] { '\n' }).Distinct().ToList();

8
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnsettledDetailReport.cs

@ -93,6 +93,14 @@ namespace SettleAccount.Job.Services.Report
_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();
}
}
_list = _list.OrderBy(p => p.ChassisNumber).ThenBy(p => p.SapMaterialCode).ThenBy(p => p.Flag).ToList();
_outputService.Export<UnSettleDetailReport>(id, _first, _list);
return id.ToString();

Loading…
Cancel
Save