From a04831bbaecfe87ab7fe2f653073d5d24078fe2b Mon Sep 17 00:00:00 2001
From: zhou keda <1315948824@qq.com>
Date: Sun, 29 Sep 2024 16:03:05 +0800
Subject: [PATCH 1/3] =?UTF-8?q?=E6=8C=A4=E5=87=BA=E6=89=B9=E5=8F=B7?=
=?UTF-8?q?=E4=BF=AE=E6=94=B9=20erp=E6=8E=A5=E5=8F=A3=E5=8F=A6=E8=B5=B7?=
=?UTF-8?q?=E7=BA=BF=E7=A8=8B=E8=B0=83=E7=94=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../IThirdApiRecordService.cs | 2 +-
.../Tnb.BasicData/ThirdApiRecordService.cs | 24 ++++++--
.../Entity/PrdReport.cs | 10 ++++
.../Tnb.ProductionMgr/PrdMoTaskService.cs | 55 +++++++++++++------
.../Entity/WmsPurchaseH.cs | 5 ++
.../Tnb.WarehouseMgr/WmsInStockService.cs | 1 +
.../Tnb.WarehouseMgr/WmsPrdInstockHService.cs | 6 +-
.../Tnb.WarehouseMgr/WmsPurchaseDService.cs | 1 +
8 files changed, 76 insertions(+), 28 deletions(-)
diff --git a/BasicData/Tnb.BasicData.Interfaces/IThirdApiRecordService.cs b/BasicData/Tnb.BasicData.Interfaces/IThirdApiRecordService.cs
index 62b6b3c0..4a7a0ffd 100644
--- a/BasicData/Tnb.BasicData.Interfaces/IThirdApiRecordService.cs
+++ b/BasicData/Tnb.BasicData.Interfaces/IThirdApiRecordService.cs
@@ -11,6 +11,6 @@ namespace Tnb.BasicData.Interfaces
///
/// 手动 自动
///
- Task Send(List records, string send_type,ISqlSugarClient db=null);
+ Task Send(List records, string send_type,ISqlSugarClient db=null,bool ThreadFlag = true);
}
}
\ No newline at end of file
diff --git a/BasicData/Tnb.BasicData/ThirdApiRecordService.cs b/BasicData/Tnb.BasicData/ThirdApiRecordService.cs
index 2bcd0724..ea304e86 100644
--- a/BasicData/Tnb.BasicData/ThirdApiRecordService.cs
+++ b/BasicData/Tnb.BasicData/ThirdApiRecordService.cs
@@ -44,7 +44,7 @@ namespace Tnb.BasicData
public async Task Send(string id)
{
ThirdWebapiRecord record = await _repository.GetSingleAsync(x=>x.id==id);
- ThirdResult thirdResult = await Send(Arrays.AsList(record), "手动");
+ ThirdResult thirdResult = await Send(Arrays.AsList(record), "手动",null,false);
return thirdResult.msgResult;
}
@@ -89,7 +89,25 @@ namespace Tnb.BasicData
return "失败";
}
- public async Task Send(List records, string send_type,ISqlSugarClient db=null)
+ public async Task Send(List records, string send_type,ISqlSugarClient db=null,bool threadFlag=true)
+ {
+ ThirdResult thirdResult = new ThirdResult();
+ if (threadFlag)
+ {
+ Task.Run(() =>
+ {
+ Send(records, send_type, db);
+ });
+ }
+ else
+ {
+ thirdResult = await Send(records, send_type, db);
+ }
+
+ return thirdResult;
+ }
+
+ private async Task Send(List records, string send_type, ISqlSugarClient db = null)
{
ThirdResult thirdResult = null;
bool tranFlag = true;
@@ -273,8 +291,6 @@ namespace Tnb.BasicData
Log.Error(e.Message,e);
if(tranFlag) await db.Ado.RollbackTranAsync();
}
-
-
return thirdResult;
}
}
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdReport.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdReport.cs
index e4657c2b..65c8c09f 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdReport.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdReport.cs
@@ -169,4 +169,14 @@ public partial class PrdReport : BaseEntity
///
public string erp_pk_wr_product { get; set; }
+ ///
+ /// 合格数
+ ///
+ public decimal? pqty { get; set; }
+ ///
+ /// 不合格数
+ ///
+ public decimal? rqty { get; set; }
+
+
}
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
index fc41e357..ded5e525 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
@@ -2092,22 +2092,12 @@ namespace Tnb.ProductionMgr
}else if (mo.mo_type == DictConst.PrdMoTypeJC)
{
- if (changeBatchFlag)
- {
- EqpEquipment equipment = await _db.Queryable().SingleAsync(x => x.id == prdMoTask.eqp_id);
- ToolMolds toolMolds = await _db.Queryable().SingleAsync(x => x.id == prdMoTask.mold_id);
- batch = $"{toolMolds.mold_code.Substring(toolMolds.mold_code.Length - 2, 2)}{equipment.code.Substring(equipment.code.Length - 2, 2)}{prdMoTask.act_start_date.Value.ToString("yyMMdd")}";
- await db.Updateable()
- .SetColumns(x => x.batch == batch)
- .SetColumns(x=>x.change_batch_count_by_day==changeCountNumByDay)
- .SetColumns(x=>x.change_batch_count_by_qty==changeCountNumByQty)
- .Where(x => x.id == prdMoTask.id)
- .ExecuteCommandAsync();
- }
- else
- {
- batch = prdMoTask.batch;
- }
+ ToolMolds toolMolds = await _db.Queryable().SingleAsync(x => x.id == prdMoTask.mold_id);
+ batch = $"6{toolMolds.mold_code.Substring(toolMolds.mold_code.Length - 4, 2)}{DateTime.Now.ToString("yyMMdd")}";
+ await db.Updateable()
+ .SetColumns(x => x.batch == batch)
+ .Where(x => x.id == prdMoTask.id)
+ .ExecuteCommandAsync();
}else
{
// OrganizeEntity organizeEntity = await _db.Queryable().SingleAsync(x => x.Id == prdMoTask.workline_id);
@@ -2496,6 +2486,12 @@ namespace Tnb.ProductionMgr
throw Oops.Bah(result1.msg);
}
+ await _db.Updateable()
+ .SetColumns(x => x.pqty == input.pqty)
+ .SetColumns(x => x.rqty == input.rqty)
+ .Where(x => x.id == report.id)
+ .ExecuteCommandAsync();
+
WmsPrdInstockInput wmsPrdInstockInput = new WmsPrdInstockInput();
wmsPrdInstockInput.prd_bill_code = prdMo.mo_code;
wmsPrdInstockInput.material_id = prdMoTask.material_id;
@@ -2627,8 +2623,8 @@ namespace Tnb.ProductionMgr
// ["cbastunitid"] = erpExtendFields.Find(x=>x.table_id==report.unit_id)?.cunitid ?? "",
["cbunitid"] = erpExtendFields.Find(x => x.table_id == (unitDatas.Find(x => x.EnCode == report.unit_id)?.Id ?? ""))?.cunitid ?? "",
["cbastunitid"] = erpExtendFields.Find(x =>x.table_id == (unitDatas.Find(x => x.EnCode == report.unit_id)?.Id ?? ""))?.cunitid ?? "",
- ["nbplanwrnum"] = report.reported_qty,
- ["nbwrnum"] = report.reported_qty,
+ ["nbplanwrnum"] = input.pqty,
+ ["nbwrnum"] = input.pqty,
["tbendtime"] = nowStr,
["tbstarttime"] = prdMoTask.act_start_date != null ? prdMoTask.act_start_date.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
["vbinbatchcode"] = report.batch,
@@ -2751,6 +2747,29 @@ namespace Tnb.ProductionMgr
}
+ [HttpPost]
+ public async Task DelPrdReport(string id)
+ {
+ PrdReport prdReport = await _db.Queryable().SingleAsync(x => x.id == id);
+ PrdMoTask prdMoTask = await _db.Queryable().SingleAsync(x => x.id == prdReport.mo_task_id);
+ DbResult result = await _db.Ado.UseTranAsync(async () =>
+ {
+ await _db.Updateable()
+ .SetColumns(x => x.reported_work_qty == x.reported_work_qty - prdReport.reported_qty)
+ .Where(x => x.id == prdMoTask.id)
+ .ExecuteCommandAsync();
+
+ await _db.Updateable()
+ .SetColumns(x => x.reported_work_qty == x.reported_work_qty - prdReport.reported_qty)
+ .Where(x => x.id == prdMoTask.mo_id)
+ .ExecuteCommandAsync();
+
+ await _db.Deleteable().Where(x => x.id == id).ExecuteCommandAsync();
+ });
+
+ return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result.IsSuccess ? "保存成功" : result.ErrorMessage);
+ }
+
///
/// 自检报废提交
///
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsPurchaseH.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsPurchaseH.cs
index a044e45e..f00ce4d6 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsPurchaseH.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsPurchaseH.cs
@@ -164,4 +164,9 @@ public partial class WmsPurchaseH : BaseEntity, IPurchaseAndSaleAuitEnti
/// 制单方式(自制 同步)
///
public string make_method { get; set; }
+
+ ///
+ /// erp流水号
+ ///
+ public string service_num { get; set; }
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs
index 115f79ad..3cbb2f10 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs
@@ -402,6 +402,7 @@ namespace Tnb.WarehouseMgr
erpRequestData.Add("vbillcode", instock.bill_code);
erpRequestData.Add("vtrantypecode", tranType?.EnCode ?? "");
erpRequestData.Add("csourcebillhid", wmsPurchaseH?.erp_arriveorder_pk ?? "");
+ erpRequestData.Add("vdef3", wmsPurchaseH?.service_num ?? "");
List> erpRequestDataDetails = new List>();
foreach (WmsInstockD item in allInstockDetails)
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPrdInstockHService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPrdInstockHService.cs
index 75241466..7f4ceb76 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPrdInstockHService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPrdInstockHService.cs
@@ -479,11 +479,7 @@ namespace Tnb.WarehouseMgr
BasFactoryConfig callErp = await _db.Queryable().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.CALLERP);
if(callErp.value=="1")
{
- Thread thread = new(() =>
- {
- _thirdApiRecordService.Send(new List { thirdWebapiRecord }, "自动", _db);
- });
- thread.Start();
+ _thirdApiRecordService.Send(new List { thirdWebapiRecord }, "自动", _db);
}
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseDService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseDService.cs
index a967d1d9..e1774ab4 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseDService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseDService.cs
@@ -183,6 +183,7 @@ namespace Tnb.WarehouseMgr
erpRequestData.Add("vbillcode", instock.bill_code);
erpRequestData.Add("vtrantypecode", tranType?.EnCode ?? "");
erpRequestData.Add("csourcebillhid", wmsPurchaseH?.erp_arriveorder_pk ?? "");
+ erpRequestData.Add("vdef3", wmsPurchaseH?.service_num ?? "");
List> erpRequestDataDetails = new List>();
foreach (WmsInstockD item in allInstockDetails)
From 84068c16952f6efa62872705b15d5bc573f5f075 Mon Sep 17 00:00:00 2001
From: zhou keda <1315948824@qq.com>
Date: Sun, 29 Sep 2024 16:08:57 +0800
Subject: [PATCH 2/3] 1
---
ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs b/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs
index a0f4cd0e..7dd513dc 100644
--- a/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs
@@ -727,7 +727,7 @@ namespace Tnb.ProductionMgr
if (records.IsEmpty()) return "";
- await _thirdApiRecordService.Send(records, "自动");
+ await _thirdApiRecordService.Send(records, "自动",null,false);
return "true";
}
From c125e42ce71c02fa156731bc23781da87b5fe9b1 Mon Sep 17 00:00:00 2001
From: zhou keda <1315948824@qq.com>
Date: Sun, 29 Sep 2024 17:14:25 +0800
Subject: [PATCH 3/3] =?UTF-8?q?=E4=BA=BA=E5=91=98=E4=BA=A7=E9=87=8F?=
=?UTF-8?q?=E7=BB=9F=E8=AE=A1=E8=A1=A8=20=E5=8C=85=E8=A3=85=E6=89=B9?=
=?UTF-8?q?=E6=AC=A1=E4=BF=AE=E6=94=B9=E5=86=99=E5=85=A5plc?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Dto/PrdManage/PrdReportUserListOutput.cs | 15 +++
.../Tnb.ProductionMgr/PrdMoTaskService.cs | 36 +++++-
.../PrdReportUserListService.cs | 119 ++++++++++++++++++
.../Tnb.WarehouseMgr/WmsInStockService.cs | 1 +
.../Tnb.WarehouseMgr/WmsPurchaseDService.cs | 1 +
5 files changed, 171 insertions(+), 1 deletion(-)
create mode 100644 ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdReportUserListOutput.cs
create mode 100644 ProductionMgr/Tnb.ProductionMgr/PrdReportUserListService.cs
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdReportUserListOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdReportUserListOutput.cs
new file mode 100644
index 00000000..d684b3d2
--- /dev/null
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdReportUserListOutput.cs
@@ -0,0 +1,15 @@
+namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
+{
+ public class PrdReportUserListOutput
+ {
+ public string id {get;set;}
+ public string mo_task_id {get;set;}
+ public string equip_id {get;set;}
+ public string material_id {get;set;}
+ public string batch {get;set;}
+ public decimal? reported_qty {get;set;}
+ public decimal? rqty {get;set;}
+ public string create_id {get;set;}
+ public string create_time {get;set;}
+ }
+}
\ No newline at end of file
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
index ded5e525..21235658 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
@@ -1607,7 +1607,7 @@ namespace Tnb.ProductionMgr
//string code = $"(01){basMaterial.di ?? ""}(11){DateTime.Now.ToString("yyMMdd")}(17){DateTime.Now.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyMMdd")}(10){batch}#{basMaterial.material_specification}*{batch}*{DateTime.Now.ToString("yyyyMMdd")}*{DateTime.Now.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyyyMMdd")}*{basMaterial.container_no}";
string code1 = $"(01){basMaterial.di ?? ""}*(11){item.act_start_date.Value.ToString("yyMMdd")}*(17){item.first_start_date.Value.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyMMdd")}*(10){batch}";
- string code2 = $"{basMaterial.material_specification}*{batch}*{item.act_start_date.Value.ToString("yyyyMMdd")}*{item.first_start_date.Value.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyyyMMdd")}*{basMaterial.container_no}";
+ string code2 = $"{basMaterial.material_specification}*{batch}*{item.act_start_date.Value.ToString("yyyyMMdd")}*{item.first_start_date.Value.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyyyMMdd")}*{basMaterial.material_standard}";
Dictionary dicCommand1 = new(StringComparer.OrdinalIgnoreCase)
{
["DevName"] = "外包装箱码垛线",
@@ -4121,6 +4121,40 @@ namespace Tnb.ProductionMgr
.SetColumns(x => x.batch == batch)
.Where(x => idList.Contains(x.id))
.ExecuteCommandAsync();
+ foreach (var id in idList)
+ {
+ PrdMoTask prdMoTask = await _db.Queryable().Where(x => x.id == id).SingleAsync();
+ if (prdMoTask.mo_task_status == DictConst.InProgressEnCode)
+ {
+ BasMaterial basMaterial = await _db.Queryable().Where(x=>x.id==prdMoTask.material_id).SingleAsync();
+ string code1 = $"(01){basMaterial.di ?? ""}*(11){prdMoTask.act_start_date.Value.ToString("yyMMdd")}*(17){prdMoTask.first_start_date.Value.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyMMdd")}*(10){batch}";
+ string code2 = $"{basMaterial.material_specification}*{batch}*{prdMoTask.act_start_date.Value.ToString("yyyyMMdd")}*{prdMoTask.first_start_date.Value.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyyyMMdd")}*{basMaterial.material_standard}";
+ Dictionary dicCommand1 = new(StringComparer.OrdinalIgnoreCase)
+ {
+ ["DevName"] = "外包装箱码垛线",
+ ["token"] = _eleCtlCfg.token,
+ ["TagName"] = "WBZX_tb_cs",
+ ["Value"] = code1,
+ };
+ Dictionary dicCommand2 = new(StringComparer.OrdinalIgnoreCase)
+ {
+ ["DevName"] = "外包装箱码垛线",
+ ["token"] = _eleCtlCfg.token,
+ ["TagName"] = "WBZX_pm_cs",
+ ["Value"] = code2,
+ };
+
+ Log.Information($"贴标写入参数:{JsonConvert.SerializeObject(dicCommand1)}");
+ string result1 = await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand1, false);
+ Log.Information($"贴标写入返回结果:{JsonConvert.SerializeObject(result1)}");
+ Log.Information($"喷码写入参数:{JsonConvert.SerializeObject(dicCommand2)}");
+ string result2 = await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand2, false);
+ Log.Information($"喷码写入返回结果:{JsonConvert.SerializeObject(result2)}");
+ }
+
+ }
+
+
return row>0 ? "设置成功" : "设置失败";
}
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdReportUserListService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdReportUserListService.cs
new file mode 100644
index 00000000..a18cfed3
--- /dev/null
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdReportUserListService.cs
@@ -0,0 +1,119 @@
+using JNPF;
+using JNPF.Common.Core.Manager;
+using JNPF.Common.Extension;
+using JNPF.Common.Filter;
+using JNPF.Common.Security;
+using JNPF.DependencyInjection;
+using JNPF.DynamicApiController;
+using JNPF.Extras.CollectiveOAuth.Utils;
+using JNPF.FriendlyException;
+using JNPF.Logging;
+using JNPF.Systems.Entitys.Permission;
+using JNPF.Systems.Entitys.System;
+using JNPF.Systems.Interfaces.System;
+using JNPF.VisualDev;
+using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
+using JNPF.VisualDev.Interfaces;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using Newtonsoft.Json;
+using SqlSugar;
+using Tnb.BasicData;
+using Tnb.BasicData.Entities;
+using Tnb.EquipMgr.Entities;
+using Tnb.ProductionMgr.Entities;
+using Tnb.ProductionMgr.Entities.Dto;
+using Tnb.ProductionMgr.Entities.Dto.PrdManage;
+using Tnb.ProductionMgr.Entities.Enums;
+using Tnb.ProductionMgr.Interfaces;
+using AuthResponse = JNPF.Extras.CollectiveOAuth.Models.AuthResponse;
+using StringExtensions = JNPF.Common.Extension.StringExtensions;
+
+namespace Tnb.ProductionMgr
+{
+ ///
+ /// 人员产量统计表
+ ///
+ [ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)]
+ [Route("api/[area]/[controller]/[action]")]
+ [OverideVisualDev(ModuleId)]
+ public class PrdReportUserListService : IOverideVisualDevService, IDynamicApiController, ITransient
+ {
+ private const string ModuleId = "37231170320661";
+ private readonly ISqlSugarRepository _repository;
+ private readonly IDataBaseManager _dataBaseManager;
+ private readonly IUserManager _userManager;
+ private readonly IDictionaryDataService _dictionaryDataService;
+ private readonly IRunService _runService;
+ private readonly IVisualDevService _visualDevService;
+ private readonly ISqlSugarClient _db;
+
+ public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
+
+ public PrdReportUserListService(
+ ISqlSugarRepository repository,
+ IDataBaseManager dataBaseManager,
+ IUserManager userManager,
+ IDictionaryDataService dictionaryDataService,
+ IRunService runService,
+ IVisualDevService visualDevService
+ )
+ {
+ _repository = repository;
+ _dataBaseManager = dataBaseManager;
+ _userManager = userManager;
+ _dictionaryDataService = dictionaryDataService;
+ _runService = runService;
+ _visualDevService = visualDevService;
+ _db = _repository.AsSugarClient();
+ OverideFuncs.GetListAsync = GetList;
+ }
+
+
+ private async Task GetList(VisualDevModelListQueryInput input)
+ {
+ ISqlSugarClient db = _repository.AsSugarClient();
+ Dictionary? queryJson = !string.IsNullOrEmpty(input.queryJson) ? Newtonsoft.Json.JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary();
+ string moTaskCode = queryJson.ContainsKey("mo_task_id") ? queryJson["mo_task_id"].ToString() : "";
+ string equipInfo = queryJson.ContainsKey("equip_id") ? queryJson["equip_id"].ToString() : "";
+ string materialInfo = queryJson.ContainsKey("material_id") ? queryJson["material_id"].ToString() : "";
+ string createInfo = queryJson.ContainsKey("create_id") ? queryJson["create_id"].ToString() : "";
+ DateTime[] createTime = queryJson.ContainsKey("create_time") ? queryJson["create_time"].ToObject().Select(x => DateTimeOffset.FromUnixTimeSeconds(x / 1000).ToLocalTime().DateTime).ToArray() : null;
+ DateTime? sDate = null;
+ DateTime? eDate = null;
+
+ if (createTime != null && createTime.Length == 2)
+ {
+ sDate = createTime[0];
+ eDate = createTime[1];
+ }
+
+ SqlSugarPagedList result = await db.Queryable()
+ .LeftJoin((a,b)=>a.mo_task_id==b.id)
+ .LeftJoin((a, b,c) => a.material_id == c.id)
+ .LeftJoin((a, b,c,d) => a.create_id == d.Id)
+ .LeftJoin((a, b,c,d,e) => a.equip_id == e.id)
+ .WhereIF(!string.IsNullOrEmpty(moTaskCode), (a, b, c, d) => b.mo_task_code.Contains(moTaskCode))
+ .WhereIF(!string.IsNullOrEmpty(equipInfo), (a, b, c, d,e) => e.code.Contains(equipInfo) || e.name.Contains(equipInfo))
+ .WhereIF(!string.IsNullOrEmpty(materialInfo), (a, b, c, d,e) => c.code.Contains(materialInfo) || c.name.Contains(materialInfo))
+ .WhereIF(!string.IsNullOrEmpty(createInfo), (a, b, c, d,e) => d.Account.Contains(createInfo) || d.RealName.Contains(createInfo))
+ .WhereIF(createTime!=null && createTime.Length==2,a=>a.create_time>=sDate && a.create_time<=eDate)
+ .OrderByDescending(a => a.create_time)
+ .Select((a, b, c, d, e) => new PrdReportUserListOutput
+ {
+ id = a.id,
+ mo_task_id = b.mo_task_code,
+ equip_id = e.name,
+ material_id = c.code+"/"+c.name,
+ batch = a.batch,
+ reported_qty = a.reported_qty,
+ rqty = a.rqty,
+ create_id = d.RealName,
+ create_time = a.create_time.ToString(DbTimeFormat.SS)
+ }).ToPagedListAsync(input.currentPage, input.pageSize);
+ return PageResult.SqlSugarPageResult(result);
+ }
+
+ }
+}
+
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs
index 3cbb2f10..bb7b9085 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs
@@ -378,6 +378,7 @@ namespace Tnb.WarehouseMgr
Dictionary erpRequestData = new Dictionary();
erpRequestData.Add("approver", erpCreateId);
erpRequestData.Add("billmaker", erpCreateId);
+ erpRequestData.Add("cbiztype", wmsPurchaseH?.transaction_type ?? "");
erpRequestData.Add("bitinbill", false);
erpRequestData.Add("cgeneralhid", null);
erpRequestData.Add("corpoid", erpOrg.corpoid);
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseDService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseDService.cs
index e1774ab4..34e16224 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseDService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseDService.cs
@@ -159,6 +159,7 @@ namespace Tnb.WarehouseMgr
Dictionary erpRequestData = new Dictionary();
erpRequestData.Add("approver", erpCreateId);
erpRequestData.Add("billmaker", erpCreateId);
+ erpRequestData.Add("cbiztype", wmsPurchaseH?.transaction_type ?? "");
erpRequestData.Add("bitinbill", false);
erpRequestData.Add("cgeneralhid", null);
erpRequestData.Add("corpoid", erpOrg.corpoid);