2025-09-02 14:52:56 +08:00
|
|
|
|
using MyCode.Project.Domain.Message.Act.AdminReport.PrdReport;
|
|
|
|
|
|
using MyCode.Project.Domain.Message.Act.Common;
|
2025-08-23 18:22:55 +08:00
|
|
|
|
using MyCode.Project.Domain.Message.Request.JackYun;
|
2025-09-01 17:21:34 +08:00
|
|
|
|
using MyCode.Project.Domain.Message.Request.K3Cloud;
|
|
|
|
|
|
using MyCode.Project.Domain.Message.Response.K3Cloud;
|
2025-08-23 17:38:02 +08:00
|
|
|
|
using MyCode.Project.Domain.Message.Response.LxmZHMDReport;
|
2025-08-23 16:27:17 +08:00
|
|
|
|
using MyCode.Project.Domain.Repositories;
|
|
|
|
|
|
using MyCode.Project.Infrastructure.Common;
|
|
|
|
|
|
using MyCode.Project.Infrastructure.JackYun;
|
2025-08-23 17:38:02 +08:00
|
|
|
|
using MyCode.Project.Repositories;
|
2025-09-01 17:21:34 +08:00
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
using Newtonsoft.Json.Linq;
|
2025-08-23 16:27:17 +08:00
|
|
|
|
using System;
|
2025-09-01 17:21:34 +08:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
2025-08-23 16:27:17 +08:00
|
|
|
|
|
|
|
|
|
|
namespace MyCode.Project.Services.Implementation
|
|
|
|
|
|
{
|
2025-08-23 17:15:28 +08:00
|
|
|
|
public class PrdOrderService : ServiceBase, IPrdOrderService
|
2025-08-23 16:27:17 +08:00
|
|
|
|
{
|
|
|
|
|
|
|
2025-08-23 17:38:02 +08:00
|
|
|
|
private IMOOrdersRepository _MOOrdersRepository;
|
2025-08-23 16:27:17 +08:00
|
|
|
|
|
2025-08-23 17:38:02 +08:00
|
|
|
|
public PrdOrderService(IMOOrdersRepository MOOrdersRepository)
|
2025-08-23 16:27:17 +08:00
|
|
|
|
{
|
2025-08-23 17:38:02 +08:00
|
|
|
|
_MOOrdersRepository = MOOrdersRepository;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-01 17:21:34 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取生产订单明细
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="search"></param>
|
|
|
|
|
|
/// <returns></returns>
|
2025-08-23 18:22:55 +08:00
|
|
|
|
public PageResult<PrdMoOrderEntryResp> GetPrdMoEntryPageList(PagedSearch<IdAct> search)
|
|
|
|
|
|
{
|
|
|
|
|
|
return _MOOrdersRepository.GetPrdMoEntryPageList(search);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-23 17:38:02 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 生产订单列表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="search"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public PageResult<PrdMoOrderResp> GetPrdMoPageList(PagedSearch search)
|
|
|
|
|
|
{
|
|
|
|
|
|
return _MOOrdersRepository.GetPrdMoPageList(search);
|
2025-08-23 16:27:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-01 17:21:34 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取生产订单执行汇总表数据
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="search"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <exception cref="NotImplementedException"></exception>
|
|
|
|
|
|
public PageResult<PrdMOExecuteDetailRpt> GetMoExecuteSumRespData(PagedSearch search)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void UpdatePrdMoExecuteSumData()
|
|
|
|
|
|
{
|
|
|
|
|
|
var fieldKeys = "FWORKSHOPID,FMOBILLTYPEID,FMOBILLNO,FMOENTRYSEQ,FMATERIALID,FMATERIALNAME,FMATERIALMODEL,FPRDUNITID,FPLANSTARTDATE,FPLANFINISHDATE,FCONVEYDATE,FSTARTDATE,FFINISHDATE,FPLANQTY,FFINISHQTY,FSTOCKINQUAQTY,FSTOCKINFAILQTY,FStockInScrapQty,FSTOCKINREMADEQTY,FReStkQty,FNOSTOCKINQTY,FPLANFINISHPERCENT,FQUAPERCENT,FPICKEDQTY,FSTATUSNAME,FCLOSETYPENAME";
|
|
|
|
|
|
var moTypes = "123f39178eb2424c8449f992e1fff1ee,0e74146732c24bec90178b6fe16a2d1c,281783bb73244d178d41ce550d877af0,b7dd912d4ef545578f0f5d1d08cb2602,00232405fc58a68311e33257e9e17076,00505694499eb16411e3cd16dc62e287,005056945fca85e511e42420f363da25,574e87276ff23a,6672319eb2ba0e";
|
|
|
|
|
|
var orgIds = "1";
|
|
|
|
|
|
var workshopId = "";
|
|
|
|
|
|
ReportDataParam<PRD_MOExecuteDetailRpt> reportDataParam = new ReportDataParam<PRD_MOExecuteDetailRpt>()
|
|
|
|
|
|
{
|
|
|
|
|
|
ReturnJsonData = true, // 返回JSON数据,金蝶云星空V9.0以上可用
|
|
|
|
|
|
FieldKeys = fieldKeys,
|
|
|
|
|
|
IsVerifyBaseDataField = true,
|
|
|
|
|
|
StartRow = 0,
|
|
|
|
|
|
Limit = 10000,
|
|
|
|
|
|
Model = new PRD_MOExecuteDetailRpt()
|
|
|
|
|
|
{
|
|
|
|
|
|
FMOBillType = moTypes,
|
|
|
|
|
|
FBeginConveyDate = DateTime.Now,
|
|
|
|
|
|
FEndConveyDate = DateTime.Now.AddDays(1),
|
|
|
|
|
|
FBeginPlanFinishDate = DateTime.Now,
|
|
|
|
|
|
FEndPlanFinishDate = DateTime.Now.AddDays(1),
|
|
|
|
|
|
FBeginPlanStartDate = DateTime.Now,
|
|
|
|
|
|
FEndPlanStartDate = DateTime.Now.AddDays(1),
|
|
|
|
|
|
FConveyDateInvolve = false,
|
|
|
|
|
|
FFinishDateInvolve = false,
|
|
|
|
|
|
FStartDateInvolve = true,
|
|
|
|
|
|
FCtrlItem = "1",
|
|
|
|
|
|
FIsSuspend = "0,1",
|
|
|
|
|
|
FStatus = "3,4,5,6",
|
|
|
|
|
|
FPrdOrgId = orgIds,
|
|
|
|
|
|
FWorkshopId = workshopId.Split(',').Select(n => new PRD_MOExecuteDetailRpt.WorkshopId()
|
|
|
|
|
|
{
|
|
|
|
|
|
FNumber = n,
|
|
|
|
|
|
}),
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
var k3Api = K3CloudHelp.GetK3CloudApiInstance();
|
|
|
|
|
|
var jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
|
|
|
|
|
|
var requestString = JsonConvert.SerializeObject(reportDataParam, Formatting.Indented, jsonSetting);
|
|
|
|
|
|
var responseString = k3Api.GetSysReportData("PRD_MOExecuteDetailRpt", requestString);
|
|
|
|
|
|
var result = JsonConvert.DeserializeObject<KingdeeResult<List<string>>>(responseString);
|
|
|
|
|
|
if (result.Result.RowCount == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
var fieldKeyList = fieldKeys.Split(',');
|
|
|
|
|
|
JArray fieldValues = new JArray();
|
|
|
|
|
|
foreach (var item in result.Result.Rows)
|
|
|
|
|
|
{
|
|
|
|
|
|
JObject pairs = new JObject();
|
|
|
|
|
|
for (int i = 0; i < fieldKeyList.Length; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
pairs.Add(fieldKeyList[i], item[i]);
|
|
|
|
|
|
}
|
|
|
|
|
|
fieldValues.Add(pairs);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2025-09-02 14:52:56 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取报表头
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="yearAndMonth"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public PrdReportHead GetMoDataChartHeadByYearAndMonth(YearAndMonth yearAndMonth)
|
|
|
|
|
|
{
|
|
|
|
|
|
return _MOOrdersRepository.GetMoDataChartHeadByYearAndMonth(yearAndMonth);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取报表折线图,获取往期12个月的数据
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="yearAndMonth"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <exception cref="NotImplementedException"></exception>
|
|
|
|
|
|
public List<PrdReportHead> GetMoDataChartByYearAndMonth(YearAndMonth yearAndMonth)
|
|
|
|
|
|
{
|
|
|
|
|
|
List<PrdReportHead> result = new List<PrdReportHead>();
|
|
|
|
|
|
var datetime = new DateTime(yearAndMonth.Year, yearAndMonth.Month, 1);
|
|
|
|
|
|
for (int i = 0; i < 12; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
var datetimeTemp = datetime.AddMonths(-i);
|
|
|
|
|
|
YearAndMonth yearAndMonthTemp = new YearAndMonth()
|
|
|
|
|
|
{
|
|
|
|
|
|
Year = datetimeTemp.Year,
|
|
|
|
|
|
Month = datetimeTemp.Month,
|
|
|
|
|
|
};
|
2025-09-02 15:29:18 +08:00
|
|
|
|
result.Add(_MOOrdersRepository.GetMoDataChartHeadByYearAndMonth(yearAndMonthTemp));
|
2025-09-02 14:52:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<MaterialAndQty> GetPrdInStockGroupByMaterial(YearAndMonth yearAndMonth)
|
|
|
|
|
|
{
|
|
|
|
|
|
return _MOOrdersRepository.GetPrdInStockGroupByMaterial(yearAndMonth);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<MaterialAndQty> GetPrdMoGroupByMaterial(YearAndMonth yearAndMonth)
|
|
|
|
|
|
{
|
|
|
|
|
|
return _MOOrdersRepository.GetPrdMoGroupByMaterial(yearAndMonth);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<MaterialAndQty> GetInventoryGroupByMaterial()
|
|
|
|
|
|
{
|
|
|
|
|
|
return _MOOrdersRepository.GetInventoryGroupByMaterial();
|
|
|
|
|
|
}
|
2025-08-23 16:27:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|