diff --git a/mmpac/src/client/nccloud/web/mmpac/pickm/action/PickmToBuyingreqAction.java b/mmpac/src/client/nccloud/web/mmpac/pickm/action/PickmToBuyingreqAction.java index 0f9a8be..93e2c4c 100644 --- a/mmpac/src/client/nccloud/web/mmpac/pickm/action/PickmToBuyingreqAction.java +++ b/mmpac/src/client/nccloud/web/mmpac/pickm/action/PickmToBuyingreqAction.java @@ -174,20 +174,47 @@ public class PickmToBuyingreqAction implements ICommonAction { if(null == materalType){ // MR=制造件; // PR=采购件; - String sql = " select martype from bd_materialstock where pk_material='" + child.getCbmaterialvid() + "' and pk_org='"+child.getPk_org()+"' and dr=0"; +// 1=制造件; +// 2=采购件; + String sql = " select cmaterialvid from mm_pickm where cpickmid='" + child.getCpickmid() + "' and dr=0"; BaseDAO dao = new BaseDAO(); - materalType = (String) dao.executeQuery(sql, new ColumnProcessor()); - if(null == materalType || "MR".equals(materalType) || "".equals(materalType) ){ + String hmateral = (String) dao.executeQuery(sql, new ColumnProcessor()); + + + sql="SELECT\n" + + "\n" + + " bd_defdoc.code \n" + + "FROM\n" + + " bd_bom_b \n" + + " LEFT JOIN bd_defdoc ON bd_bom_b.vdef1 = bd_defdoc.pk_defdoc\n" + + "WHERE\n" + + " bd_bom_b.cbomid in (select distinct bd_bom.cbomid from bd_bom bd_bom where ( bd_bom.pk_org = '"+child.getPk_org()+"' AND bd_bom.hcmaterialid = '"+hmateral+"' AND bd_bom.hfbomcategory = 1 AND bd_bom.hbcustomized = 'N' ) and bd_bom.dr = 0 and bd_bom.hbcustomized = 'N' and bd_bom.fbomtype != 3 ) \n" + + " AND bd_bom_b.dr = 0 and bd_bom_b.cmaterialvid='" + child.getCbmaterialvid() + "'"; + String bomcode = (String) dao.executeQuery(sql, new ColumnProcessor()); + + + // MR=制造件; + // PR=采购件; + + if(null != bomcode && "2".equals(bomcode) ){ + sql = " select martype from bd_materialstock where pk_material='" + child.getCbmaterialvid() + "' and pk_org='"+child.getPk_org()+"' and dr=0"; + String matType = (String) dao.executeQuery(sql, new ColumnProcessor()); + if(null == matType || "PR".equals(matType) || "".equals(matType)){ + continue; + } + }else if(null != bomcode && "1".equals(bomcode)){ + continue; + }else{ continue; } }else if("2".equals(materalType)){ continue; } //只合并项目专用料数据 -// if(child.getBprojectmaterial().booleanValue()){ + if(child.getBprojectmaterial().booleanValue()){ mergedChildren.add(child); -// } + } // CircularlyAccessibleValueObject 实现了 ISuperVO } } diff --git a/mmpac/src/client/nccloud/web/mmpac/pickm/action/PickmToPmo.java b/mmpac/src/client/nccloud/web/mmpac/pickm/action/PickmToPmo.java index 8eecb6b..23fff9e 100644 --- a/mmpac/src/client/nccloud/web/mmpac/pickm/action/PickmToPmo.java +++ b/mmpac/src/client/nccloud/web/mmpac/pickm/action/PickmToPmo.java @@ -174,7 +174,7 @@ public class PickmToPmo implements ICommonAction { // 未下达子表 切 若物料类型为“制造件”,则备料计划中所有制造件件生成一张开立状态的流程生产订单 if(null != child.getVbdef13() && child.getVbdef13().equals("Y") ){ - // continue; + continue; } String rowno=child.getVrowno(); String materalType = child.getVbdef14(); @@ -194,7 +194,7 @@ public class PickmToPmo implements ICommonAction { " bd_bom_b \n" + " LEFT JOIN bd_defdoc ON bd_bom_b.vdef1 = bd_defdoc.pk_defdoc\n" + "WHERE\n" + - " bd_bom_b.cbomid = (select distinct bd_bom.cbomid from bd_bom bd_bom where ( bd_bom.pk_org = '"+child.getPk_org()+"' AND bd_bom.hcmaterialid = '"+hmateral+"' AND bd_bom.hfbomcategory = 1 AND bd_bom.hbcustomized = 'N' ) and bd_bom.dr = 0 and bd_bom.hbcustomized = 'N' and bd_bom.fbomtype != 3 ) \n" + + " bd_bom_b.cbomid in (select distinct bd_bom.cbomid from bd_bom bd_bom where ( bd_bom.pk_org = '"+child.getPk_org()+"' AND bd_bom.hcmaterialid = '"+hmateral+"' AND bd_bom.hfbomcategory = 1 AND bd_bom.hbcustomized = 'N' ) and bd_bom.dr = 0 and bd_bom.hbcustomized = 'N' and bd_bom.fbomtype != 3 ) \n" + " AND bd_bom_b.dr = 0 and bd_bom_b.cmaterialvid='" + child.getCbmaterialvid() + "'"; String bomcode = (String) dao.executeQuery(sql, new ColumnProcessor()); @@ -202,13 +202,13 @@ public class PickmToPmo implements ICommonAction { // MR=制造件; // PR=采购件; - if(null == bomcode || "".equals(bomcode) ){ + if(null != bomcode && "1".equals(bomcode) ){ sql = " select martype from bd_materialstock where pk_material='" + child.getCbmaterialvid() + "' and pk_org='"+child.getPk_org()+"' and dr=0"; String matType = (String) dao.executeQuery(sql, new ColumnProcessor()); if(null == matType || "PR".equals(matType) || "".equals(matType)){ continue; } - }else if("2".equals(bomcode)){ + }else if(null != bomcode && "2".equals(bomcode)){ continue; } }else {