diff --git a/BasicData/Tnb.BasicData.Entities/Entity/ThirdWebapiRecord.cs b/BasicData/Tnb.BasicData.Entities/Entity/ThirdWebapiRecord.cs
index 6eb9c4a4..f806cb28 100644
--- a/BasicData/Tnb.BasicData.Entities/Entity/ThirdWebapiRecord.cs
+++ b/BasicData/Tnb.BasicData.Entities/Entity/ThirdWebapiRecord.cs
@@ -57,7 +57,7 @@ namespace Tnb.BasicData.Entities
///
/// 状态 0 失败或未发送 1 成功
///
- public int status { get; set; } = 0;
+ public string status { get; set; } = "0";
///
/// 发送成功时类型 自动 手动
diff --git a/BasicData/Tnb.BasicData/ThirdApiRecordService.cs b/BasicData/Tnb.BasicData/ThirdApiRecordService.cs
index cd4d533d..92be7c92 100644
--- a/BasicData/Tnb.BasicData/ThirdApiRecordService.cs
+++ b/BasicData/Tnb.BasicData/ThirdApiRecordService.cs
@@ -86,7 +86,7 @@ namespace Tnb.BasicData
.SetColumns(x => x.last_send_time == now)
.SetColumns(x => x.response_time == elapsedMilliseconds)
.SetColumns(x => x.send_type == "手动")
- .SetColumns(x => x.status == 1)
+ .SetColumns(x => x.status == "1")
.Where(x=>x.id==record.id)
.ExecuteCommandAsync();
}
diff --git a/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs b/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs
index 9dc2505b..ed2a305e 100644
--- a/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs
@@ -712,7 +712,7 @@ namespace Tnb.ProductionMgr
public async Task SendThirdApi(string thirdNmaes)
{
string[] thirdNameArr = thirdNmaes.Split("-");
- List records = await _db.Queryable().Where(x => thirdNameArr.Contains(x.third_name) && x.status == 0 && x.is_send == 1).ToListAsync();
+ List records = await _db.Queryable().Where(x => thirdNameArr.Contains(x.third_name) && x.status == "0" && x.is_send == 1).ToListAsync();
DateTime now = DateTime.Now;
Stopwatch stopwatch = null;
string response = "";
@@ -755,7 +755,7 @@ namespace Tnb.ProductionMgr
.SetColumns(x => x.last_send_time == now)
.SetColumns(x => x.response_time == elapsedMilliseconds)
.SetColumns(x => x.send_type == "自动")
- .SetColumns(x => x.status == 1)
+ .SetColumns(x => x.status == "1")
.Where(x=>x.id==record.id)
.ExecuteCommandAsync();
}
diff --git a/QcMgr/Tnb.QcMgr.Entities/Dto/CheckTask.cs b/QcMgr/Tnb.QcMgr.Entities/Dto/CheckTask.cs
index 72d51bd5..f9a380e7 100644
--- a/QcMgr/Tnb.QcMgr.Entities/Dto/CheckTask.cs
+++ b/QcMgr/Tnb.QcMgr.Entities/Dto/CheckTask.cs
@@ -29,6 +29,19 @@
/// 物料型号
///
public string? material_standard { get; set; }
+ ///
+ /// pc端的设备名称
+ ///
+ public string extras { get; set; }
+ ///
+ /// pc端的物料规格
+ ///
+ public string? f_flowtaskid { get; set; }
+
+ ///
+ /// pc端的物料型号
+ ///
+ public string? f_flowid { get; set; }
}
public class CheckTaskOut
@@ -175,6 +188,25 @@
public string? checknum { get; set; }
public string? status { get; set; }
public string? result { get; set; }
+ public string equip_name { get; set; }
+ public string mo_task_code { get; set; }
+ public string bill_code { get; set; }
+ public int? qty { get; set; }
+ ///
+ /// 物料规格
+ ///
+ public string? material_specification { get; set; }
+
+ ///
+ /// 物料型号
+ ///
+ public string? material_standard { get; set; }
+ public string? material_code { get; set; }
+ public string? material_name { get; set; }
+ public string? exectime { get; set; }
+ public string? execuser { get; set; }
+ public string batch { get; set; }
+
public List>? checktypes { get; set; }
public CheckCarry carryInfo { get; set; }
diff --git a/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs b/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs
index e31256ad..18919b8b 100644
--- a/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs
+++ b/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs
@@ -110,6 +110,9 @@ namespace Tnb.QcMgr
material_standard = b.material_standard,
material_specification = b.material_specification,
equip_name = h.name,
+ extras = h.name,
+ f_flowid = b.material_standard,
+ f_flowtaskid = b.material_specification,
}).OrderByDescending(a => DateTime.Parse(a.tasktime)).ToPagedListAsync(input.currentPage, input.pageSize);
foreach (QcCheckExecHOut? item in result.list)
{
@@ -406,14 +409,33 @@ namespace Tnb.QcMgr
List QcErrorCauses = await db.Queryable().ToListAsync();
List QcErrorLevels = await db.Queryable().ToListAsync();
- Result Result = new()
- {
- mainid = id,
- checknum = QcCheckExecH.checknum!,
- status = QcCheckExecH.status!,
- checktypes = new List>(),
- result = QcCheckExecH.result
- };
+ Result Result = await db.Queryable().LeftJoin((a, b) => a.materialid == b.id)
+ .LeftJoin((a, b, c) => a.processid == c.id)
+ .LeftJoin((a, b, c, d) => a.workid == d.Id)
+ .LeftJoin((a, b, c, d, e) => a.execuser == e.Id)
+ .LeftJoin((a, b, c, d, e, f) => a.report_id == f.id)
+ .LeftJoin((a, b, c, d, e, f, g) => a.mo_task_code == g.mo_task_code)
+ .LeftJoin((a, b, c, d, e, f, g, h) => g.eqp_id == h.id)
+ .Where((a, b, c, d, e) => a.id==id)
+ .Select((a, b, c, d, e, f, g, h) => new Result
+ {
+ mainid = a.id,
+ material_name = b.name,
+ material_code = b.code,
+ material_standard = b.material_standard,
+ material_specification = b.material_specification,
+ checknum = a.checknum,
+ status = a.status,
+ result = a.result,
+ exectime = a.exectime ?? "",
+ execuser = e.RealName ?? "",
+ mo_task_code = a.mo_task_code,
+ batch = a.batch,
+ qty = a.qty,
+ equip_name = h.name,
+ checktypes = new List>(),
+ }).FirstAsync();
+ Result.checktypes = new List>();
if (!string.IsNullOrEmpty(QcCheckExecH.carry_code))
{
WmsCarryH carryH = await db.Queryable().FirstAsync(x => x.carry_code == QcCheckExecH.carry_code);
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPrdInstockHService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPrdInstockHService.cs
index ba7b5454..755fbb68 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPrdInstockHService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPrdInstockHService.cs
@@ -7,13 +7,17 @@ using System.Threading.Tasks;
using JNPF.Common.Core.Manager;
using JNPF.Common.Dtos.VisualDev;
using JNPF.Common.Enums;
+using JNPF.Common.Security;
using JNPF.FriendlyException;
+using JNPF.Systems.Entitys.Permission;
+using JNPF.Systems.Entitys.System;
using JNPF.Systems.Interfaces.System;
using JNPF.VisualDev;
using JNPF.VisualDev.Entitys;
using JNPF.VisualDev.Interfaces;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
+using NPOI.Util;
using SqlSugar;
using Tnb.BasicData;
using Tnb.BasicData.Entities;
@@ -25,6 +29,7 @@ using Tnb.WarehouseMgr.Entities.Dto;
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
using Tnb.WarehouseMgr.Entities.Entity;
using Tnb.WarehouseMgr.Interfaces;
+using Tnb.ProductionMgr.Entities.Entity;
namespace Tnb.WarehouseMgr
{
@@ -319,8 +324,110 @@ namespace Tnb.WarehouseMgr
// 如果生产入库 输送线到仓库这条任务完成,反写单据数据
if (input.bizTypeId == WmsWareHouseConst.BIZTYPE_WMSPRDINSTOCK_ID)
{
- isOk = await _db.Updateable().SetColumns(it => new WmsPrdInstockD { status = WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID })
- .Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync();
+ isOk = await _db.Updateable()
+ .SetColumns(it => new WmsPrdInstockD { status = WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID })
+ .Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync();
+
+ WmsPrdInstockD wmsPrdInstockD = await _db.Queryable().SingleAsync(x=>x.id==input.requireId);
+ WmsPrdInstockH instock = await _db.Queryable().SingleAsync(x=>x.id==wmsPrdInstockD.prd_instock_id);
+ BasWarehouse scWarehouse = await _db.Queryable().SingleAsync(x=>x.id==wmsPrdInstockD.scwarehouse_id);
+ BasWarehouse kcWarehouse = await _db.Queryable().SingleAsync(x=>x.id==wmsPrdInstockD.warehouse_id);
+ //todo 产成品入库
+ List allInstockDetails = await _db.Queryable().Where(it => it.prd_instock_id == instock.id).ToListAsync();
+
+
+ List materialIds = Arrays.AsList(instock.material_id);
+ List unitCodes = allInstockDetails.Select(x => x.unit_id).Distinct().ToList();
+ List unitDatas = await _db.Queryable()
+ .LeftJoin((x, y) => x.Id == y.DictionaryTypeId)
+ .Where((x, y) => x.EnCode == DictConst.MeasurementUnit && unitCodes.Contains(y.EnCode))
+ .Select((x, y) => y)
+ .ToListAsync();
+ List erpWarehouserelaHs = await _db.Queryable().Where(x=>x.id!=null).ToListAsync();
+ string userId = instock?.create_id ?? WmsWareHouseConst.AdministratorUserId;
+
+ string supplierId = WmsWareHouseConst.TIANYIGONGYINGSHANG_ID;
+ List tableIds = new List();
+ tableIds.Add(userId);
+ tableIds.Add(WmsWareHouseConst.AdministratorOrgId);
+ tableIds.AddRange(materialIds);
+ tableIds.Add(supplierId);
+ tableIds.AddRange(unitDatas.Select(x => x.Id).ToList());
+
+ List erpExtendFields = await _db.Queryable().Where(x => tableIds.Contains(x.table_id)).ToListAsync();
+ string erpCreateId = erpExtendFields.Find(x => x.table_id == userId)?.user_id ?? "";
+ ErpExtendField erpOrg = erpExtendFields.Find(x => x.table_id == (WmsWareHouseConst.AdministratorOrgId));
+ string nowStr = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+
+ List> requestData = new List>();
+ Dictionary erpRequestData = new Dictionary();
+ erpRequestData.Add("billmaker", erpCreateId);
+ erpRequestData.Add("corpoid", erpOrg.corpoid);
+ erpRequestData.Add("corpvid", erpOrg.corpvid);
+ erpRequestData.Add("cprocalbodyoid", erpOrg.pk_org_v);
+ erpRequestData.Add("cprocalbodyvid", erpOrg.pk_group);
+ erpRequestData.Add("creationtime", nowStr);
+ erpRequestData.Add("creator", erpCreateId);
+ erpRequestData.Add("ctrantypeid", "0001H11000000000D30X");//先写死
+ erpRequestData.Add("cprowarehouseid", erpWarehouserelaHs.Find(x=>x.wms_warehousecode==scWarehouse.whcode)?.erp_warehouseid ?? "");//先写死
+ erpRequestData.Add("cwarehouseid", erpWarehouserelaHs.Find(x=>x.wms_warehousecode==kcWarehouse.whcode)?.erp_warehouseid ?? "");//先写死
+ erpRequestData.Add("cwhsmanagerid", null);
+ erpRequestData.Add("dbilldate", nowStr);
+ erpRequestData.Add("dmakedate", nowStr);
+ erpRequestData.Add("fbillflag", 1);
+ erpRequestData.Add("ntotalnum", allInstockDetails.Sum(x=>x.pqty));
+ 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", instock.bill_code);
+ erpRequestData.Add("vtrantypecode", "46-01");
+ erpRequestData.Add("csourcebillhid", "");//todo 后面填
+
+
+ List> erpRequestDataDetails = new List>();
+ foreach (WmsPrdInstockCode item in allInstockDetails)
+ {
+ erpRequestDataDetails.Add(new Dictionary()
+ {
+ ["cbodytranstypecode"] = "46-01",
+ ["cbodywarehouseid"] = erpWarehouserelaHs.Find(x=>x.wms_warehousecode==kcWarehouse.whcode)?.erp_warehouseid ?? "",
+ ["cmaterialoid"] = erpExtendFields.Find(x => x.table_id == instock.material_id)?.cmaterialoid ?? "",
+ ["cmaterialvid"] = erpExtendFields.Find(x => x.table_id == instock.material_id)?.cmaterialvid ?? "",
+ ["corpoid"] = erpOrg.corpoid,
+ ["corpvid"] = erpOrg.corpvid,
+ ["cproductid"] = erpExtendFields.Find(x => x.table_id == instock.material_id)?.cmaterialoid ?? "",
+ ["fproductclass"] = 1,
+ ["crowno"] = (allInstockDetails.FindIndex(x => x.id == item.id) + 1) * 10,
+ ["csourcebillhid"] = "",
+ ["csourcebillbid"] = "",
+ ["cunitid"] = erpExtendFields.Find(x => x.table_id == (unitDatas.Find(x => x.EnCode == item.unit_id)?.Id ?? ""))?.cunitid ?? "",
+ ["cvendorid"] = erpExtendFields.Find(x => x.table_id == supplierId)?.supplier_id ?? "",
+ ["cvendorvid"] = erpExtendFields.Find(x => x.table_id == supplierId)?.supplier_vid ?? "",
+ ["dbizdate"] = instock.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
+ ["dplanarrivedate"] = instock.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
+ ["dplanoutdate"] = instock.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
+ ["nnum"] = item.pqty,
+ ["nshouldnum"] = item.pqty,
+ ["pk_group"] = erpOrg.pk_group,
+ ["pk_org"] = erpOrg.pk_org,
+ ["pk_org_v"] = erpOrg.pk_org_v,
+ ["vbatchcode"] = item.code_batch,
+ });
+ }
+ erpRequestData.Add("dtls", erpRequestDataDetails);
+ requestData.Add(erpRequestData);
+ BasFactoryConfig config = await _db.Queryable().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.BIPURL);
+ ThirdWebapiRecord thirdWebapiRecord = new ThirdWebapiRecord();
+ thirdWebapiRecord.id = SnowflakeIdHelper.NextId();
+ thirdWebapiRecord.third_name = WmsWareHouseConst.BIP;
+ thirdWebapiRecord.name = "产成品入库";
+ thirdWebapiRecord.method = "POST";
+ thirdWebapiRecord.url = config.value + "uapws/rest/productin/save";
+ // thirdWebapiRecord.url = WmsWareHouseConst.BIP_DOMAIN + "uapws/rest/transIn/save";
+ thirdWebapiRecord.request_data = JsonConvert.SerializeObject(requestData);
+ thirdWebapiRecord.create_time = DateTime.Now;
+ await _db.Insertable(thirdWebapiRecord).ExecuteCommandAsync();
+
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsRawmatTransferinstockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsRawmatTransferinstockService.cs
index 5430da4e..4b93db57 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsRawmatTransferinstockService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsRawmatTransferinstockService.cs
@@ -101,7 +101,7 @@ namespace Tnb.WarehouseMgr
string userAccount = wmsRawmatTransferinstockH?.biller ?? "";
string deptCode = wmsRawmatTransferinstockH?.dept_code ?? "";
UserEntity userEntity = await _db.Queryable().Where(x=>x.Account==userAccount).FirstAsync();
- string userId = userEntity?.Id ?? "";
+ string userId = userEntity?.Id ?? WmsWareHouseConst.AdministratorUserId;
string supplierId = WmsWareHouseConst.TIANYIGONGYINGSHANG_ID;
List tableIds = new List();