diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs index 922d8fca..1a0392a5 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs @@ -2598,14 +2598,18 @@ namespace Tnb.ProductionMgr string erpCreateId = WmsWareHouseConst.ERPUSERID; ErpExtendField erpOrg = erpExtendFields.Find(x => x.table_id == (WmsWareHouseConst.AdministratorOrgId)); string nowStr = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - + ErpExtendField deptExtendField = null; + if (!string.IsNullOrEmpty(prdMo.dept_id)) + { + deptExtendField = await _db.Queryable().Where(x => x.cdptid==prdMo.dept_id).FirstAsync(); + } List> requestData = new List>(); Dictionary erpRequestData = new Dictionary(); erpRequestData.Add("auditer", erpCreateId); erpRequestData.Add("billmaker", erpCreateId); erpRequestData.Add("cdeptid", prdMo.dept_id); //部门先写死1001A1100000001JFOPQ - erpRequestData.Add("cdeptvid", erpExtendFields.Find(x=>x.cdptid==prdMo.dept_id)?.cdptvid ?? ""); //部门先写死 + erpRequestData.Add("cdeptvid", deptExtendField?.cdptvid); //部门先写死 erpRequestData.Add("taudittime", nowStr); erpRequestData.Add("creationtime", nowStr); erpRequestData.Add("creator", erpCreateId); @@ -2624,7 +2628,7 @@ namespace Tnb.ProductionMgr erpRequestDataDetails.Add(new Dictionary() { ["cbdeptid"] = prdMo.dept_id, - ["cbdeptvid"] = erpExtendFields.Find(x=>x.cdptid==prdMo.dept_id)?.cdptvid ?? "", //部门先写死 + ["cbdeptvid"] = deptExtendField?.cdptvid, ["cbmainmaterialid"] = erpExtendFields.Find(x => x.table_id == report.material_id)?.cmaterialoid ?? "", ["cbmainmaterialvid"] = erpExtendFields.Find(x => x.table_id == report.material_id)?.cmaterialvid ?? "", ["cbmaterialid"] = erpExtendFields.Find(x => x.table_id == report.material_id)?.cmaterialvid ?? "",