This commit is contained in:
2024-09-04 11:33:59 +08:00
parent cddca2a10a
commit 26311fa6a7
12 changed files with 431 additions and 260 deletions

View File

@@ -79,6 +79,21 @@ namespace Tnb.BasicData
/// 成品检验单号 /// 成品检验单号
/// </summary> /// </summary>
public const string CHENGPINJIANYAN_CODE = "chengpinjianyan"; public const string CHENGPINJIANYAN_CODE = "chengpinjianyan";
/// <summary>
/// 设备点巡检
/// </summary>
public const string SPOTINSPECTIONEXECUTIONSHEET_CODE = "spotInspectionExecutionSheet";
/// <summary>
/// /设备保养
/// </summary>
public const string MAINTENANCERECORDFIJIPROJECT_CODE = "maintenancerecordfijiproject";
/// <summary>
/// /模具保养
/// </summary>
public const string MOLDMAINTENANCE_CODE = "MoldMaintenance";
} }
} }

View File

@@ -3,6 +3,7 @@ namespace Tnb.EquipMgr.Entities.Dto
public class EqpMaintainRecordListOutput public class EqpMaintainRecordListOutput
{ {
public string id { get; set; } public string id { get; set; }
public string code { get; set; }
public string equip_id { get; set; } public string equip_id { get; set; }
public string equip_id_id { get; set; } public string equip_id_id { get; set; }
public string status { get; set; } public string status { get; set; }

View File

@@ -3,6 +3,7 @@ namespace Tnb.EquipMgr.Entities.Dto
public class ToolMoldMaintainRecordListOutput public class ToolMoldMaintainRecordListOutput
{ {
public string id { get; set; } public string id { get; set; }
public string code { get; set; }
public string mold_id { get; set; } public string mold_id { get; set; }
public string mold_id_id { get; set; } public string mold_id_id { get; set; }
public string status { get; set; } public string status { get; set; }

View File

@@ -82,6 +82,7 @@ namespace Tnb.EquipMgr
.Select((a, b, c, d,e) => new EqpMaintainRecordListOutput .Select((a, b, c, d,e) => new EqpMaintainRecordListOutput
{ {
id = a.id, id = a.id,
code = a.code,
equip_id = b.code + "/" + b.name, equip_id = b.code + "/" + b.name,
equip_id_id = a.equip_id, equip_id_id = a.equip_id,
status = a.status, status = a.status,

View File

@@ -82,6 +82,7 @@ namespace Tnb.EquipMgr
.Select((a, b, c, d,e) => new ToolMoldMaintainRecordListOutput .Select((a, b, c, d,e) => new ToolMoldMaintainRecordListOutput
{ {
id = a.id, id = a.id,
code = a.code,
mold_id = b.mold_code + "/" + b.mold_name, mold_id = b.mold_code + "/" + b.mold_name,
mold_id_id = a.mold_id, mold_id_id = a.mold_id,
status = a.status, status = a.status,

View File

@@ -1318,7 +1318,7 @@ namespace Tnb.ProductionMgr
if (toolMaintainTemMoldH != null && toolMolds!=null) if (toolMaintainTemMoldH != null && toolMolds!=null)
{ {
string code = DateTime.Now.Ticks.ToString(); string code = await _billRuleService.GetBillNumber(CodeTemplateConst.MOLDMAINTENANCE_CODE);
ToolMoldMaintainRecordH toolMoldMaintainRecordH = new ToolMoldMaintainRecordH() ToolMoldMaintainRecordH toolMoldMaintainRecordH = new ToolMoldMaintainRecordH()
{ {
id = SnowflakeIdHelper.NextId(), id = SnowflakeIdHelper.NextId(),
@@ -2516,7 +2516,7 @@ namespace Tnb.ProductionMgr
erpRequestData.Add("pk_org_v",erpOrg.pk_org_v); erpRequestData.Add("pk_org_v",erpOrg.pk_org_v);
erpRequestData.Add("vtrantypecode","55A4-01"); erpRequestData.Add("vtrantypecode","55A4-01");
erpRequestData.Add("vtrantypeid","0001A11000000002LVX8"); erpRequestData.Add("vtrantypeid","0001A11000000002LVX8");
erpRequestData.Add("vdef1",null); erpRequestData.Add("vdef1",null);//todo 倒冲日期
erpRequestData.Add("vdef2",null); erpRequestData.Add("vdef2",null);
erpRequestData.Add("report_id",report.id); erpRequestData.Add("report_id",report.id);

View File

@@ -709,5 +709,26 @@
/// 成品提报 /// 成品提报
/// </summary> /// </summary>
public const string bipwarehouseid_cp = "1001A1100000001MA8ME"; public const string bipwarehouseid_cp = "1001A1100000001MA8ME";
/// <summary>
/// 四厂区生产部id
/// </summary>
public const string sichangqushengchanbu_id = "1001A1100000001RLNAD";
/// <summary>
/// 四厂区生产部id
/// </summary>
public const string sichangqushengchanbu_vid = "0001A1100000000BUMTN";
/// <summary>
/// 四厂区仓库id
/// </summary>
public const string sichangqucangku_id = "1001A1100000001JFOOL";
/// <summary>
/// 四厂区仓库vid
/// </summary>
public const string sichangqucangku_vid = "0001A1100000000AOMIG";
} }
} }

View File

@@ -357,12 +357,13 @@ namespace Tnb.WarehouseMgr
List<WmsPrdInstockCode> allInstockDetails = await _db.Queryable<WmsPrdInstockCode>().Where(it => it.prd_instockD_id == wmsPrdInstockD.id).ToListAsync(); List<WmsPrdInstockCode> allInstockDetails = await _db.Queryable<WmsPrdInstockCode>().Where(it => it.prd_instockD_id == wmsPrdInstockD.id).ToListAsync();
List<String> materialIds = Arrays.AsList(instock.material_id); List<String> materialIds = Arrays.AsList(instock.material_id);
List<String> unitCodes = allInstockDetails.Select(x => x.unit_id).Distinct().ToList(); List<String> unitIds = allInstockDetails.Select(x => x.unit_id).Distinct().ToList();
List<DictionaryDataEntity> unitDatas = await _db.Queryable<DictionaryTypeEntity>() // List<String> unitCodes = allInstockDetails.Select(x => x.unit_id).Distinct().ToList();
.LeftJoin<DictionaryDataEntity>((x, y) => x.Id == y.DictionaryTypeId) // List<DictionaryDataEntity> unitDatas = await _db.Queryable<DictionaryTypeEntity>()
.Where((x, y) => x.EnCode == DictConst.MeasurementUnit && unitCodes.Contains(y.EnCode)) // .LeftJoin<DictionaryDataEntity>((x, y) => x.Id == y.DictionaryTypeId)
.Select((x, y) => y) // .Where((x, y) => x.EnCode == DictConst.MeasurementUnit && unitCodes.Contains(y.EnCode))
.ToListAsync(); // .Select((x, y) => y)
// .ToListAsync();
List<WmsErpWarehouserelaH> erpWarehouserelaHs = await _db.Queryable<WmsErpWarehouserelaH>().Where(x=>x.id!=null).ToListAsync(); List<WmsErpWarehouserelaH> erpWarehouserelaHs = await _db.Queryable<WmsErpWarehouserelaH>().Where(x=>x.id!=null).ToListAsync();
string userId = instock?.create_id ?? WmsWareHouseConst.AdministratorUserId; string userId = instock?.create_id ?? WmsWareHouseConst.AdministratorUserId;
@@ -372,7 +373,8 @@ namespace Tnb.WarehouseMgr
tableIds.Add(WmsWareHouseConst.AdministratorOrgId); tableIds.Add(WmsWareHouseConst.AdministratorOrgId);
tableIds.AddRange(materialIds); tableIds.AddRange(materialIds);
tableIds.Add(supplierId); tableIds.Add(supplierId);
tableIds.AddRange(unitDatas.Select(x => x.Id).ToList()); // tableIds.AddRange(unitDatas.Select(x => x.Id).ToList());
tableIds.AddRange(unitIds);
List<ErpExtendField> erpExtendFields = await _db.Queryable<ErpExtendField>().Where(x => tableIds.Contains(x.table_id)).ToListAsync(); List<ErpExtendField> erpExtendFields = await _db.Queryable<ErpExtendField>().Where(x => tableIds.Contains(x.table_id)).ToListAsync();
string erpCreateId = erpExtendFields.Find(x => x.table_id == userId)?.user_id ?? ""; string erpCreateId = erpExtendFields.Find(x => x.table_id == userId)?.user_id ?? "";
@@ -420,7 +422,7 @@ namespace Tnb.WarehouseMgr
["crowno"] = (allInstockDetails.FindIndex(x => x.id == item.id) + 1) * 10, ["crowno"] = (allInstockDetails.FindIndex(x => x.id == item.id) + 1) * 10,
["csourcebillhid"] = prdReport?.erp_pk_wr ?? "", ["csourcebillhid"] = prdReport?.erp_pk_wr ?? "",
["csourcebillbid"] = prdReport?.erp_pk_wr_product ?? "", ["csourcebillbid"] = prdReport?.erp_pk_wr_product ?? "",
["cunitid"] = erpExtendFields.Find(x => x.table_id == (unitDatas.Find(x => x.EnCode == item.unit_id)?.Id ?? ""))?.cunitid ?? "", ["cunitid"] = erpExtendFields.Find(x => x.table_id == item.unit_id)?.cunitid ?? "",
["cvendorid"] = erpExtendFields.Find(x => x.table_id == supplierId)?.supplier_id ?? "", ["cvendorid"] = erpExtendFields.Find(x => x.table_id == supplierId)?.supplier_id ?? "",
["cvendorvid"] = erpExtendFields.Find(x => x.table_id == supplierId)?.supplier_vid ?? "", ["cvendorvid"] = erpExtendFields.Find(x => x.table_id == supplierId)?.supplier_vid ?? "",
["dbizdate"] = instock.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"), ["dbizdate"] = instock.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),

View File

@@ -1,239 +1,340 @@
using System; // using System;
using System.Collections.Generic; // using System.Collections.Generic;
using System.Linq; // using System.Linq;
using System.Text; // using System.Text;
using System.Threading.Tasks; // using System.Threading.Tasks;
using Aop.Api.Domain; // using Aop.Api.Domain;
using JNPF.Common.Core.Manager; // using JNPF.Common.Core.Manager;
using JNPF.Common.Dtos.VisualDev; // using JNPF.Common.Dtos.VisualDev;
using JNPF.Common.Enums; // using JNPF.Common.Enums;
using JNPF.FriendlyException; // using JNPF.Common.Security;
using JNPF.Systems.Interfaces.System; // using JNPF.FriendlyException;
using JNPF.VisualDev; // using JNPF.Systems.Entitys.System;
using JNPF.VisualDev.Interfaces; // using JNPF.Systems.Interfaces.System;
using Mapster; // using JNPF.VisualDev;
using Microsoft.AspNetCore.Authorization; // using JNPF.VisualDev.Interfaces;
using Microsoft.AspNetCore.Mvc; // using Mapster;
using Microsoft.Extensions.Logging; // using Microsoft.AspNetCore.Authorization;
using Newtonsoft.Json.Linq; // using Microsoft.AspNetCore.Mvc;
using NPOI.HPSF; // using Microsoft.Extensions.Logging;
using Senparc.Weixin.Work.AdvancedAPIs.OaDataOpen; // using Newtonsoft.Json;
using SqlSugar; // using Newtonsoft.Json.Linq;
using Tnb.BasicData.Entities; // using NPOI.HPSF;
using Tnb.WarehouseMgr.Entities; // using Senparc.Weixin.Work.AdvancedAPIs.OaDataOpen;
using Tnb.WarehouseMgr.Entities.Attributes; // using SqlSugar;
using Tnb.WarehouseMgr.Entities.Consts; // using Tnb.BasicData.Entities;
using Tnb.WarehouseMgr.Entities.Dto; // using Tnb.WarehouseMgr.Entities;
using Tnb.WarehouseMgr.Entities.Dto.Inputs; // using Tnb.WarehouseMgr.Entities.Attributes;
using Tnb.WarehouseMgr.Entities.Entity; // using Tnb.WarehouseMgr.Entities.Consts;
using Tnb.WarehouseMgr.Interfaces; // using Tnb.WarehouseMgr.Entities.Dto;
// using Tnb.WarehouseMgr.Entities.Dto.Inputs;
namespace Tnb.WarehouseMgr // using Tnb.WarehouseMgr.Entities.Entity;
{ // using Tnb.WarehouseMgr.Interfaces;
/// <summary> // using Tnb.ProductionMgr.Entities.Entity;
/// 材料出库单 // using Tnb.BasicData;
/// </summary> //
[OverideVisualDev(ModuleConsts.MODULE_WmsRawmatOutstock_ID)] // namespace Tnb.WarehouseMgr
[ServiceModule(BizTypeId)] // {
public class WmsRawmatOutstockService : BaseWareHouseService // /// <summary>
{ // /// 材料出库单
private const string BizTypeId = WmsWareHouseConst.BIZTYPE_WmsRawmatOutstock_ID; // /// </summary>
private readonly ISqlSugarClient _db; // [OverideVisualDev(ModuleConsts.MODULE_WmsRawmatOutstock_ID)]
private readonly IUserManager _userManager; // [ServiceModule(BizTypeId)]
private readonly IBillRullService _billRullService; // public class WmsRawmatOutstockService : BaseWareHouseService
private readonly IRunService _runService; // {
private readonly IVisualDevService _visualDevService; // private const string BizTypeId = WmsWareHouseConst.BIZTYPE_WmsRawmatOutstock_ID;
private readonly IWmsPDAScanInStockService _wmsPDAScanInStock; // private readonly ISqlSugarClient _db;
private readonly IWareHouseService _wareHouseService; // private readonly IUserManager _userManager;
public WmsRawmatOutstockService( // private readonly IBillRullService _billRullService;
ISqlSugarRepository<WmsCarryH> repository, // private readonly IRunService _runService;
IUserManager userManager, // private readonly IVisualDevService _visualDevService;
IBillRullService billRullService, // private readonly IWmsPDAScanInStockService _wmsPDAScanInStock;
IRunService runService, // private readonly IWareHouseService _wareHouseService;
IVisualDevService visualDevService, // public WmsRawmatOutstockService(
IWmsPDAScanInStockService wmsPDAScanInStock, // ISqlSugarRepository<WmsCarryH> repository,
IWareHouseService wareHouseService) // IUserManager userManager,
{ // IBillRullService billRullService,
_db = repository.AsSugarClient(); // IRunService runService,
_userManager = userManager; // IVisualDevService visualDevService,
_billRullService = billRullService; // IWmsPDAScanInStockService wmsPDAScanInStock,
_runService = runService; // IWareHouseService wareHouseService)
_visualDevService = visualDevService; // {
_wmsPDAScanInStock = wmsPDAScanInStock; // _db = repository.AsSugarClient();
_wareHouseService = wareHouseService; // _userManager = userManager;
// _billRullService = billRullService;
OverideFuncs.GetDetailsAsync = GetDetailsAsync; // _runService = runService;
} // _visualDevService = visualDevService;
// _wmsPDAScanInStock = wmsPDAScanInStock;
// _wareHouseService = wareHouseService;
public override async Task ModifyAsync(WareHouseUpInput input) //
{ // OverideFuncs.GetDetailsAsync = GetDetailsAsync;
if (input == null) // }
{ //
throw new ArgumentNullException(nameof(input)); //
} // public override async Task ModifyAsync(WareHouseUpInput input)
// {
} // if (input == null)
// {
[NonAction] // throw new ArgumentNullException(nameof(input));
private async Task<dynamic> GetDetailsAsync(string id) // }
{ //
try // WmsRawmatOutstockD wmsRawmatOutstockD = await _db.Queryable<WmsRawmatOutstockD>().SingleAsync(x=>x.id==input.requireId);
{ // WmsRawmatOutstockH wmsRawmatOutstockH = await _db.Queryable<WmsRawmatOutstockH>().SingleAsync(x=>x.id==wmsRawmatOutstockD.bill_id);
return await Task.FromResult(_db.Queryable<WmsRawmatOutstockD>().Where(r => r.bill_id == id).ToList()); // List<WmsCarryCode> wmsCarryCodes = await _db.Queryable<WmsCarryCode>()
} // .Where(r => r.carry_id == input.wmsDistaskH.carry_id)
catch (Exception ex) // .Where(r => r.material_id == wmsRawmatOutstockD.material_id && r.code_batch == wmsRawmatOutstockD.batchno)
{ // .ToListAsync();
return Task.FromResult(ex); //
} // decimal qty = wmsCarryCodes.Sum(r => r.codeqty);
} //
// List<String> unitCodes = wmsCarryCodes.Select(x => x.unit_id).Distinct().ToList();
/// <summary> // List<string> materialIds = wmsCarryCodes.Select(x => x.material_id).ToList();
/// 下发 // List<DictionaryDataEntity> unitDatas = await _db.Queryable<DictionaryTypeEntity>()
/// </summary> // .LeftJoin<DictionaryDataEntity>((x, y) => x.Id == y.DictionaryTypeId)
/// <param name="input"></param> // .Where((x, y) => x.EnCode == DictConst.MeasurementUnit && unitCodes.Contains(y.EnCode))
/// <returns></returns> // .Select((x, y) => y)
/// <exception cref="AppFriendlyException"></exception> // .ToListAsync();
[HttpPost, NonUnify, AllowAnonymous] //
public async Task<Entities.Dto.Outputs.Result> Distribute(RawmatOutstockInput input) // string supplierId = WmsWareHouseConst.TIANYIGONGYINGSHANG_ID;
{ // List<string> tableIds = new List<string>();
try // tableIds.Add(WmsWareHouseConst.AdministratorOrgId);
{ // tableIds.AddRange(materialIds);
await _s_taskExecuteSemaphore_YCLOutstock.WaitAsync(); // tableIds.Add(supplierId);
if (string.IsNullOrEmpty(input.source_id)) // tableIds.AddRange(unitDatas.Select(x => x.Id).ToList());
{ //
throw new AppFriendlyException("来源单据id不可为空", 500); // List<ErpExtendField> erpExtendFields = await _db.Queryable<ErpExtendField>().Where(x => tableIds.Contains(x.table_id)).ToListAsync();
} // string userId = wmsRawmatTransferoutstockH.create_id;
if (input.carrys.Count == 0) // string erpCreateId = erpExtendFields.Find(x => x.table_id == userId)?.user_id ?? "";
{ // ErpExtendField erpOrg = erpExtendFields.Find(x => x.table_id == (WmsWareHouseConst.AdministratorOrgId));
throw new AppFriendlyException("至少选择一个载具", 500); // string nowStr = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
} // List<WmsErpWarehouserelaH> wmsErpWarehouserelaHs = await _db.Queryable<WmsErpWarehouserelaH>().Where(x=>!SqlFunc.IsNullOrEmpty(x.id)).ToListAsync();
//
WmsRawmatOutstockD wmsRawmatOutstockD = await _db.Queryable<WmsRawmatOutstockD>().FirstAsync(it => it.id == input.source_id); // List<Dictionary<string, object>> requestData = new List<Dictionary<string, object>>();
WmsRawmatOutstockH wmsRawmatOutstockH = await _db.Queryable<WmsRawmatOutstockH>().FirstAsync(it => it.id == wmsRawmatOutstockD.bill_id); // Dictionary<string, object> erpRequestData = new Dictionary<string, object>();
// erpRequestData.Add("billmaker", erpCreateId);
List<WmsCarryH> _items = await _db.Queryable<WmsCarryH>().Where(r => input.carrys.Select(c => c.carry_code).Contains(r.carry_code)).ToListAsync(); // erpRequestData.Add("ccostdomainoid", null);
// erpRequestData.Add("cdrawcalbodyoid", erpOrg.pk_org);
List<WmsCarryCode> wmsCarryCodes = await _db.Queryable<WmsCarryCode>().Where(r => _items.Select(c => c.id).Contains(r.carry_id) // erpRequestData.Add("cdrawcalbodyvid", erpOrg.pk_org_v);
&& r.material_id == wmsRawmatOutstockD.material_id && r.code_batch == wmsRawmatOutstockD.batchno).ToListAsync(); //
// erpRequestData.Add("corpoid", erpOrg.corpoid);
List<WmsCarryH> items = new List<WmsCarryH>(); // erpRequestData.Add("corpvid", erpOrg.corpvid);
// erpRequestData.Add("cdptid","1001A1100000001JFOPQ");//部门先写死
foreach (var carry in input.carrys.Select(c => c.carry_code)) // erpRequestData.Add("cdptvid","0001A1100000000AOMIQ");//部门先写死
{ // erpRequestData.Add("cotherdptid","1001A1100000001JFOPQ");//部门先写死
items.Add(_items.Where(r => r.carry_code == carry).First()); // erpRequestData.Add("cotherdptvid","0001A1100000000AOMIQ");//部门先写死
} // erpRequestData.Add("creationtime", nowStr);
// erpRequestData.Add("creator", erpCreateId);
foreach (var item in items) // erpRequestData.Add("ctrantypeid", "0001H11000000000D32A");//先写死
{ // erpRequestData.Add("cwarehouseid", outWhid);//先写死
if (item.is_lock == 1) // erpRequestData.Add("dbilldate", wmsRawmatTransferoutstockH.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"));
{ // erpRequestData.Add("dmakedate", nowStr);
throw new AppFriendlyException($"载具{item.carry_code}已锁定", 500); // erpRequestData.Add("dshldarrivedate", nowStr);
} // erpRequestData.Add("dshlddiliverdate", nowStr);
BasLocation carrryLoc = await _db.Queryable<BasLocation>().Where(r => r.id == item.location_id).FirstAsync(); // erpRequestData.Add("fbillflag", 1);
if (carrryLoc == null || carrryLoc.is_type != "0") // erpRequestData.Add("isbackdeliver", false);
{ // erpRequestData.Add("ntotalnum", qty);
throw new Exception($"托盘{item.carry_code}已经不在存储库位中,不能出库!"); // erpRequestData.Add("pk_org", erpOrg.pk_org);
} // erpRequestData.Add("pk_org_v", erpOrg.pk_org_v);
} // erpRequestData.Add("pk_group", erpOrg.pk_group);
// erpRequestData.Add("vbillcode", wmsRawmatTransferoutstockH.bill_code);
decimal? sign_qty = 0; // erpRequestData.Add("vtrantypecode", "4Y-01");//先写死
//
decimal qty = wmsCarryCodes.Sum(c => c.codeqty); // List<Dictionary<string, object>> erpRequestDataDetails = new List<Dictionary<string, object>>();
if (wmsRawmatOutstockD.actual_outstock_qty + qty > wmsRawmatOutstockD.qty) // foreach(var item in wmsCarryCodes)
{ // {
// 最后一个托盘的数量 // // 出库数量wmsMaterialSignD.sign_qty
decimal lastCarryQty = wmsCarryCodes.Where(r => r.carry_id == items[items.Count - 1].id).Sum(r => r.codeqty); // erpRequestDataDetails.Add(new Dictionary<string, object>()
// 如果最后一个托盘数量小于超出的出库数量 // {
if (lastCarryQty < wmsRawmatOutstockD.actual_outstock_qty + qty - wmsRawmatOutstockD.qty) // ["cmaterialoid"] = erpExtendFields.Find(x => x.table_id == item.material_id)?.cmaterialoid ?? "",
{ // ["cmaterialvid"] = erpExtendFields.Find(x => x.table_id == item.material_id)?.cmaterialvid ?? "",
throw new AppFriendlyException($"本次出库数量{qty}已超过可出库数量{wmsRawmatOutstockD.qty - wmsRawmatOutstockD.actual_outstock_qty} 且无需选择{items[items.Count - 1].carry_code}", 500); // ["corpoid"] = erpOrg.corpoid,
} // ["corpvid"] = erpOrg.corpvid,
// 签收数量 // ["crowno"] = (wmsCarryCodes.FindIndex(x => x.id == item.id) + 1) * 10,
sign_qty = lastCarryQty - (wmsRawmatOutstockD.actual_outstock_qty + qty - wmsRawmatOutstockD.qty); // ["cunitid"] = erpExtendFields.Find(x => x.table_id == (unitDatas.Find(x => x.EnCode == item.unit_id)?.Id ?? ""))?.cunitid ?? "",
} // ["nnum"] = item.codeqty,
// ["nshouldnum"] = item.codeqty,
await _db.Ado.BeginTranAsync(); // ["pk_group"] = erpOrg.pk_group,
// ["pk_org"] = erpOrg.pk_org,
List<BasLocation> endLocations = new List<BasLocation>(); // ["pk_org_v"] = erpOrg.pk_org_v,
// ["vbatchcode"] = item.code_batch,
endLocations = _db.Queryable<BasLocation>().Where(r => _wareHouseService.GetFloor1YCLDBOutstockLocation().Contains(r.id) && r.is_lock == 0 && r.is_use == "0") //
.OrderBy("is_lock, task_nums, location_code").ToList(); // });
// }
if (endLocations.Count() < items.Count) // erpRequestData.Add("dtls", erpRequestDataDetails);
{ // requestData.Add(erpRequestData);
throw new AppFriendlyException($@"可用的终点库位数量为{endLocations.Count()}个 下发数量为{items.Count}个 请检查终点库位的锁定和占用状态", 500); // BasFactoryConfig config = await _db.Queryable<BasFactoryConfig>().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.BIPURL);
} // ThirdWebapiRecord thirdWebapiRecord = new ThirdWebapiRecord();
// thirdWebapiRecord.id = SnowflakeIdHelper.NextId();
foreach (var wmsCarryH in items) // thirdWebapiRecord.third_name = WmsWareHouseConst.BIP;
{ // thirdWebapiRecord.name = "材料出库单(自制)";
BasLocation startLocation = await _db.Queryable<BasLocation>().Where(r => r.id == wmsCarryH.location_id).FirstAsync(); // thirdWebapiRecord.method = "POST";
// thirdWebapiRecord.url = config.value + "uapws/rest/materialOut/self/save";
BasLocation endLocation = null; // // thirdWebapiRecord.url = WmsWareHouseConst.BIP_DOMAIN + "uapws/rest/transIn/save";
// thirdWebapiRecord.request_data = JsonConvert.SerializeObject(requestData);
endLocation = await _db.Queryable<BasLocation>().Where(r => _wareHouseService.GetFloor1YCLDBOutstockLocation().Contains(r.id) && r.is_lock == 0 && r.is_use == "0").OrderBy("is_lock, task_nums, location_code").FirstAsync(); // thirdWebapiRecord.create_time = DateTime.Now;
// await _db.Insertable(thirdWebapiRecord).ExecuteCommandAsync();
if (endLocation == null) //
{ // }
throw new AppFriendlyException($@"没有可用的终点库位!请检查终点库位的锁定和占用状态", 500); //
} // [NonAction]
// private async Task<dynamic> GetDetailsAsync(string id)
WmsRawmatOutstockC wmsRawmatOutstockC = new WmsRawmatOutstockC(); // {
wmsRawmatOutstockC.bill_id = wmsRawmatOutstockH.id; // try
wmsRawmatOutstockC.mat_bill_id = wmsRawmatOutstockD.id; // {
wmsRawmatOutstockC.carry_id = wmsCarryH.id; // return await Task.FromResult(_db.Queryable<WmsRawmatOutstockD>().Where(r => r.bill_id == id).ToList());
wmsRawmatOutstockC.carry_code = wmsCarryH.carry_code; // }
wmsRawmatOutstockC.create_id = input.create_id; // catch (Exception ex)
wmsRawmatOutstockC.create_time = DateTime.Now; // {
wmsRawmatOutstockC.startlocation_id = startLocation.id; // return Task.FromResult(ex);
wmsRawmatOutstockC.startlocation_code = startLocation.location_code; // }
wmsRawmatOutstockC.endlocation_id = endLocation.id; // }
wmsRawmatOutstockC.endlocation_code = endLocation.location_code; //
decimal carryQty = wmsCarryCodes.Where(r => r.carry_id == wmsCarryH.id).Sum(r => r.codeqty); // /// <summary>
wmsRawmatOutstockC.qty = carryQty; // /// 下发
wmsRawmatOutstockC.sign_qty = wmsCarryH.id == items[items.Count - 1].id && sign_qty > 0 ? sign_qty : carryQty; // /// </summary>
// /// <param name="input"></param>
await _db.Insertable(wmsRawmatOutstockC).ExecuteCommandAsync(); // /// <returns></returns>
// /// <exception cref="AppFriendlyException"></exception>
CommonCreatePretaskInput commonCreatePretaskInput = new CommonCreatePretaskInput(); // [HttpPost, NonUnify, AllowAnonymous]
commonCreatePretaskInput.startlocation_id = startLocation.id; // public async Task<Entities.Dto.Outputs.Result> Distribute(RawmatOutstockInput input)
commonCreatePretaskInput.endlocation_id = endLocation.id; // {
commonCreatePretaskInput.task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID; // try
commonCreatePretaskInput.biz_type = WmsWareHouseConst.BIZTYPE_WmsRawmatOutstock_ID; // {
commonCreatePretaskInput.source_id = input.source_id; // await _s_taskExecuteSemaphore_YCLOutstock.WaitAsync();
commonCreatePretaskInput.carry_id = wmsCarryH.id; // if (string.IsNullOrEmpty(input.source_id))
commonCreatePretaskInput.carry_code = wmsCarryH.carry_code; // {
commonCreatePretaskInput.isExcuteMission = false; // throw new AppFriendlyException("来源单据id不可为空", 500);
// }
Entities.Dto.Outputs.Result res = await _wareHouseService.CommonCreatePretask(commonCreatePretaskInput, _db); // if (input.carrys.Count == 0)
// {
if (res.code != HttpStatusCode.OK) // throw new AppFriendlyException("至少选择一个载具", 500);
{ // }
Logger.LogInformation($@"生成预任务失败"); //
throw new AppFriendlyException($@"生成预任务失败", 500); // WmsRawmatOutstockD wmsRawmatOutstockD = await _db.Queryable<WmsRawmatOutstockD>().FirstAsync(it => it.id == input.source_id);
} // WmsRawmatOutstockH wmsRawmatOutstockH = await _db.Queryable<WmsRawmatOutstockH>().FirstAsync(it => it.id == wmsRawmatOutstockD.bill_id);
} //
// List<WmsCarryH> _items = await _db.Queryable<WmsCarryH>().Where(r => input.carrys.Select(c => c.carry_code).Contains(r.carry_code)).ToListAsync();
// 更新子表已下发数量 //
await _db.Updateable<WmsRawmatOutstockD>().SetColumns(r => r.actual_outstock_qty == r.actual_outstock_qty + qty).Where(r => r.id == input.source_id).ExecuteCommandAsync(); // List<WmsCarryCode> wmsCarryCodes = await _db.Queryable<WmsCarryCode>().Where(r => _items.Select(c => c.id).Contains(r.carry_id)
// && r.material_id == wmsRawmatOutstockD.material_id && r.code_batch == wmsRawmatOutstockD.batchno).ToListAsync();
await _db.Ado.CommitTranAsync(); //
} // List<WmsCarryH> items = new List<WmsCarryH>();
catch (Exception ex) //
{ // foreach (var carry in input.carrys.Select(c => c.carry_code))
await _db.Ado.RollbackTranAsync(); // {
Logger.LogError("【Distribute】" + ex.Message); // items.Add(_items.Where(r => r.carry_code == carry).First());
Logger.LogError("【Distribute】" + ex.StackTrace); // }
return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message); //
} // foreach (var item in items)
finally // {
{ // if (item.is_lock == 1)
_ = _s_taskExecuteSemaphore_YCLOutstock.Release(); // {
InvokeGenPretaskExcute(); // throw new AppFriendlyException($"载具{item.carry_code}已锁定", 500);
} // }
// BasLocation carrryLoc = await _db.Queryable<BasLocation>().Where(r => r.id == item.location_id).FirstAsync();
return await ToApiResult(HttpStatusCode.OK, "成功"); // if (carrryLoc == null || carrryLoc.is_type != "0")
} // {
// throw new Exception($"托盘{item.carry_code}已经不在存储库位中,不能出库!");
} // }
} // }
//
// decimal? sign_qty = 0;
//
// decimal qty = wmsCarryCodes.Sum(c => c.codeqty);
// if (wmsRawmatOutstockD.actual_outstock_qty + qty > wmsRawmatOutstockD.qty)
// {
// // 最后一个托盘的数量
// decimal lastCarryQty = wmsCarryCodes.Where(r => r.carry_id == items[items.Count - 1].id).Sum(r => r.codeqty);
// // 如果最后一个托盘数量小于超出的出库数量
// if (lastCarryQty < wmsRawmatOutstockD.actual_outstock_qty + qty - wmsRawmatOutstockD.qty)
// {
// throw new AppFriendlyException($"本次出库数量{qty}已超过可出库数量{wmsRawmatOutstockD.qty - wmsRawmatOutstockD.actual_outstock_qty} 且无需选择{items[items.Count - 1].carry_code}", 500);
// }
// // 签收数量
// sign_qty = lastCarryQty - (wmsRawmatOutstockD.actual_outstock_qty + qty - wmsRawmatOutstockD.qty);
// }
//
// await _db.Ado.BeginTranAsync();
//
// List<BasLocation> endLocations = new List<BasLocation>();
//
// endLocations = _db.Queryable<BasLocation>().Where(r => _wareHouseService.GetFloor1YCLDBOutstockLocation().Contains(r.id) && r.is_lock == 0 && r.is_use == "0")
// .OrderBy("is_lock, task_nums, location_code").ToList();
//
// if (endLocations.Count() < items.Count)
// {
// throw new AppFriendlyException($@"可用的终点库位数量为{endLocations.Count()}个 下发数量为{items.Count}个 请检查终点库位的锁定和占用状态", 500);
// }
//
// foreach (var wmsCarryH in items)
// {
// BasLocation startLocation = await _db.Queryable<BasLocation>().Where(r => r.id == wmsCarryH.location_id).FirstAsync();
//
// BasLocation endLocation = null;
//
// endLocation = await _db.Queryable<BasLocation>().Where(r => _wareHouseService.GetFloor1YCLDBOutstockLocation().Contains(r.id) && r.is_lock == 0 && r.is_use == "0").OrderBy("is_lock, task_nums, location_code").FirstAsync();
//
// if (endLocation == null)
// {
// throw new AppFriendlyException($@"没有可用的终点库位!请检查终点库位的锁定和占用状态", 500);
// }
//
// WmsRawmatOutstockC wmsRawmatOutstockC = new WmsRawmatOutstockC();
// wmsRawmatOutstockC.bill_id = wmsRawmatOutstockH.id;
// wmsRawmatOutstockC.mat_bill_id = wmsRawmatOutstockD.id;
// wmsRawmatOutstockC.carry_id = wmsCarryH.id;
// wmsRawmatOutstockC.carry_code = wmsCarryH.carry_code;
// wmsRawmatOutstockC.create_id = input.create_id;
// wmsRawmatOutstockC.create_time = DateTime.Now;
// wmsRawmatOutstockC.startlocation_id = startLocation.id;
// wmsRawmatOutstockC.startlocation_code = startLocation.location_code;
// wmsRawmatOutstockC.endlocation_id = endLocation.id;
// wmsRawmatOutstockC.endlocation_code = endLocation.location_code;
// decimal carryQty = wmsCarryCodes.Where(r => r.carry_id == wmsCarryH.id).Sum(r => r.codeqty);
// wmsRawmatOutstockC.qty = carryQty;
// wmsRawmatOutstockC.sign_qty = wmsCarryH.id == items[items.Count - 1].id && sign_qty > 0 ? sign_qty : carryQty;
//
// await _db.Insertable(wmsRawmatOutstockC).ExecuteCommandAsync();
//
// CommonCreatePretaskInput commonCreatePretaskInput = new CommonCreatePretaskInput();
// commonCreatePretaskInput.startlocation_id = startLocation.id;
// commonCreatePretaskInput.endlocation_id = endLocation.id;
// commonCreatePretaskInput.task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID;
// commonCreatePretaskInput.biz_type = WmsWareHouseConst.BIZTYPE_WmsRawmatOutstock_ID;
// commonCreatePretaskInput.source_id = input.source_id;
// commonCreatePretaskInput.carry_id = wmsCarryH.id;
// commonCreatePretaskInput.carry_code = wmsCarryH.carry_code;
// commonCreatePretaskInput.isExcuteMission = false;
//
// Entities.Dto.Outputs.Result res = await _wareHouseService.CommonCreatePretask(commonCreatePretaskInput, _db);
//
// if (res.code != HttpStatusCode.OK)
// {
// Logger.LogInformation($@"生成预任务失败");
// throw new AppFriendlyException($@"生成预任务失败", 500);
// }
// }
//
// // 更新子表已下发数量
// await _db.Updateable<WmsRawmatOutstockD>().SetColumns(r => r.actual_outstock_qty == r.actual_outstock_qty + qty).Where(r => r.id == input.source_id).ExecuteCommandAsync();
//
// await _db.Ado.CommitTranAsync();
// }
// catch (Exception ex)
// {
// await _db.Ado.RollbackTranAsync();
// Logger.LogError("【Distribute】" + ex.Message);
// Logger.LogError("【Distribute】" + ex.StackTrace);
// return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message);
// }
// finally
// {
// _ = _s_taskExecuteSemaphore_YCLOutstock.Release();
// InvokeGenPretaskExcute();
// }
//
// return await ToApiResult(HttpStatusCode.OK, "成功");
// }
//
// }
// }

View File

@@ -70,15 +70,34 @@ namespace Tnb.WarehouseMgr
BasLocation endLocation = await _db.Queryable<BasLocation>().Where(r => r.id == input.wmsDistaskH.endlocation_id).FirstAsync(); BasLocation endLocation = await _db.Queryable<BasLocation>().Where(r => r.id == input.wmsDistaskH.endlocation_id).FirstAsync();
string outWhid = ""; string outWhid = "";
string outDeptid = "";
string outDeptvid = "";
string inDeptid = "";
string inDeptvid = "";
string tranTypeid = "";
string tranTypecode = "";
// 生产入库(灭菌完成) 仓库传 1001A1100000001MA8KP // 生产入库(灭菌完成) 仓库传 1001A1100000001MA8KP
if (endLocation.wh_id == WmsWareHouseConst.WAREHOUSE_MJC_ID) if (endLocation.wh_id == WmsWareHouseConst.WAREHOUSE_MJC_ID)
{ {
outWhid = WmsWareHouseConst.bipwarehouseid_bz; outWhid = WmsWareHouseConst.bipwarehouseid_bz;
outDeptid = WmsWareHouseConst.sichangqushengchanbu_id;
outDeptvid = WmsWareHouseConst.sichangqushengchanbu_vid;
inDeptid = WmsWareHouseConst.sichangqucangku_id;
inDeptvid = WmsWareHouseConst.sichangqucangku_vid;
tranTypeid = "1001A110000000077KMR";
tranTypecode = "4K-Cxx-06";
} }
// 生产入库(成品) 仓库传 1001A1100000001MA8ME // 生产入库(成品) 仓库传 1001A1100000001MA8ME
else if (endLocation.wh_id == WmsWareHouseConst.WAREHOUSE_CP_ID) else if (endLocation.wh_id == WmsWareHouseConst.WAREHOUSE_CP_ID)
{ {
outWhid = WmsWareHouseConst.bipwarehouseid_mj; outWhid = WmsWareHouseConst.bipwarehouseid_mj;
outDeptid = WmsWareHouseConst.sichangqucangku_id;
outDeptvid = WmsWareHouseConst.sichangqucangku_vid;
inDeptid = WmsWareHouseConst.sichangqucangku_id;
inDeptvid = WmsWareHouseConst.sichangqucangku_vid;
tranTypeid = "1001A11000000006YKHG";
tranTypecode = "4K-Cxx-01";
bool isOk = await _db.Updateable<WmsSterilizationInstockH>().SetColumns(it => new WmsSterilizationInstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }) bool isOk = await _db.Updateable<WmsSterilizationInstockH>().SetColumns(it => new WmsSterilizationInstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID })
.Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); .Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync();
if (!isOk) if (!isOk)
@@ -108,7 +127,7 @@ namespace Tnb.WarehouseMgr
tableIds.AddRange(unitDatas.Select(x => x.Id).ToList()); tableIds.AddRange(unitDatas.Select(x => x.Id).ToList());
List<ErpExtendField> erpExtendFields = await _db.Queryable<ErpExtendField>().Where(x => tableIds.Contains(x.table_id)).ToListAsync(); List<ErpExtendField> erpExtendFields = await _db.Queryable<ErpExtendField>().Where(x => tableIds.Contains(x.table_id)).ToListAsync();
string userId = wmsRawmatTransferoutstockH.create_id; string userId = wmsRawmatTransferoutstockH.create_id ?? WmsWareHouseConst.AdministratorUserId;
string erpCreateId = erpExtendFields.Find(x => x.table_id == userId)?.user_id ?? ""; string erpCreateId = erpExtendFields.Find(x => x.table_id == userId)?.user_id ?? "";
ErpExtendField erpOrg = erpExtendFields.Find(x => x.table_id == (WmsWareHouseConst.AdministratorOrgId)); ErpExtendField erpOrg = erpExtendFields.Find(x => x.table_id == (WmsWareHouseConst.AdministratorOrgId));
string nowStr = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); string nowStr = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
@@ -119,14 +138,13 @@ namespace Tnb.WarehouseMgr
erpRequestData.Add("billmaker", erpCreateId); erpRequestData.Add("billmaker", erpCreateId);
erpRequestData.Add("corpoid", erpOrg.corpoid); erpRequestData.Add("corpoid", erpOrg.corpoid);
erpRequestData.Add("corpvid", erpOrg.corpvid); erpRequestData.Add("corpvid", erpOrg.corpvid);
erpRequestData.Add("cdptid","1001A1100000001JFOPQ");//部门先写死 erpRequestData.Add("cdptid",outDeptid);//部门先写死
erpRequestData.Add("cdptvid","0001A1100000000AOMIQ");//部门先写死 erpRequestData.Add("cdptvid",outDeptvid);//部门先写死
erpRequestData.Add("cotherdptid","1001A1100000001JFOPQ");//部门先写死 erpRequestData.Add("cotherdptid",inDeptid);//部门先写死
erpRequestData.Add("cotherdptvid","0001A1100000000AOMIQ");//部门先写死 erpRequestData.Add("cotherdptvid",inDeptvid);//部门先写死
erpRequestData.Add("creationtime", nowStr); erpRequestData.Add("creationtime", nowStr);
erpRequestData.Add("creator", erpCreateId); erpRequestData.Add("creator", erpCreateId);
erpRequestData.Add("ctrantypeid", "0001H11000000000D32A");//先写死 erpRequestData.Add("cwarehouseid", outWhid);//先写死
erpRequestData.Add("cwarehouseid", "outWhid");//先写死
erpRequestData.Add("dbilldate", wmsRawmatTransferoutstockH.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss")); erpRequestData.Add("dbilldate", wmsRawmatTransferoutstockH.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"));
erpRequestData.Add("dmakedate", nowStr); erpRequestData.Add("dmakedate", nowStr);
erpRequestData.Add("dshldarrivedate", nowStr); erpRequestData.Add("dshldarrivedate", nowStr);
@@ -138,7 +156,8 @@ namespace Tnb.WarehouseMgr
erpRequestData.Add("pk_org_v", erpOrg.pk_org_v); erpRequestData.Add("pk_org_v", erpOrg.pk_org_v);
erpRequestData.Add("pk_group", erpOrg.pk_group); erpRequestData.Add("pk_group", erpOrg.pk_group);
erpRequestData.Add("vbillcode", wmsRawmatTransferoutstockH.bill_code); erpRequestData.Add("vbillcode", wmsRawmatTransferoutstockH.bill_code);
erpRequestData.Add("vtrantypecode", "4Y-01");//先写死 erpRequestData.Add("ctrantypeid", tranTypeid);//先写死
erpRequestData.Add("vtrantypecode", tranTypecode);//先写死
List<Dictionary<string, object>> erpRequestDataDetails = new List<Dictionary<string, object>>(); List<Dictionary<string, object>> erpRequestDataDetails = new List<Dictionary<string, object>>();
foreach(var item in wmsCarryCodes) foreach(var item in wmsCarryCodes)

View File

@@ -3,8 +3,10 @@ using JNPF.Logging;
using JNPF.Message; using JNPF.Message;
using JNPF.Message.Interfaces.Message; using JNPF.Message.Interfaces.Message;
using JNPF.Message.Service; using JNPF.Message.Service;
using JNPF.Systems.Interfaces.System;
using SqlSugar; using SqlSugar;
using Tnb.EquipMgr.Entities; using Tnb.EquipMgr.Entities;
using Tnb.BasicData;
namespace JNPF.TaskScheduler.Listener namespace JNPF.TaskScheduler.Listener
{ {
@@ -19,6 +21,7 @@ namespace JNPF.TaskScheduler.Listener
// _repository = repository; // _repository = repository;
// } // }
private IMessageService _sendMessageService => App.GetService<IMessageService>(); private IMessageService _sendMessageService => App.GetService<IMessageService>();
private IBillRullService _billRuleService => App.GetService<IBillRullService>();
[SpareTime("0 0 0 * * ?", "生成保养计划", ExecuteType = SpareTimeExecuteTypes.Serial, StartNow = false)] [SpareTime("0 0 0 * * ?", "生成保养计划", ExecuteType = SpareTimeExecuteTypes.Serial, StartNow = false)]
public async void GenerateSpotInspectionPlan(SpareTimer timer, long count) public async void GenerateSpotInspectionPlan(SpareTimer timer, long count)
{ {
@@ -105,7 +108,8 @@ namespace JNPF.TaskScheduler.Listener
if (equipments.FirstOrDefault(x => x.id == item.equip_id) == null) if (equipments.FirstOrDefault(x => x.id == item.equip_id) == null)
continue; continue;
string code = $"{now.ToString("yyyyMMdd") + (index++).ToString().PadLeft(3, '0')}"; // string code = $"{now.ToString("yyyyMMdd") + (index++).ToString().PadLeft(3, '0')}";
string code = await _billRuleService.GetBillNumber(CodeTemplateConst.MAINTENANCERECORDFIJIPROJECT_CODE);
tobeCreateList.Add(new EqpMaintainRecordH() tobeCreateList.Add(new EqpMaintainRecordH()
{ {
code = code, code = code,
@@ -290,7 +294,8 @@ namespace JNPF.TaskScheduler.Listener
if (toolMoldList.FirstOrDefault(x => x.id == item.mold_id) == null) if (toolMoldList.FirstOrDefault(x => x.id == item.mold_id) == null)
continue; continue;
string code = $"{now.ToString("yyyyMMdd") + (index++).ToString().PadLeft(3, '0')}"; // string code = $"{now.ToString("yyyyMMdd") + (index++).ToString().PadLeft(3, '0')}";
string code = await _billRuleService.GetBillNumber(CodeTemplateConst.MOLDMAINTENANCE_CODE);
toolMoldTobeCreateList.Add(new ToolMoldMaintainRecordH() toolMoldTobeCreateList.Add(new ToolMoldMaintainRecordH()
{ {
code = code, code = code,

View File

@@ -1,7 +1,9 @@
using JNPF.Common.Security; using JNPF.Common.Security;
using JNPF.Logging; using JNPF.Logging;
using JNPF.Message.Interfaces.Message; using JNPF.Message.Interfaces.Message;
using JNPF.Systems.Interfaces.System;
using SqlSugar; using SqlSugar;
using Tnb.BasicData;
using Tnb.EquipMgr.Entities; using Tnb.EquipMgr.Entities;
namespace JNPF.TaskScheduler.Listener namespace JNPF.TaskScheduler.Listener
@@ -17,6 +19,7 @@ namespace JNPF.TaskScheduler.Listener
// _repository = repository; // _repository = repository;
// } // }
private IMessageService _sendMessageService => App.GetService<IMessageService>(); private IMessageService _sendMessageService => App.GetService<IMessageService>();
private IBillRullService _billRuleService => App.GetService<IBillRullService>();
[SpareTime("0 0,30 * * * ?", "生成点巡检计划", ExecuteType = SpareTimeExecuteTypes.Serial, StartNow = false)] [SpareTime("0 0,30 * * * ?", "生成点巡检计划", ExecuteType = SpareTimeExecuteTypes.Serial, StartNow = false)]
public async void GenerateSpotInspectionPlan(SpareTimer timer, long count) public async void GenerateSpotInspectionPlan(SpareTimer timer, long count)
{ {
@@ -90,7 +93,8 @@ namespace JNPF.TaskScheduler.Listener
if (equipments.FirstOrDefault(x => x.id == item.equip_id) == null) if (equipments.FirstOrDefault(x => x.id == item.equip_id) == null)
continue; continue;
string code = $"{now.ToString("yyyyMMddHHmm") + (index++).ToString().PadLeft(3, '0')}"; // string code = $"{now.ToString("yyyyMMddHHmm") + (index++).ToString().PadLeft(3, '0')}";
string code = await _billRuleService.GetBillNumber(CodeTemplateConst.SPOTINSPECTIONEXECUTIONSHEET_CODE);
tobeCreateList.Add(new EqpSpotInsRecordH() tobeCreateList.Add(new EqpSpotInsRecordH()
{ {
id = SnowflakeIdHelper.NextId(), id = SnowflakeIdHelper.NextId(),