diff --git a/Controller/SCP_PO_CONTROLLER.cs b/Controller/SCP_PO_CONTROLLER.cs index a4ad30c..74aca72 100644 --- a/Controller/SCP_PO_CONTROLLER.cs +++ b/Controller/SCP_PO_CONTROLLER.cs @@ -5803,8 +5803,8 @@ namespace CK.SCP.Controller BomList1.JsonService bomVersionRe = new BomList1.JsonService(); var _ReturnRelust = bomVersionRe.GetBom(itm.零件号, itm.原材物料号); var _Bomlist = JsonConvert.DeserializeObject>(_ReturnRelust); - var _bom = _Bomlist.First(); - maxpodetail.Singlecon = _bom.Qty; + var _bom = _Bomlist.FirstOrDefault()??null; + maxpodetail.Singlecon = _bom==null?0: _bom.Qty; var part = db.TA_PART.FirstOrDefault(t => t.PartCode == itm.原材物料号); maxpodetail.PoBillNum = maxp.PoBillNum; maxpodetail.ContractNo = maxp.PoBillNum; @@ -5812,7 +5812,7 @@ namespace CK.SCP.Controller maxpodetail.PartCode = itm.原材物料号; maxpodetail.PartNumber = itm.零件号; maxpodetail.Texture = part.ProjectId;//材质 - maxpodetail.Model = itm.车型; + maxpodetail.Model = itm.车型; maxpodetail.Finprspec = part.PartDesc2;//规格 maxpodetail.TechStandard = itm.技术标准; maxpodetail.MinordQty = decimal.Parse(itm.起定量); @@ -5919,7 +5919,7 @@ namespace CK.SCP.Controller maxuni.SubSite = maxpodetail.forecastsix;//预测6 maxuni.Site = site; maxuni.Extend2 = itm.材料厂家; - maxuni.TaxAmt = _bom.Qty;//单件消耗 + maxuni.TaxAmt = _bom ==null?0:_bom.Qty;//单件消耗 maxuni.ValidDate = DateTime.Now; maxuni.ErpLineNum = maxpodetail.PoLine; maxuni.Site = site;