diff --git a/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs b/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs
index c5a89f52..3c7fd9a4 100644
--- a/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs
+++ b/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs
@@ -11,7 +11,11 @@ public static class DictConst
///
/// 计量单位
///
- public const string MeasurementUnit = "MeasurementUnit";
+ public const string MeasurementUnit = "MeasurementUnit";
+ ///
+ /// erp交易类型
+ ///
+ public const string TransactionType = "TransactionType";
///
/// 区域类型-工位Code
///
@@ -29,6 +33,10 @@ public static class DictConst
///
public const string RegionCategoryWorklineCode = "workline";
///
+ /// 区域类型-产线Code
+ ///
+ public const string RegionCategoryWorkstationCode = "workstation";
+ ///
/// 备品备件类型
///
public const string SparePartsType = "SparePartsType";
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
index 1b3a0a55..47c859c0 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
@@ -4092,6 +4092,15 @@ namespace Tnb.ProductionMgr
{
return await _db.Queryable().SingleAsync(x => x.id == id);
}
+
+ [HttpPost]
+ public async Task GetWorkstationByPosition(string id)
+ {
+ return await _db.Queryable()
+ .LeftJoin((a,b)=>a.OrganizeId==b.Id && b.Category==DictConst.RegionCategoryWorkstationCode)
+ .Select((a,b)=>b)
+ .FirstAsync(x => x.Id == id);
+ }
}
diff --git a/QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs b/QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs
index c7aa2a83..5d8e6c5b 100644
--- a/QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs
+++ b/QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs
@@ -120,7 +120,7 @@ namespace Tnb.QcMgr
.LeftJoin((a, b, c, d, e) => a.execuser == e.Id)
.LeftJoin((a,b,c,d,e,f)=>a.mo_task_code==f.mo_task_code)
.LeftJoin((a,b,c,d,e,f,g)=>f.eqp_id==g.id)
- .LeftJoin((a,b,c,d,e,f,g,h)=>d.OrganizeIdTree.Contains(h.Id) && h.Category == DictConst.RegionCategoryWorklineCode)
+ .LeftJoin((a,b,c,d,e,f,g,h)=>d.OrganizeIdTree.Contains(h.Id) && h.Category == DictConst.RegionCategoryWorkshopCode)
.LeftJoin((a,b,c,d,e,f,g,h,i)=>h.Id==i.OrganizeId)
.WhereIF(_userManager.LoginType=="app" && !_userManager.IsAdministrator,(a,b,c,d,e,f,g,h,i)=>i.EnCode==positionEntity.EnCode)
.WhereIF(!string.IsNullOrEmpty(materialid), (a, b, c, d, e) => a.materialid == materialid)
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsRawmatOutstockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsRawmatOutstockService.cs
index a4f53c98..273021de 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsRawmatOutstockService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsRawmatOutstockService.cs
@@ -78,102 +78,108 @@ namespace Tnb.WarehouseMgr
throw new ArgumentNullException(nameof(input));
}
- // WmsRawmatOutstockD wmsRawmatOutstockD = await _db.Queryable().SingleAsync(x=>x.id==input.requireId);
- // WmsRawmatOutstockH wmsRawmatOutstockH = await _db.Queryable().SingleAsync(x=>x.id==wmsRawmatOutstockD.bill_id);
- // List wmsCarryCodes = await _db.Queryable()
- // .Where(r => r.carry_id == input.wmsDistaskH.carry_id)
- // .Where(r => r.material_id == wmsRawmatOutstockD.material_id && r.code_batch == wmsRawmatOutstockD.batchno)
- // .ToListAsync();
- //
- // decimal qty = wmsCarryCodes.Sum(r => r.codeqty);
- //
- // List unitCodes = wmsCarryCodes.Select(x => x.unit_id).Distinct().ToList();
- // List materialIds = wmsCarryCodes.Select(x => x.material_id).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();
- //
- // string supplierId = WmsWareHouseConst.TIANYIGONGYINGSHANG_ID;
- // List tableIds = new List();
- // 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 userId = wmsRawmatOutstockH.create_id;
- // 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 wmsErpWarehouserelaHs = await _db.Queryable().Where(x=>!SqlFunc.IsNullOrEmpty(x.id)).ToListAsync();
- //
- // List> requestData = new List>();
- // Dictionary erpRequestData = new Dictionary();
- // erpRequestData.Add("billmaker", erpCreateId);
- // erpRequestData.Add("ccostdomainoid", null);
- // erpRequestData.Add("cdrawcalbodyoid", erpOrg.pk_org);
- // erpRequestData.Add("cdrawcalbodyvid", erpOrg.pk_org_v);
- // erpRequestData.Add("cdrawwarehouseid", erpOrg.pk_org_v);
- //
- // erpRequestData.Add("corpoid", erpOrg.corpoid);
- // erpRequestData.Add("corpvid", erpOrg.corpvid);
- // erpRequestData.Add("cdptid","1001A1100000001JFOPQ");//部门先写死
- // erpRequestData.Add("cdptvid","0001A1100000000AOMIQ");//部门先写死
- // erpRequestData.Add("cotherdptid","1001A1100000001JFOPQ");//部门先写死
- // erpRequestData.Add("cotherdptvid","0001A1100000000AOMIQ");//部门先写死
- // erpRequestData.Add("creationtime", nowStr);
- // erpRequestData.Add("creator", erpCreateId);
- // erpRequestData.Add("ctrantypeid", "0001H11000000000D32A");//先写死
- // erpRequestData.Add("cwarehouseid", outWhid);//先写死
- // erpRequestData.Add("dbilldate", wmsRawmatTransferoutstockH.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"));
- // erpRequestData.Add("dmakedate", nowStr);
- // erpRequestData.Add("dshldarrivedate", nowStr);
- // erpRequestData.Add("dshlddiliverdate", nowStr);
- // erpRequestData.Add("fbillflag", 1);
- // erpRequestData.Add("isbackdeliver", false);
- // erpRequestData.Add("ntotalnum", qty);
- // 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);
- // erpRequestData.Add("vtrantypecode", "4Y-01");//先写死
- //
- // List> erpRequestDataDetails = new List>();
- // foreach(var item in wmsCarryCodes)
- // {
- // // 出库数量wmsMaterialSignD.sign_qty
- // erpRequestDataDetails.Add(new Dictionary()
- // {
- // ["cmaterialoid"] = erpExtendFields.Find(x => x.table_id == item.material_id)?.cmaterialoid ?? "",
- // ["cmaterialvid"] = erpExtendFields.Find(x => x.table_id == item.material_id)?.cmaterialvid ?? "",
- // ["corpoid"] = erpOrg.corpoid,
- // ["corpvid"] = erpOrg.corpvid,
- // ["crowno"] = (wmsCarryCodes.FindIndex(x => x.id == item.id) + 1) * 10,
- // ["cunitid"] = erpExtendFields.Find(x => x.table_id == (unitDatas.Find(x => x.EnCode == item.unit_id)?.Id ?? ""))?.cunitid ?? "",
- // ["nnum"] = item.codeqty,
- // ["nshouldnum"] = item.codeqty,
- // ["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);
+ WmsRawmatOutstockD wmsRawmatOutstockD = await _db.Queryable().SingleAsync(x=>x.id==input.requireId);
+ WmsRawmatOutstockH wmsRawmatOutstockH = await _db.Queryable().SingleAsync(x=>x.id==wmsRawmatOutstockD.bill_id);
+ List wmsCarryCodes = await _db.Queryable()
+ .Where(r => r.carry_id == input.wmsDistaskH.carry_id)
+ .Where(r => r.material_id == wmsRawmatOutstockD.material_id && r.code_batch == wmsRawmatOutstockD.batchno)
+ .ToListAsync();
+
+ decimal qty = wmsCarryCodes.Sum(r => r.codeqty);
+
+ List unitCodes = wmsCarryCodes.Select(x => x.unit_id).Distinct().ToList();
+ List materialIds = wmsCarryCodes.Select(x => x.material_id).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();
+
+ DictionaryDataEntity tranTypeDataEntity = await _db.Queryable()
+ .LeftJoin((x, y) => x.Id == y.DictionaryTypeId)
+ .Where((x, y) => x.EnCode == DictConst.TransactionType && wmsRawmatOutstockH.outstock_type==y.EnCode)
+ .Select((x, y) => y)
+ .FirstAsync();
+
+ string supplierId = WmsWareHouseConst.TIANYIGONGYINGSHANG_ID;
+ List tableIds = new List();
+ tableIds.Add(WmsWareHouseConst.AdministratorOrgId);
+ tableIds.AddRange(materialIds);
+ tableIds.Add(supplierId);
+ tableIds.Add(tranTypeDataEntity?.Id);
+ tableIds.AddRange(unitDatas.Select(x => x.Id).ToList());
+
+ List erpExtendFields = await _db.Queryable().Where(x => tableIds.Contains(x.table_id)).ToListAsync();
+ string userId = wmsRawmatOutstockH.create_id;
+ 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 wmsErpWarehouserelaHs = await _db.Queryable().Where(x=>!SqlFunc.IsNullOrEmpty(x.id)).ToListAsync();
+
+ List> requestData = new List>();
+ Dictionary erpRequestData = new Dictionary();
+ erpRequestData.Add("billmaker", erpCreateId);
+ erpRequestData.Add("ccostdomainoid", null);
+ erpRequestData.Add("cdrawcalbodyoid", erpOrg.pk_org);
+ erpRequestData.Add("cdrawcalbodyvid", erpOrg.pk_org_v);
+ // erpRequestData.Add("cdrawwarehouseid", null);
+ erpRequestData.Add("cfanaceorgoid", erpOrg.pk_org);
+ erpRequestData.Add("cfanaceorgvid", erpOrg.pk_org_v);
+ erpRequestData.Add("corpoid", erpOrg.corpoid);
+ erpRequestData.Add("corpvid", erpOrg.corpvid);
+ erpRequestData.Add("creationtime", nowStr);
+ erpRequestData.Add("creator", erpCreateId);
+ erpRequestData.Add("ctrantypeid", erpExtendFields.Find(x=>x.table_id==tranTypeDataEntity?.Id)?.transaction_type_id ?? "");//先写死
+ erpRequestData.Add("cwarehouseid", wmsErpWarehouserelaHs.Find(x=>x.wms_warehousecode==wmsRawmatOutstockH.warehouse_id)?.erp_warehouseid ?? "");
+ erpRequestData.Add("dbilldate", wmsRawmatOutstockH.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"));
+ erpRequestData.Add("dmakedate", nowStr);
+ erpRequestData.Add("fbillflag", 2);
+ erpRequestData.Add("ntotalnum", qty);
+ 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", wmsRawmatOutstockH.bill_code);
+ erpRequestData.Add("vtrantypecode", wmsRawmatOutstockH.outstock_type);
+ erpRequestData.Add("vdef20", true);
+
+ List> erpRequestDataDetails = new List>();
+ foreach(var item in wmsCarryCodes)
+ {
+ // 出库数量wmsMaterialSignD.sign_qty
+ erpRequestDataDetails.Add(new Dictionary()
+ {
+ ["cbodytranstypecode"] = wmsRawmatOutstockH.outstock_type,
+ ["cmaterialoid"] = erpExtendFields.Find(x => x.table_id == item.material_id)?.cmaterialoid ?? "",
+ ["cmaterialvid"] = erpExtendFields.Find(x => x.table_id == item.material_id)?.cmaterialvid ?? "",
+ ["corpoid"] = erpOrg.corpoid,
+ ["corpvid"] = erpOrg.corpvid,
+ ["crowno"] = wmsRawmatOutstockD.lineno,
+ ["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"] = wmsRawmatOutstockH.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
+ ["nshouldnum"] = item.codeqty,
+ ["nnum"] = item.codeqty,
+ ["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/materialOut/self/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();
+ 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/materialOut/self/save";
+ // thirdWebapiRecord.url = WmsWareHouseConst.BIP_DOMAIN + "uapws/rest/transIn/save";
+ thirdWebapiRecord.request_data = JsonConvert.SerializeObject(erpRequestData);
+ thirdWebapiRecord.create_time = DateTime.Now;
+ await _db.Insertable(thirdWebapiRecord).ExecuteCommandAsync();
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSterilizationInstockHService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSterilizationInstockHService.cs
index b61eac0d..106b9887 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSterilizationInstockHService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSterilizationInstockHService.cs
@@ -176,7 +176,7 @@ namespace Tnb.WarehouseMgr
["crowno"] = (wmsCarryCodes.FindIndex(x => x.id == item.id) + 1) * 10,
["cunitid"] = erpExtendFields.Find(x => x.table_id == (unitDatas.Find(x => x.EnCode == item.unit_id)?.Id ?? ""))?.cunitid ?? "",
["nnum"] = item.codeqty,
- ["nshouldnum"] = item.codeqty,
+ ["nassistnum"] = item.codeqty,
["pk_group"] = erpOrg.pk_group,
["pk_org"] = erpOrg.pk_org,
["pk_org_v"] = erpOrg.pk_org_v,