Browse Source

更新版本

FoShanPG
Administrator 3 years ago
parent
commit
1c63f84de6
  1. 139
      src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/TaskListDto.cs
  2. 24
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/VWSparePart/SparePartAppService.cs
  3. 30
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePartAppService.cs
  4. 4
      src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs
  5. 11
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/VWSparePart/SparePart.cs
  6. 4
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQFactorySettledDetailDapperRepository.cs
  7. 3
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs
  8. 16
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/KanbanUnSettledDapperRepository.cs
  9. 2
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleKBWithCodeDapperReportRepository.cs
  10. 125
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePart90DapperReportRepository.cs
  11. 1284
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs
  12. 1
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHSharePartSettledDetailDiffExportService.cs
  13. 2
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleSparePart90ExportService.cs
  14. 59
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleSparePartExportService.cs

139
src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/TaskListDto.cs

@ -1,6 +1,7 @@
using Magicodes.ExporterAndImporter.Core;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -22,9 +23,9 @@ namespace Win.Sfs.SettleAccount.Entities
[ExporterHeader(DisplayName = "入库库位")]
//入库库位
public string InPut { set; get; }
[ImporterHeader(Name = "状态")]
[ExporterHeader(DisplayName = "状态")]
public int State { get; set; }
//[ImporterHeader(Name = "状态")]
//[ExporterHeader(DisplayName = "状态")]
//public int State { get; set; }
[ImporterHeader(Name = "开票单价")]
[ExporterHeader(DisplayName = "开票单价")]
@ -79,6 +80,15 @@ namespace Win.Sfs.SettleAccount.Entities
[ImporterHeader(Name = "结算数量")]
public decimal Qty { set; get; }
[ExporterHeader(DisplayName = "状态")]
[ValueMapping("未处理", 0)]
[ValueMapping("申请出库", 1)]
[ValueMapping("确认出库", 2)]
[ValueMapping("不能出库", 3)]
[ValueMapping("取消出库", 4)]
public ExporterStatus State { set; get; }
}
@ -120,9 +130,16 @@ namespace Win.Sfs.SettleAccount.Entities
[ImporterHeader(Name = "入库库位", IsIgnore = true)]
//入库库位
public string InPut { set; get; }
[ExporterHeader(DisplayName = "状态")]
[ImporterHeader(Name = "状态", IsIgnore = true)]
public int State { get; set; }
[ValueMapping("未处理", 0)]
[ValueMapping("申请出库", 1)]
[ValueMapping("确认出库", 2)]
[ValueMapping("不能出库", 3)]
[ValueMapping("取消出库", 4)]
public ExporterStatus State { set; get; }
[ExporterHeader(DisplayName = "客户物料")]
[ImporterHeader(Name = "客户物料")]
/// <summary>
@ -201,9 +218,15 @@ namespace Win.Sfs.SettleAccount.Entities
[ImporterHeader(Name = "BillNum", IsIgnore = true)]
[ExporterHeader(DisplayName = "BillNum", IsIgnore = true)]
public string BillNum { set; get; }
[ImporterHeader(Name = "状态", IsIgnore = true)]
[ExporterHeader(DisplayName = "状态")]
public int State { set; get; }
[ValueMapping("未处理", 0)]
[ValueMapping("申请出库", 1)]
[ValueMapping("确认出库", 2)]
[ValueMapping("不能出库", 3)]
[ValueMapping("取消出库", 4)]
public ExporterStatus State { set; get; }
[ImporterHeader(Name = "开票单价")]
[ExporterHeader(DisplayName = "开票单价")]
@ -243,8 +266,16 @@ namespace Win.Sfs.SettleAccount.Entities
[ExporterHeader(DisplayName = "入库库位", IsIgnore = true)]
//入库库位
public string InPut { set; get; }
[ExporterHeader(DisplayName = "状态", IsIgnore = true)]
public int State { get; set; }
[ExporterHeader(DisplayName = "状态")]
[ValueMapping("未处理", 0)]
[ValueMapping("申请出库", 1)]
[ValueMapping("确认出库", 2)]
[ValueMapping("不能出库", 3)]
[ValueMapping("取消出库", 4)]
public ExporterStatus State { set; get; }
[ExporterHeader(DisplayName = "物料代码")]
/// <summary>
/// 扩展字段1
@ -329,9 +360,16 @@ namespace Win.Sfs.SettleAccount.Entities
[ExporterHeader(DisplayName = "入库库位", IsIgnore = true)]
//入库库位
public string InPut { set; get; }
[ImporterHeader(Name = "状态", IsIgnore = true)]
[ExporterHeader(DisplayName = "状态", IsIgnore = true)]
public int State { get; set; }
[ExporterHeader(DisplayName = "状态")]
[ValueMapping("未处理", 0)]
[ValueMapping("申请出库", 1)]
[ValueMapping("确认出库", 2)]
[ValueMapping("不能出库", 3)]
[ValueMapping("取消出库", 4)]
public ExporterStatus State { set; get; }
[ImporterHeader(Name = "物料代码")]
[ExporterHeader(DisplayName = "物料代码")]
/// <summary>
@ -414,9 +452,16 @@ namespace Win.Sfs.SettleAccount.Entities
[ImporterHeader(Name = "BillNum", IsIgnore = true)]
[ExporterHeader(DisplayName = "BillNum", IsIgnore = true)]
public string BillNum { set; get; }
[ImporterHeader(Name = "状态", IsIgnore = true)]
[ExporterHeader(DisplayName = "状态", IsIgnore = true)]
public int State { set; get; }
[ExporterHeader(DisplayName = "状态")]
[ValueMapping("未处理", 0)]
[ValueMapping("申请出库", 1)]
[ValueMapping("确认出库", 2)]
[ValueMapping("不能出库", 3)]
[ValueMapping("取消出库", 4)]
public ExporterStatus State { set; get; }
[ImporterHeader(Name = "开票单价")]
[ExporterHeader(DisplayName = "开票单价")]
@ -424,7 +469,6 @@ namespace Win.Sfs.SettleAccount.Entities
[ImporterHeader(Name = "开票金额")]
[ExporterHeader(DisplayName = "开票金额")]
public decimal Amt { set; get; }
}
@ -468,9 +512,16 @@ namespace Win.Sfs.SettleAccount.Entities
[ImporterHeader(Name = "BillNum", IsIgnore = true)]
[ExporterHeader(DisplayName = "BillNum", IsIgnore = true)]
public string BillNum { set; get; }
[ImporterHeader(Name = "状态", IsIgnore = true)]
[ExporterHeader(DisplayName = "状态", IsIgnore = true)]
public int State { set; get; }
[ExporterHeader(DisplayName = "状态")]
[ValueMapping("未处理", 0)]
[ValueMapping("申请出库", 1)]
[ValueMapping("确认出库", 2)]
[ValueMapping("不能出库", 3)]
[ValueMapping("取消出库", 4)]
public ExporterStatus State { set; get; }
[ImporterHeader(Name = "开票单价")]
[ExporterHeader(DisplayName = "开票单价")]
@ -529,9 +580,16 @@ namespace Win.Sfs.SettleAccount.Entities
[ExporterHeader(DisplayName = "入库库位", IsIgnore = true)]
//入库库位
public string InPut { set; get; }
[ImporterHeader(Name = "状态", IsIgnore = true)]
[ExporterHeader(DisplayName = "状态", IsIgnore = true)]
public int State { get; set; }
[ExporterHeader(DisplayName = "状态")]
[ValueMapping("未处理", 0)]
[ValueMapping("申请出库", 1)]
[ValueMapping("确认出库", 2)]
[ValueMapping("不能出库", 3)]
[ValueMapping("取消出库", 4)]
public ExporterStatus State { set; get; }
[ImporterHeader(Name = "结算物料号")]
[ExporterHeader(DisplayName = "结算物料号")]
/// <summary>
@ -573,6 +631,43 @@ namespace Win.Sfs.SettleAccount.Entities
}
/// <summary>
/// 学生状态 正常、流失、休学、勤工俭学、顶岗实习、毕业、参军
/// </summary>
public enum ExporterStatus
{
/// <summary>
/// 未处理
/// </summary>
[Display(Name = "未处理")]
Normal = 0,
/// <summary>
/// 申请出库
/// </summary>
[Display(Name = "申请出库")]
PupilsAway = 1,
/// <summary>
/// 确认出库
/// </summary>
[Display(Name = "确认出库")]
Suspension = 2,
/// <summary>
/// 不能出库
/// </summary>
[Display(Name = "不能出库")]
WorkStudy = 3,
/// <summary>
/// 取消出库
/// </summary>
[Display(Name = "取消出库")]
PostPractice = 4,
}
}

24
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/VWSparePart/SparePartAppService.cs

@ -63,7 +63,7 @@ namespace Win.Sfs.SettleAccount.Entities.VWSparePart
/// <summary>
/// 导入功能
/// 大众备件明细数据导入功能(以后正常使用的功能),包含导入有空的订单号
/// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns>
@ -101,7 +101,17 @@ namespace Win.Sfs.SettleAccount.Entities.VWSparePart
_bomList.Add(new SparePartVersion(_id, branchId, year, period, version, customerCode));
foreach (var itm in entityList)
{
itm.SetValue(GuidGenerator.Create(), branchId, year, period, version, "not90");
if (string.IsNullOrEmpty(itm.PurchaseOrderNo))
{
//订单号不空
itm.SetValue(GuidGenerator.Create(), branchId, year, period, version, "not90", "NoOrder");
}
else
{
//赋值上主键ID
itm.SetValue(GuidGenerator.Create(), branchId, year, period, version, "not90");
}
}
if (checkList.Count > 0)
{
@ -112,6 +122,16 @@ namespace Win.Sfs.SettleAccount.Entities.VWSparePart
return ApplicationConsts.SuccessStr;
}
/// <summary>
/// 大众备件调整导入(财务期初时用的功能),订单号+物料号能一对一匹配
/// </summary>
/// <param name="files"></param>
/// <param name="branchId"></param>
/// <param name="year"></param>
/// <param name="period"></param>
/// <param name="version"></param>
/// <param name="customerCode"></param>
/// <returns></returns>
[HttpPost]
[Route("ExcelImport90")]
[DisableRequestSizeLimit]

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

@ -245,8 +245,8 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
if (_joblist.Count() > 0)
{
var fileList = _joblist.Select(p => p.RealDownFileName).ToList();
List<WmsSharePartOutPutDetial> _lst = new List<WmsSharePartOutPutDetial>();
List<WmsSharePart90OutPutDetial> _lstBill = new List<WmsSharePart90OutPutDetial>();
List<WmsSharePartOutPutDetial> _lst = new List<WmsSharePartOutPutDetial>();//无订单
List<WmsSharePart90OutPutDetial> _lstBill = new List<WmsSharePart90OutPutDetial>();//有订单
foreach (var filename in fileList)
{
string fileSavePath = Environment.CurrentDirectory + @"\wwwroot\files\host\my-file-container\" + filename;
@ -256,9 +256,9 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
var _list90Summary = _excelHelper.ExcelToListOne<WmsSharePart90OutPutDetial>();//有单号
var _list = _listSummary.Where(p => p.OrderBillNum == "").ToList();//过滤 没有采购订单号为空的集合
var _listBill = _list90Summary.Where(p => p.OrderBillNum != "").ToList();//过滤 有采购订单号的集合
//NoOrder用来标识采购订单号为空的数据
var _list = _listSummary.Where(p => p.OrderBillNum == "NoOrder").ToList();//有采购订单号的集合
var _listBill = _list90Summary.Where(p => !string.IsNullOrEmpty(p.OrderBillNum) && p.OrderBillNum != "NoOrder").ToList();//有采购订单号的集合
//var _list = _excelHelper.ExcelToList<WmsSharePartOutPutDetial>();
@ -328,7 +328,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
if (_lst != null && _lst.Count>0)
{
//没有采购订单号
var outPutDetail = await _wmsRepository.Where(p => p.Version == input.Version && p.OrderBillNum == "").ToListAsync();
var outPutDetail = await _wmsRepository.Where(p => p.Version == input.Version && string.IsNullOrEmpty(p.OrderBillNum)).ToListAsync();
var error = from itm1 in outPutDetail
join itm2 in _lst on
@ -412,7 +412,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
if (_lstBill != null && _lstBill.Count>0)
{
//有采购订单号
var outPutDetailBill = await _wmsRepository90.Where(p => p.Version == input.Version && p.OrderBillNum != "").ToListAsync();
var outPutDetailBill = await _wmsRepository90.Where(p => p.Version == input.Version && !string.IsNullOrEmpty(p.OrderBillNum)).ToListAsync();
var error = from itm1 in outPutDetailBill
join itm2 in _lstBill on
@ -631,7 +631,12 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
return true;
}
/// <summary>
/// 出库单导入功能
/// </summary>
/// <param name="files"></param>
/// <param name="version"></param>
/// <returns></returns>
[HttpPost]
[Route("ExcelImport")]
[DisableRequestSizeLimit]
@ -666,8 +671,8 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
var result90 = await _exportImporter.ExtendExcelOfSheetOneImport<WmsSharePart90OutPutDetial>(files, _excelImportService);
var result_nobill = result.Where(p => p.OrderBillNum == "").ToList();
var result_withbill = result90.Where(p => p.OrderBillNum != "").ToList();
var result_nobill = result.Where(p =>string.IsNullOrEmpty(p.OrderBillNum)).ToList();//没有采购单号集合
var result_withbill = result90.Where(p =>!string.IsNullOrEmpty(p.OrderBillNum)).ToList();//有采购单号集合
//没有采购单号
@ -677,7 +682,8 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
List<WmsSharePartOutPutDetial> _lst = new List<WmsSharePartOutPutDetial>();
var _lsCopy = new List<WmsSharePartOutPutDetial>();
foreach (var itm in result_nobill)
var result_nobill_filter = result_nobill.Where(p => string.IsNullOrEmpty(p.OrderBillNum) && !string.IsNullOrEmpty(p.MaterialCode));
foreach (var itm in result_nobill_filter)
{
WmsSharePartOutPutDetial _detail = new WmsSharePartOutPutDetial(
GuidGenerator.Create(),
@ -772,7 +778,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
List<WmsSharePart90OutPutDetial> _lst = new List<WmsSharePart90OutPutDetial>();
var _lsCopy = new List<WmsSharePart90OutPutDetial>();
var filte_result_withbill = result_withbill.Where(p => p.OrderBillNum != "");//采购单号为空的过滤掉
var filte_result_withbill = result_withbill.Where(p =>!string.IsNullOrEmpty(p.OrderBillNum));//采购单号为空的过滤掉
foreach (var itm in filte_result_withbill)
{
WmsSharePart90OutPutDetial _detail = new WmsSharePart90OutPutDetial(

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

@ -176,7 +176,7 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
#region 大众备件0-90天和90天以上输出
/// <summary>
/// 大众备件0-90天报表输出
/// 大众备件数据调整结算输出
/// </summary>
/// <param name="purchaseOrderNo"></param>
/// <param name="sapCode"></param>
@ -215,7 +215,7 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
}
/// <summary>
/// 大众备件结算核对明细表
/// 大众备件输出(包括带订货单号和无订单号)
/// </summary>
/// <param name="purchaseOrderNo">采购订单号</param>
/// <param name="sapCode">厂内物料号</param>

11
src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/VWSparePart/SparePart.cs

@ -25,6 +25,17 @@ namespace Win.Sfs.SettleAccount.Entities.VWSparePart
BranchId = branchId;
Extend = extend;
}
public void SetValue(Guid guid, Guid branchId, string year, string peroid, string version, string extend,string purchaseOrderNo)
{
Period = peroid;
Year = year;
Id = guid;
Version = version;
BranchId = branchId;
Extend = extend;
PurchaseOrderNo = purchaseOrderNo;
}
public SparePart(Guid Id, string year, string period, string version, string lineNumber,
string purchaseType,string purchaseOrderNo, string purchaseOrderNoItem, string purchaseOrderNoText,
decimal receiptQty, decimal invoicedQty, decimal amountNoTax, decimal purchasePriceNoTax,

4
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQFactorySettledDetailDapperRepository.cs

@ -179,7 +179,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" AND temp1.订货看板编号 = tt.Code \n" +
" ) UNION2 \n" +
" ) AS temp1 ON unhq.HQHKanBan = temp1.[订货看板编号] \n" +
" AND unhq.CustomerPartCode= temp1.客户物料号 \n" +
" AND unhq.CustomerPartCode= temp1.客户物料号 WHERE temp1.[订货看板编号] is null and temp1.客户物料号 is null \n" +
" ) temp3\n" +
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp3.MaterialCode = TEMP2.MaterialCode";
@ -492,7 +492,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
/// <summary>
/// 红旗系统未对比对红旗主机厂未结
/// 红旗系统未对比对红旗主机厂未结,其中红旗系统未结数据中还包括有发货有结算中发货数量大于结算的也要整合到未结当中
/// </summary>
/// <param name="version"></param>
/// <param name="materialCode"></param>

3
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs

@ -57,8 +57,6 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
List<HQHSettledDetailDiff> _list = new List<HQHSettledDetailDiff>();
//string condition = " ";
//if (!string.IsNullOrEmpty(begin))
@ -70,7 +68,6 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
// condition += string.Format(" and b.LastModificationTime<='{0}' ", end);
//}
string str = "SELECT\n" +
" isnull( temp1.交货单号, '' ) 交货单号,\n" +

16
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/KanbanUnSettledDapperRepository.cs

@ -189,10 +189,10 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" ( ISNULL( a.WMSDeliveryQty, 0 ) - ISNULL( b.Qty, 0 ) - isnull( tt.qty, 0 ) ) AS DiffQty \n" +
" FROM\n" +
" ( SELECT SUM ( WMSDeliveryQty ) WMSDeliveryQty, MaterialCode, Kanban FROM Set_WMSKanBanSettle GROUP BY MaterialCode, Kanban ) A\n" +
" LEFT JOIN ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_KanBanSettle {1} GROUP BY Kanban, MaterialCode ) B ON A.Kanban = B.Kanban \n" +
" LEFT JOIN ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_KanBanSettle {0} GROUP BY Kanban, MaterialCode ) B ON A.Kanban = B.Kanban \n" +
" AND A.MaterialCode = B.MaterialCode\n" +
" LEFT JOIN Set_material AS C ON a.MaterialCode = C.CustomerPartCode\n" +
" LEFT JOIN ( SELECT * FROM set_backQty WHERE Version = '{0}' ) AS tt ON a.Kanban = tt.Code \n" +
" LEFT JOIN ( SELECT * FROM set_backQty ) AS tt ON a.Kanban = tt.Code \n" +
" AND a.MaterialCode = tt.MaterialCode \n" +
" WHERE\n" +
" B.Kanban IS NULL \n" +
@ -224,10 +224,10 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" ( ISNULL( a.WMSDeliveryQty, 0 ) - ISNULL( b.Qty, 0 ) - isnull( tt.qty, 0 ) ) AS DiffQty \n" +
" FROM\n" +
" ( SELECT SUM ( WMSDeliveryQty ) WMSDeliveryQty, MaterialCode, Kanban FROM Set_WMSKanBanSettle GROUP BY MaterialCode, Kanban ) A\n" +
" INNER JOIN ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_KanBanSettle {1} GROUP BY Kanban, MaterialCode ) B ON A.Kanban = B.Kanban \n" +
" INNER JOIN ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_KanBanSettle {0} GROUP BY Kanban, MaterialCode ) B ON A.Kanban = B.Kanban \n" +
" AND A.MaterialCode = B.MaterialCode\n" +
" LEFT JOIN Set_material AS C ON a.MaterialCode = C.CustomerPartCode\n" +
" LEFT JOIN ( SELECT * FROM set_backQty WHERE Version = '{0}' ) AS tt ON a.Kanban = tt.Code \n" +
" LEFT JOIN ( SELECT * FROM set_backQty ) AS tt ON a.Kanban = tt.Code \n" +
" AND a.MaterialCode = tt.MaterialCode \n" +
" WHERE\n" +
" a.WMSDeliveryQty> B.Qty \n" +
@ -237,7 +237,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
sql = string.Format(sql, version, contion);
sql = string.Format(sql,contion);
//发运数据中,查出看板号+物料号相同的重复数据
@ -385,7 +385,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" AND A.MaterialCode = B.MaterialCode\n" +
" LEFT JOIN Set_material AS C ON a.MaterialCode = C.CustomerPartCode \n" +
" left join set_backQty as tt on a.Kanban = tt.Code and a.MaterialCode = b.MaterialCode and a.version='" + version + "'\n" +
" left join set_backQty as tt on a.Kanban = tt.Code and a.MaterialCode = b.MaterialCode \n" +
" WHERE\n" +
" B.Kanban IS NULL \n" +
" AND B.MaterialCode IS NULL {0}\n" +
@ -456,7 +456,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" INNER JOIN ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_KanBanSettle {1} GROUP BY Kanban, MaterialCode ) B ON A.Kanban = B.Kanban\n" +
" AND A.MaterialCode = B.MaterialCode\n" +
" LEFT JOIN Set_material AS C ON a.MaterialCode = C.CustomerPartCode\n" +
" LEFT JOIN ( SELECT * FROM set_backQty WHERE Version = '{2}' ) AS tt ON a.Kanban = tt.Code \n" +
" LEFT JOIN ( SELECT * FROM set_backQty ) AS tt ON a.Kanban = tt.Code \n" +
" AND a.MaterialCode = b.MaterialCode \n" +
" WHERE\n" +
" a.WMSDeliveryQty> B.Qty {0}\n" +
@ -465,7 +465,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
sql = string.Format(sql, str, contion,version);
sql = string.Format(sql, str, contion);
var _query = DbConnection.Query<KanbanUnSettled>(sql, null, null, true, 1200, null);
var _list = _query.ToList();
return _list;

2
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleKBWithCodeDapperReportRepository.cs

@ -87,7 +87,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" (\n" +
" ( SELECT SUM ( WMSDeliveryQty ) Qty, KanBan, MaterialCode FROM Set_WMSKanBanSettle GROUP BY KanBan, MaterialCode ) temp1\n" +
" LEFT JOIN ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_KanBanSettle WHERE VERSION < '{0}' GROUP BY kanban, MaterialCode ) temp2 ON temp1.Kanban = temp2.KanBan \n" +
" AND temp1.MaterialCode = temp2.KanBan \n" +
" AND temp1.MaterialCode = temp2.MaterialCode \n" +
" ) \n" +
" ) C ON A.Kanban = C.Kanban \n" +
" AND A.MaterialCode = C.MaterialCode\n" +

125
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePart90DapperReportRepository.cs

@ -12,7 +12,7 @@ using Volo.Abp.EntityFrameworkCore;
namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{
/// <summary>
/// 根据虚拟单号0-90天的是按照SAP物料号进行先进先出操作
/// 大众备件明细输出,
/// </summary>
public class SettleSparePart90DapperReportRepository : DapperRepository<SettleAccountDbContext>, ITransientDependency
{
@ -21,7 +21,113 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{ }
/// <summary>
/// 大众备件数据调整:期初没有WMS发运数据,调整的数据就是给WMS一份,给结算一份
/// </summary>
/// <param name="purchaseOrderNo"></param>
/// <param name="version"></param>
/// <param name="sapCode"></param>
/// <param name="matialCode"></param>
/// <param name="begintime"></param>
/// <param name="endtime"></param>
/// <returns></returns>
public virtual List<SettleSparePart90Export> GetSettleSparePart90ReportList(string purchaseOrderNo, string version, string sapCode, string matialCode,
string begintime, string endtime)
{
string sqlString = "SELECT\n" +
" temp1.交货日期,\n" +
" temp1.交货单号,\n" +
" '' 订单日期,\n" +
" temp1.采购订单号,\n" +
" temp1.SAP编码,\n" +
" temp1.物料代码,\n" +
" temp1.物料描述,\n" +
" temp1.采购订单文本,\n" +
" temp1.发货数量,\n" +
" temp1.开票数量,\n" +
" ISNULL( temp1.发货数量, 0 ) - ISNULL( temp1.开票数量, 0 ) AS 发货与开票差异,\n" +
" temp1.开票单价,\n" +
" ISNULL( temp1.开票金额, 0 ) AS 开票金额,\n" +
" ISNULL( TEMP2.Price, 0 ) AS 定价,\n" +
" temp1.开票单价 - ISNULL( TEMP2.Price, 0 ) AS 单价差异 ,\n" +
" ( temp1.开票单价 - ISNULL( TEMP2.Price, 0 ) ) * temp1.开票数量 AS 差异总金额 \n" +
"FROM\n" +
" (\n" +
" SELECT\n" +
" a.Version AS 期间,\n" +
" a.PurchaseOrderNoText AS 采购订单文本,\n" +
" b.WMSDeliveryNote AS 交货单号,\n" +
" b.SpareDate AS 交货日期,\n" +
" a.PurchaseOrderNo AS 采购订单号,\n" +
" c.MaterialCode AS SAP编码,\n" +
" b.MaterialCode AS 物料代码,\n" +
" c.MaterialDesc AS 物料描述,\n" +
" c.EstimateTypeDesc AS 物料组,\n" +
" a.PurchasePriceNoTax AS 开票单价,\n" +
" 0 AS 数量差异,\n" +
" ISNULL( b.ReceiptQty, 0 ) AS 发货数量,\n" +
" ISNULL( a.InvoicedQty, 0 ) AS 开票数量 ,\n" +
" ISNULL( a.AmountNoTax, 0 ) AS 开票金额 \n" +
" FROM\n" +
" (\n" +
" SELECT SUM\n" +
" ( ReceiptQty ) AS ReceiptQty,\n" +
" PurchaseOrderNo,\n" +
" MaterialCode,\n" +
" Version,\n" +
" PurchasePriceNoTax,\n" +
" InvoicedQty,\n" +
" PurchaseOrderNoText,\n" +
" AmountNoTax \n" +
" FROM\n" +
" Set_SparePart where Extend='is90' \n" +
" GROUP BY\n" +
" PurchaseOrderNo,\n" +
" MaterialCode,\n" +
" Version,\n" +
" PurchasePriceNoTax,\n" +
" InvoicedQty,\n" +
" PurchaseOrderNoText,\n" +
" AmountNoTax \n" +
" ) AS a\n" +
" INNER JOIN (\n" +
" SELECT SUM\n" +
" ( ReceiptQty ) AS ReceiptQty,\n" +
" PurchaseOrderNo,\n" +
" SapCode,\n" +
" MaterialCode,\n" +
" WMSDeliveryNote,\n" +
" SpareDate \n" +
" FROM\n" +
" Set_WMSSparePart \n" +
" GROUP BY\n" +
" PurchaseOrderNo,\n" +
" SapCode,\n" +
" MaterialCode,\n" +
" WMSDeliveryNote,\n" +
" SpareDate \n" +
" ) AS b ON a.PurchaseOrderNo = b.PurchaseOrderNo \n" +
" AND a.MaterialCode = b.MaterialCode\n" +
" LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
" WHERE\n" +
" ( a.Version = '{0}' ) \n" +
" ) AS temp1\n" +
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode \n" +
"ORDER BY\n" +
" temp1.采购订单号";
string addwhere = string.Empty;
string addSqlStr = string.Format(sqlString, version);
string _sql = string.Format(addSqlStr, addwhere);
//string _sql = string.Format(sqlString, version);
var _query = DbConnection.Query<SettleSparePart90Export>(_sql, null, null, true, 1200, null);
return _query.ToList();
}
public virtual List<SettleSparePart90Export> GetSettleSparePart90ReportList_old(string purchaseOrderNo, string version, string sapCode, string matialCode,
string begintime, string endtime)
{
string sqlString = "SELECT\n" +
@ -70,7 +176,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" PurchaseOrderNoText,\n" +
" AmountNoTax \n" +
" FROM\n" +
" Set_SparePart \n" +
" Set_SparePart where Extend='is90' \n" +
" GROUP BY\n" +
" PurchaseOrderNo,\n" +
" MaterialCode,\n" +
@ -116,7 +222,16 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
}
/// <summary>
/// 大众备件未结明细
/// </summary>
/// <param name="purchaseOrderNo"></param>
/// <param name="version"></param>
/// <param name="sapCode"></param>
/// <param name="matialCode"></param>
/// <param name="begintime"></param>
/// <param name="endtime"></param>
/// <returns></returns>
public virtual List<SettleSparePart90Export> GetUnSettleSparePart90ReportList(string purchaseOrderNo, string version, string sapCode, string matialCode,
string begintime, string endtime)
{
@ -156,7 +271,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" ISNULL( b.AmountNoTax, 0 ) AS 开票金额 \n" +
" FROM\n" +
" Set_WMSSparePart a\n" +
" LEFT JOIN ( SELECT PurchaseOrderNo, Version, PurchaseOrderNoText, PurchasePriceNoTax, InvoicedQty, AmountNoTax FROM Set_SparePart WHERE Version = '{0}' ) b ON a.PurchaseOrderNo = b.PurchaseOrderNo\n" +
" LEFT JOIN ( SELECT PurchaseOrderNo, Version, PurchaseOrderNoText, PurchasePriceNoTax, InvoicedQty, AmountNoTax FROM Set_SparePart WHERE Version = '{0}' and Extend='is90' ) b ON a.PurchaseOrderNo = b.PurchaseOrderNo\n" +
" LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
" WHERE\n" +
" b.PurchaseOrderNo IS NULL \n" +
@ -183,7 +298,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
// " a.PurchaseOrderNo 订单号,\n" +
// " a.MaterialCode 物料号 \n" +
// "FROM\n" +
// " ( SELECT SUM ( ReceiptQty ) ReceiptQty, PurchaseOrderNo, MaterialCode FROM Set_SparePart WHERE Version = '{0}' GROUP BY PurchaseOrderNo, MaterialCode ) A\n" +
// " ( SELECT SUM ( ReceiptQty ) ReceiptQty, PurchaseOrderNo, MaterialCode FROM Set_SparePart WHERE Version = '{0}' and Extend='is90' GROUP BY PurchaseOrderNo, MaterialCode ) A\n" +
// " LEFT JOIN ( SELECT SUM ( ReceiptQty ) ReceiptQty, PurchaseOrderNo, MaterialCode FROM Set_WMSSparePart GROUP BY PurchaseOrderNo, MaterialCode ) B ON A.MaterialCode = B.MaterialCode \n" +
// " AND A.PurchaseOrderNo = B.PurchaseOrderNo \n" +
// "WHERE\n" +

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

File diff suppressed because it is too large

1
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHSharePartSettledDetailDiffExportService.cs

@ -59,6 +59,7 @@ namespace SettleAccount.Job.Services.Report
var sapCode = p_list.Where(p => p.Name == "SapCode").FirstOrDefault().Value;
var warehouseDesc = p_list.Where(p => p.Name == "WarehouseDesc").FirstOrDefault().Value;
//备件明细数据
var _ls = _dapperRepository.GetSharePartSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup);
//求和汇总

2
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleSparePart90ExportService.cs

@ -97,7 +97,7 @@ namespace SettleAccount.Job.Services.Report
ExcelExporter _exporter = new ExcelExporter();//导出Excel
var result = _exporter.Append(_ls.ToList(), "大众备件数据调整")
var result = _exporter.Append(_ls.ToList(), "大众备件数据调整输出")
.SeparateBySheet()
.Append(_unls.ToList(), "有发货无结算")
.ExportAppendDataAsByteArray();

59
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleSparePartExportService.cs

@ -44,18 +44,45 @@ namespace SettleAccount.Job.Services.Report
var matialCode = p_list.Where(p => p.Name == "MatialCode").FirstOrDefault().Value;
var beginTime = p_list.Where(p => p.Name == "BegingTime").FirstOrDefault().Value;
var endTime = p_list.Where(p => p.Name == "EndTime").FirstOrDefault().Value;
//var iscontionversion = p_list.Where(p => p.Name == "IsContainVersion").FirstOrDefault().Value;
//汇总
//大众备件明细输出
var _ls = _dapper.GetSettleSparePartReportList(purchaseOrderNo, version, sapCode, matialCode, beginTime, endTime);
//正向对比,有结算无发货
var _forwardls = _dapper.GetForwardSettleSparePartReportList(purchaseOrderNo, version, sapCode, matialCode, beginTime, endTime);
//正向对比,即有结算无发货,针对有单号备件,订单号+物料号明细
var _forwardls_withcode = _dapper.GetWithCodeSettleSparePartReportList(purchaseOrderNo, version, sapCode, matialCode, beginTime, endTime);
//反向对比,即大众备件未结(有单号),包含有发货有结算并且发货数量大于结算数量的数据也整合到未结中
var _reversels_withcode = _dapper.GetReverseWithCodeSettleSparePartReportList(purchaseOrderNo, version, sapCode, matialCode, beginTime, endTime);
//反向对比,有发货无结算
var _reversels = _dapper.GetReverseSettleSparePartReportList(purchaseOrderNo, version, sapCode, matialCode, beginTime, endTime);
//按照零件号汇总数量,有一列显示寄售库数量
var stockList = _wmsDapper.GetSalesStock();
//针对无单号备件,求和汇总显示
var _forwardls_nocode = _dapper.GetNoCodeSettleSparePartReportList(purchaseOrderNo, version, sapCode, matialCode, beginTime, endTime);
var queryStockList_nocode = from itm in _forwardls_nocode
join itm1 in stockList on itm.SAP编码 equals itm1.SapCode into temp1
from tm1 in temp1.DefaultIfEmpty()
select new SettleSparePartExport(
itm.SAP编码,
itm.,
itm.,
itm.,
itm.,
itm.,
itm.,
itm.,
itm.,
itm.,
itm.,
itm.,
tm1 == null ? 0 : tm1.Qty
);
//不管有单号备件还是无单号备件,财务要求全部按照零件汇总求和显示,并和寄售库存比对
var _forwardls = _dapper.GetForwardSettleSparePartReportList(purchaseOrderNo, version, sapCode, matialCode, beginTime, endTime);
//按照零件号汇总数量,有一列显示寄售库数量
var queryStockList = from itm in _forwardls
join itm1 in stockList on itm.SAP编码 equals itm1.SapCode into temp1
from tm1 in temp1.DefaultIfEmpty()
@ -63,9 +90,17 @@ namespace SettleAccount.Job.Services.Report
itm.SAP编码,
itm.,
itm.,
itm.,
itm.,
itm.,
itm.,
itm.,
itm.,
itm.,
itm.,
itm.,
tm1 == null ? 0 : tm1.Qty
);
);
@ -126,11 +161,13 @@ namespace SettleAccount.Job.Services.Report
ExcelExporter _exporter = new ExcelExporter();//导出Excel
var result = _exporter.Append(_ls.ToList(), "大众备件数据输出")
.SeparateBySheet()
.Append(_forwardls.ToList(), "有结算无发货对比")
var result = _exporter.Append(_ls.ToList(), "大众备件明细数据")
.SeparateBySheet()
.Append(_reversels.ToList(), "有发货无结算对比")
.Append(_forwardls_withcode.ToList(), "有结算无发货对比")
.SeparateBySheet()
.Append(_reversels_withcode.ToList(), "大众备件未结(包含发货数量大于结算数据)")
.SeparateBySheet()
.Append(queryStockList_nocode.ToList(), "大众备件无单号汇总")
.SeparateBySheet()
.Append(queryStockList.ToList(), "零件汇总比对寄售库存")
.ExportAppendDataAsByteArray();

Loading…
Cancel
Save