备料计划下达请购和生产校验时如果bom中查不到子表物料类型字段就根据bom子表虚项物料进行二次查询bom 查询虚项物料子表时候包含物料和对应物料状态
This commit is contained in:
parent
4e86dcc1af
commit
ee338de1da
|
@ -8,18 +8,23 @@ import nc.itf.mmpac.pickm.IPickmQueryService;
|
||||||
import nc.itf.pu.m20.IPraybillMaintain;
|
import nc.itf.pu.m20.IPraybillMaintain;
|
||||||
import nc.itf.uap.pf.busiflow.PfButtonClickContext;
|
import nc.itf.uap.pf.busiflow.PfButtonClickContext;
|
||||||
import nc.jdbc.framework.processor.ColumnProcessor;
|
import nc.jdbc.framework.processor.ColumnProcessor;
|
||||||
|
import nc.jdbc.framework.processor.MapListProcessor;
|
||||||
import nc.util.mmf.busi.service.PFPubService;
|
import nc.util.mmf.busi.service.PFPubService;
|
||||||
import nc.util.mmf.framework.base.MMValueCheck;
|
import nc.util.mmf.framework.base.MMValueCheck;
|
||||||
import nc.vo.ic.m4a.entity.GeneralInVO;
|
import nc.vo.ic.m4a.entity.GeneralInVO;
|
||||||
import nc.vo.mmpac.pickm.entity.AggPickmVO;
|
import nc.vo.mmpac.pickm.entity.AggPickmVO;
|
||||||
|
import nc.vo.mmpac.pickm.entity.PickmHeadVO;
|
||||||
import nc.vo.mmpac.pickm.entity.PickmItemVO;
|
import nc.vo.mmpac.pickm.entity.PickmItemVO;
|
||||||
import nc.vo.pu.m20.entity.PraybillHeaderVO;
|
import nc.vo.pu.m20.entity.PraybillHeaderVO;
|
||||||
|
import nc.vo.pu.m20.entity.PraybillItemVO;
|
||||||
import nc.vo.pu.m20.entity.PraybillVO;
|
import nc.vo.pu.m20.entity.PraybillVO;
|
||||||
import nc.vo.pub.AggregatedValueObject;
|
import nc.vo.pub.AggregatedValueObject;
|
||||||
import nc.vo.pub.BusinessException;
|
import nc.vo.pub.BusinessException;
|
||||||
import nc.vo.pub.CircularlyAccessibleValueObject;
|
import nc.vo.pub.CircularlyAccessibleValueObject;
|
||||||
import nc.vo.pub.ISuperVO;
|
import nc.vo.pub.ISuperVO;
|
||||||
import nc.vo.pub.compiler.PfParameterVO;
|
import nc.vo.pub.compiler.PfParameterVO;
|
||||||
|
import nc.vo.pub.lang.UFDouble;
|
||||||
|
import nccloud.api.rest.utils.ResultMessageUtil;
|
||||||
import nccloud.dto.mmpac.pickm.pub.entity.PickmQueryInfoDTO;
|
import nccloud.dto.mmpac.pickm.pub.entity.PickmQueryInfoDTO;
|
||||||
import nccloud.framework.core.exception.ExceptionUtils;
|
import nccloud.framework.core.exception.ExceptionUtils;
|
||||||
import nccloud.framework.core.json.IJson;
|
import nccloud.framework.core.json.IJson;
|
||||||
|
@ -66,11 +71,23 @@ public class PickmToBuyingreqAction implements ICommonAction {
|
||||||
throw new BusinessException("未检测到符合生成请购单数据,不能生成!");
|
throw new BusinessException("未检测到符合生成请购单数据,不能生成!");
|
||||||
}
|
}
|
||||||
PraybillVO[] prayVOs = convertToGeneralInVO(vos, null);
|
PraybillVO[] prayVOs = convertToGeneralInVO(vos, null);
|
||||||
|
List<Map<String,Object>> updateList = new ArrayList<>();
|
||||||
|
for (PraybillVO prayVO : prayVOs) {
|
||||||
|
for (int j=0;j<prayVO.getChildrenVO().length;j++) {
|
||||||
|
Map<String,Object> map = new HashMap<>();
|
||||||
|
PraybillItemVO praybillItemVO= (PraybillItemVO) prayVO.getChildrenVO()[j];
|
||||||
|
map.put("num",praybillItemVO.getNastnum());
|
||||||
|
map.put("pk",praybillItemVO.getCfirstbid());
|
||||||
|
updateList.add(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
List<String> pk =new ArrayList<>();
|
List<String> pk =new ArrayList<>();
|
||||||
for (AggPickmVO prayVO : vos) {
|
for (AggPickmVO prayVO : vos) {
|
||||||
PickmItemVO[] items = (PickmItemVO[]) prayVO.getChildren(PickmItemVO.class);
|
PickmItemVO[] items = (PickmItemVO[]) prayVO.getChildren(PickmItemVO.class);
|
||||||
for (int j=0;j<items.length;j++) {
|
for (int j=0;j<items.length;j++) {
|
||||||
|
// items[j].getNnum();
|
||||||
pk.add(items[j].getCpickm_bid());
|
pk.add(items[j].getCpickm_bid());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,11 +100,29 @@ public class PickmToBuyingreqAction implements ICommonAction {
|
||||||
if(!pk.isEmpty()){
|
if(!pk.isEmpty()){
|
||||||
updetaPmo(pk);
|
updetaPmo(pk);
|
||||||
}
|
}
|
||||||
|
if(!updateList.isEmpty()){
|
||||||
|
// 回写已经下达数量
|
||||||
|
updetaPmoNum(updateList);
|
||||||
|
}
|
||||||
return returnMap;
|
return returnMap;
|
||||||
} catch (Exception e) {
|
} catch (BusinessException e) {
|
||||||
ExceptionUtils.wrapException(e);
|
try {
|
||||||
|
throw new BusinessException(e.getMessage());
|
||||||
|
} catch (BusinessException ex) {
|
||||||
|
throw new RuntimeException(ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
|
}
|
||||||
|
private void updetaPmoNum(List<Map<String, Object>> updateList) throws DAOException {
|
||||||
|
BaseDAO dao = new BaseDAO();
|
||||||
|
for (Map<String, Object> updateMap : updateList) {
|
||||||
|
String sql = " update mm_pickm_b set vbdef16 = '"+((UFDouble)updateMap.get("num")).toString()+"' where mm_pickm_b.cpickm_bid ='" + updateMap.get("pk") + "'";
|
||||||
|
|
||||||
|
dao.executeUpdate(sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
private PraybillVO[] convertToGeneralInVO(AggregatedValueObject[] sourceBillVOs, PfParameterVO srcParaVo)
|
private PraybillVO[] convertToGeneralInVO(AggregatedValueObject[] sourceBillVOs, PfParameterVO srcParaVo)
|
||||||
throws BusinessException {
|
throws BusinessException {
|
||||||
|
@ -168,7 +203,17 @@ public class PickmToBuyingreqAction implements ICommonAction {
|
||||||
for (PickmItemVO child : items) {
|
for (PickmItemVO child : items) {
|
||||||
// 未下达子表 切 若物料类型为“采购件”,则备料计划中所有采购件生成一张请购单
|
// 未下达子表 切 若物料类型为“采购件”,则备料计划中所有采购件生成一张请购单
|
||||||
if(null != child.getVbdef13() && child.getVbdef13().equals("Y") ){
|
if(null != child.getVbdef13() && child.getVbdef13().equals("Y") ){
|
||||||
continue;
|
// 如果已经下达数量 大于等于 需要下达数量 则不可继续下达
|
||||||
|
if(null==child.getVbdef16() || (new UFDouble(child.getVbdef16()).compareTo(child.getNplanoutnum().sub(null!=child.getNaccoutastnum() ?child.getNaccoutastnum():UFDouble.ZERO_DBL)) >=0)){
|
||||||
|
continue;
|
||||||
|
}else{
|
||||||
|
|
||||||
|
}
|
||||||
|
// if(new UFDouble(child.getVbdef16()).compareTo(child.getNplanoutnum().add(child.getNaccoutastnum())) >0){
|
||||||
|
//
|
||||||
|
// }else{
|
||||||
|
//
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
String materalType = child.getVbdef14();
|
String materalType = child.getVbdef14();
|
||||||
if(null == materalType){
|
if(null == materalType){
|
||||||
|
@ -196,7 +241,26 @@ public class PickmToBuyingreqAction implements ICommonAction {
|
||||||
|
|
||||||
// MR=制造件;
|
// MR=制造件;
|
||||||
// PR=采购件;
|
// PR=采购件;
|
||||||
|
if(null==bomcode){
|
||||||
|
String secondsql=" 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 bd_bom.cbomid from bd_bom bd_bom WHERE bd_bom.pk_org = '"+child.getPk_org()+"' and bd_bom.hcmaterialid in (SELECT\n" +
|
||||||
|
" bd_bom_b.cmaterialvid \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 bisvirtual='Y') 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 \n" +
|
||||||
|
" bd_bom_b.dr = 0 and bd_bom_b.cmaterialvid='"+child.getCbmaterialvid()+"'";
|
||||||
|
bomcode = (String) dao.executeQuery(secondsql, new ColumnProcessor());
|
||||||
|
}
|
||||||
if(null != bomcode && "2".equals(bomcode) ){
|
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";
|
// 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());
|
// String matType = (String) dao.executeQuery(sql, new ColumnProcessor());
|
||||||
|
|
|
@ -24,6 +24,8 @@ import nc.vo.pub.BusinessException;
|
||||||
import nc.vo.pub.compiler.PfParameterVO;
|
import nc.vo.pub.compiler.PfParameterVO;
|
||||||
import nc.vo.pub.lang.Calendars;
|
import nc.vo.pub.lang.Calendars;
|
||||||
import nc.vo.pub.lang.UFDateTime;
|
import nc.vo.pub.lang.UFDateTime;
|
||||||
|
import nc.vo.pub.lang.UFDouble;
|
||||||
|
import nccloud.api.rest.utils.ResultMessageUtil;
|
||||||
import nccloud.dto.mmpac.pickm.pub.entity.PickmQueryInfoDTO;
|
import nccloud.dto.mmpac.pickm.pub.entity.PickmQueryInfoDTO;
|
||||||
import nccloud.framework.core.exception.ExceptionUtils;
|
import nccloud.framework.core.exception.ExceptionUtils;
|
||||||
import nccloud.framework.core.json.IJson;
|
import nccloud.framework.core.json.IJson;
|
||||||
|
@ -64,9 +66,14 @@ public class PickmToPmo implements ICommonAction {
|
||||||
}
|
}
|
||||||
PMOAggVO[] prayVOs = convertToGeneralInVO(vos, null);
|
PMOAggVO[] prayVOs = convertToGeneralInVO(vos, null);
|
||||||
List<String> pk =new ArrayList<>();
|
List<String> pk =new ArrayList<>();
|
||||||
|
List<Map<String,Object>> updateList = new ArrayList<>();
|
||||||
for (PMOAggVO prayVO : prayVOs) {
|
for (PMOAggVO prayVO : prayVOs) {
|
||||||
for (int j=0;j<prayVO.getChildrenVO().length;j++) {
|
for (int j=0;j<prayVO.getChildrenVO().length;j++) {
|
||||||
|
Map<String,Object> map = new HashMap<>();
|
||||||
prayVO.getChildrenVO()[j].setVrowno(String.valueOf(j*10+10));
|
prayVO.getChildrenVO()[j].setVrowno(String.valueOf(j*10+10));
|
||||||
|
map.put("num",prayVO.getChildrenVO()[j].getNastnum());
|
||||||
|
map.put("pk",prayVO.getChildrenVO()[j].getVsrcbid());
|
||||||
|
updateList.add(map);
|
||||||
pk.add(prayVO.getChildrenVO()[j].getCmoid());
|
pk.add(prayVO.getChildrenVO()[j].getCmoid());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,12 +92,31 @@ public class PickmToPmo implements ICommonAction {
|
||||||
//回写是否下方为是
|
//回写是否下方为是
|
||||||
updetaPmo(pk);
|
updetaPmo(pk);
|
||||||
}
|
}
|
||||||
|
if(!updateList.isEmpty()){
|
||||||
|
// »ØÐ´ÒѾÏ´ïÊýÁ¿
|
||||||
|
updetaPmoNum(updateList);
|
||||||
|
}
|
||||||
|
|
||||||
return returnMap;
|
return returnMap;
|
||||||
} catch (Exception e) {
|
}catch (BusinessException e) {
|
||||||
ExceptionUtils.wrapException(e);
|
try {
|
||||||
|
throw new BusinessException(e.getMessage());
|
||||||
|
} catch (BusinessException ex) {
|
||||||
|
throw new RuntimeException(ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
// return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updetaPmoNum(List<Map<String, Object>> updateList) throws DAOException {
|
||||||
|
BaseDAO dao = new BaseDAO();
|
||||||
|
for (Map<String, Object> updateMap : updateList) {
|
||||||
|
String sql = " update mm_pickm_b set vbdef16 = '"+((UFDouble)updateMap.get("num")).toString()+"' where mm_pickm_b.cpickm_bid ='" + updateMap.get("pk") + "'";
|
||||||
|
|
||||||
|
dao.executeUpdate(sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updetaPmo(List<String> arrayList) throws DAOException {
|
private void updetaPmo(List<String> arrayList) throws DAOException {
|
||||||
|
@ -216,7 +242,12 @@ public class PickmToPmo implements ICommonAction {
|
||||||
|
|
||||||
// 未下达子表 切 若物料类型为“制造件”,则备料计划中所有制造件件生成一张开立状态的流程生产订单
|
// 未下达子表 切 若物料类型为“制造件”,则备料计划中所有制造件件生成一张开立状态的流程生产订单
|
||||||
if(null != child.getVbdef13() && child.getVbdef13().equals("Y") ){
|
if(null != child.getVbdef13() && child.getVbdef13().equals("Y") ){
|
||||||
continue;
|
// continue;
|
||||||
|
if(null==child.getVbdef16() || (new UFDouble(child.getVbdef16()).compareTo(child.getNplanoutnum().sub(null!=child.getNaccoutastnum() ?child.getNaccoutastnum():UFDouble.ZERO_DBL)) >=0)){
|
||||||
|
continue;
|
||||||
|
}else{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
String rowno=child.getVrowno();
|
String rowno=child.getVrowno();
|
||||||
String materalType = child.getVbdef14();
|
String materalType = child.getVbdef14();
|
||||||
|
@ -243,7 +274,26 @@ public class PickmToPmo implements ICommonAction {
|
||||||
|
|
||||||
// MR=制造件;
|
// MR=制造件;
|
||||||
// PR=采购件;
|
// PR=采购件;
|
||||||
|
if(null==bomcode){
|
||||||
|
String secondsql=" 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 bd_bom.cbomid from bd_bom bd_bom WHERE bd_bom.pk_org = '"+child.getPk_org()+"' and bd_bom.hcmaterialid in (SELECT\n" +
|
||||||
|
" bd_bom_b.cmaterialvid \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 bisvirtual='Y') 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 \n" +
|
||||||
|
" bd_bom_b.dr = 0 and bd_bom_b.cmaterialvid='"+child.getCbmaterialvid()+"'";
|
||||||
|
bomcode = (String) dao.executeQuery(secondsql, new ColumnProcessor());
|
||||||
|
}
|
||||||
if(null != bomcode && "1".equals(bomcode) ){
|
if(null != bomcode && "1".equals(bomcode) ){
|
||||||
|
|
||||||
}else if(null != bomcode && "2".equals(bomcode)){
|
}else if(null != bomcode && "2".equals(bomcode)){
|
||||||
|
|
Loading…
Reference in New Issue