|
|
@@ -4471,7 +4471,7 @@ namespace Business.ResourceExamineManagement
|
|
|
/// <param name="stocklist"></param>
|
|
|
/// <param name="sklist"></param>
|
|
|
/// <exception cref="NotImplementedException"></exception>
|
|
|
- public void DataInitialization(List<mo_ic_bom> boms, long bangid, List<mo_ic_item> icitemlist, List<mo_ic_item_stock> stocklist, List<b_bom_pretreatment> pretreatments, List<mo_ic_item_stockoccupy> sklist)
|
|
|
+ public void DataInitialization(List<mo_ic_bom> boms, long bangid, List<mo_ic_item> icitemlist, List<mo_ic_item_stock> stocklist, List<b_bom_pretreatment> pretreatments, List<mo_ic_item_stockoccupy> sklist, bool writeNum = false)
|
|
|
{
|
|
|
List<long> itemIds = pretreatments.Select(p => p.item_id.GetValueOrDefault()).Distinct().ToList();
|
|
|
icitemlist.AddRange(_ic_item.GetListAsync(p => itemIds.Contains(p.mysql_id) && !p.IsDeleted).Result);
|
|
|
@@ -4516,20 +4516,18 @@ namespace Business.ResourceExamineManagement
|
|
|
leadTimeList = GetLeadTime(icitemlist, param.company_id, param.factoryId);//提前期列表
|
|
|
supplierList = GetSupplier(itemIds, param.company_id, param.factoryId);//供应商列表
|
|
|
|
|
|
- //交期回复
|
|
|
- var sql = $"select b.id as polist_id,b.po_id,a.id,a.wlbm,a.cgdd,a.ddhh,iif(a.jhdsl>c.QtyOrded,c.QtyOrded,a.jhdsl) as jhdsl,TRY_CONVERT(DATE,jqhf, 23) as jqhf,a.flag,a.gysdm,b.pr_purchase_id " +
|
|
|
- $"from (select wlbm,cgdd,ddhh,flag,gysdm,sum(cast(isnull(jhdsl,0) as decimal(18,8))) as jhdsl,max(TRY_CONVERT(DATE,jqhf, 23)) as jqhf,max(id) as id from scm_jhjh_jq where flag =0 or (flag=2 and DATEDIFF(DAY, isnull(TRY_CONVERT(DATE,jqhf, 23),GETDATE()), GETDATE())>=1 ) group by wlbm,cgdd,ddhh,flag,gysdm) a " +
|
|
|
- $"inner join srm_po_list b on a.cgdd=b.po_billno and a.ddhh=b.polist_row inner join PurOrdDetail c on b.po_billno=c.PurOrd and b.polist_row=c.Line where c.status!='C' and c.QtyOrded>c.RctQty";
|
|
|
- _CalcBomViewAppService.scm_Jhjh_Jqs = _businessDbContext.scm_jhjh_jqDto.FromSqlRaw(sql).ToList();
|
|
|
- //送货单子表所有未完成的数据
|
|
|
- sql = $"select b.id,[po_billline],[jhdbh],isnull([shzt],'待收') shzt,[jhdhh] ,b.sh_material_code,b.sh_material_name,b.po_bill,b.sh_delivery_quantity,a.sh_purchase_num,c.id as sh_purchase_id,CONVERT(DATE,a.jhshrq,23) jhshrq,CONVERT(DATE,a.yjdhrq,23) yjdhrq,d.id as polist_id " +
|
|
|
- $"from scm_shd a INNER join scm_shdzb b on a.id=b.glid INNER join srm_po_list d on b.sh_material_code=d.ItemNum and b.po_bill=d.po_billno and b.po_billline=d.polist_row left join srm_supplier c on a.sh_purchase_num=c.supplier_no where jhdbh!='' and isnull([shzt],'待收')!='完成'";
|
|
|
- _CalcBomViewAppService.scm_Shdzbs = _businessDbContext.scm_shdzbDto.FromSqlRaw(sql).ToList();
|
|
|
-
|
|
|
- //在检数据
|
|
|
- //sql = $"select b.id,[po_billline],[jhdbh],isnull([shzt],'待收') shzt,[jhdhh] ,b.sh_material_code,b.sh_material_name,b.po_bill,b.sh_delivery_quantity,a.sh_purchase_num,c.id as sh_purchase_id,CONVERT(DATE,a.jhshrq,23) jhshrq,CONVERT(DATE,a.yjdhrq,23) yjdhrq,d.id as polist_id " +
|
|
|
- // $"from scm_shd a INNER join scm_shdzb b on a.id=b.glid INNER join srm_po_list d on b.sh_material_code=d.ItemNum and b.po_bill=d.po_billno and b.po_billline=d.polist_row left join srm_supplier c on a.sh_purchase_num=c.supplier_no where jhdbh!='' and isnull([shzt],'待收')!='完成'";
|
|
|
- //_CalcBomViewAppService.scm_Shdzbs = _businessDbContext.scm_shdzbDto.FromSqlRaw(sql).ToList();
|
|
|
+ //交期回复
|
|
|
+ var sql = $"select b.id as polist_id,b.po_id,a.id,a.wlbm,a.cgdd,a.ddhh,iif(a.jhdsl>c.QtyOrded,c.QtyOrded,a.jhdsl) as jhdsl,TRY_CONVERT(DATE,jqhf, 23) as jqhf,a.flag,a.gysdm,b.pr_purchase_id " +
|
|
|
+ $"from (select wlbm,cgdd,ddhh,flag,gysdm,sum(cast(isnull(jhdsl,0) as decimal(18,8))) as jhdsl,max(TRY_CONVERT(DATE,jqhf, 23)) as jqhf,max(id) as id from scm_jhjh_jq where flag =0 or (flag=2 and DATEDIFF(DAY, isnull(TRY_CONVERT(DATE,jqhf, 23),GETDATE()), GETDATE())>=1 ) group by wlbm,cgdd,ddhh,flag,gysdm) a " +
|
|
|
+ $"inner join srm_po_list b on a.cgdd=b.po_billno and a.ddhh=b.polist_row inner join PurOrdDetail c on b.po_billno=c.PurOrd and b.polist_row=c.Line where c.status!='C' and c.QtyOrded>c.RctQty";
|
|
|
+ _CalcBomViewAppService.scm_Jhjh_Jqs = _businessDbContext.scm_jhjh_jqDto.FromSqlRaw(sql).ToList();
|
|
|
+ //送货单子表所有未完成的数据,并且排除检验中数量
|
|
|
+ sql = $"select b.id,[po_billline],[jhdbh],isnull([shzt],'待收') shzt,[jhdhh] ,b.sh_material_code,b.sh_material_name,b.po_bill,b.sh_delivery_quantity-isnull(m.qty,0) as sh_delivery_quantity,a.sh_purchase_num,c.id as sh_purchase_id,CONVERT(DATE,a.jhshrq,23) jhshrq,CONVERT(DATE,a.yjdhrq,23) yjdhrq,d.id as polist_id " +
|
|
|
+ $"from scm_shd a INNER join scm_shdzb b on a.id=b.glid INNER join srm_po_list d on b.sh_material_code=d.ItemNum and b.po_bill=d.po_billno and b.po_billline=d.polist_row " +
|
|
|
+ $"left join srm_supplier c on a.sh_purchase_num=c.supplier_no left join (select PurOrd,PurLine,ShipperNbr,ShipperLine,sum(qty) as qty from MissedPrint where Status = 'I' GROUP BY PurOrd,PurLine,ShipperNbr,ShipperLine) m on b.po_bill=m.PurOrd AND b.po_billline=m.PurLine and m.ShipperNbr=a.shddh and m.ShipperLine=b.hh " +
|
|
|
+ $"where jhdbh!='' and isnull([shzt],'待收')!='完成' and (isnull(m.qty,0)=0 or isnull(m.qty,0)<b.sh_delivery_quantity) ";
|
|
|
+ _CalcBomViewAppService.scm_Shdzbs = _businessDbContext.scm_shdzbDto.FromSqlRaw(sql).ToList();
|
|
|
+
|
|
|
|
|
|
_CalcBomViewAppService.leadTimeList = leadTimeList;
|
|
|
_CalcBomViewAppService.supplierList = supplierList;
|