备料计划领料和下达优化
This commit is contained in:
parent
93ef0d982a
commit
1ebc5d225c
|
|
@ -75,7 +75,7 @@ public class PickmCheckIsToAction implements ICommonAction {
|
|||
String bomcode = null;
|
||||
if ("1".equals(type)) { // 请购单查询逻辑
|
||||
sql="SELECT bd_defdoc.code FROM bd_bom_b " +
|
||||
"LEFT JOIN bd_defdoc ON bd_bom_b.vdef1 = bd_defdoc.pk_defdoc " +
|
||||
"LEFT JOIN bd_defdoc ON bd_bom_b.vdef14 = bd_defdoc.pk_defdoc " +
|
||||
"WHERE 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' ) " +
|
||||
|
|
@ -84,7 +84,7 @@ public class PickmCheckIsToAction implements ICommonAction {
|
|||
bomcode = (String) dao.executeQuery(sql, new ColumnProcessor());
|
||||
} else if ("2".equals(type)) { // 生产订单查询逻辑
|
||||
sql="SELECT bd_defdoc.code FROM bd_bom_b " +
|
||||
"LEFT JOIN bd_defdoc ON bd_bom_b.vdef1 = bd_defdoc.pk_defdoc " +
|
||||
"LEFT JOIN bd_defdoc ON bd_bom_b.vdef14 = bd_defdoc.pk_defdoc " +
|
||||
"WHERE 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' ) " +
|
||||
|
|
@ -97,11 +97,11 @@ public class PickmCheckIsToAction implements ICommonAction {
|
|||
if (null == bomcode) {
|
||||
if ("1".equals(type)) { // 请购单二次查询
|
||||
String secondsql=" SELECT bd_defdoc.code FROM bd_bom_b " +
|
||||
"LEFT JOIN bd_defdoc ON bd_bom_b.vdef1 = bd_defdoc.pk_defdoc " +
|
||||
"LEFT JOIN bd_defdoc ON bd_bom_b.vdef14 = bd_defdoc.pk_defdoc " +
|
||||
"WHERE 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 bd_bom_b.cmaterialvid FROM bd_bom_b " +
|
||||
"LEFT JOIN bd_defdoc ON bd_bom_b.vdef1 = bd_defdoc.pk_defdoc " +
|
||||
"LEFT JOIN bd_defdoc ON bd_bom_b.vdef14 = bd_defdoc.pk_defdoc " +
|
||||
"WHERE 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' ) " +
|
||||
|
|
@ -112,11 +112,11 @@ public class PickmCheckIsToAction implements ICommonAction {
|
|||
bomcode = (String) dao.executeQuery(secondsql, new ColumnProcessor());
|
||||
} else if ("2".equals(type)) { // 生产订单二次查询
|
||||
String secondsql=" SELECT bd_defdoc.code FROM bd_bom_b " +
|
||||
"LEFT JOIN bd_defdoc ON bd_bom_b.vdef1 = bd_defdoc.pk_defdoc " +
|
||||
"LEFT JOIN bd_defdoc ON bd_bom_b.vdef14 = bd_defdoc.pk_defdoc " +
|
||||
"WHERE 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 bd_bom_b.cmaterialvid FROM bd_bom_b " +
|
||||
"LEFT JOIN bd_defdoc ON bd_bom_b.vdef1 = bd_defdoc.pk_defdoc " +
|
||||
"LEFT JOIN bd_defdoc ON bd_bom_b.vdef14 = bd_defdoc.pk_defdoc " +
|
||||
"WHERE 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' ) " +
|
||||
|
|
@ -127,28 +127,51 @@ public class PickmCheckIsToAction implements ICommonAction {
|
|||
bomcode = (String) dao.executeQuery(secondsql, new ColumnProcessor());
|
||||
}
|
||||
}
|
||||
|
||||
// 判断是否为不符合条件的数据(根据类型可能有不同判断标准)
|
||||
if (null != bomcode && "2".equals(bomcode)) {
|
||||
isValid = false; // 采购件:不符合
|
||||
} else if (!(null != bomcode && "1".equals(bomcode))) {
|
||||
// 检查物料类型(可根据订单类型添加不同判断)
|
||||
if(bomcode != null && !bomcode.equals("")) {
|
||||
if(bomcode.equals(type)){
|
||||
isValid = false; // 不符合条件
|
||||
}
|
||||
}else{
|
||||
// 检查物料中的物料类型(可根据订单类型添加不同判断)
|
||||
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 ("1".equals(type)) {
|
||||
if ("2".equals(type)) {
|
||||
// 请购单:非制造件或PR类型不符合
|
||||
if (null == matType || "PR".equals(matType) || "".equals(matType)) {
|
||||
isValid = false;
|
||||
}
|
||||
} else if ("2".equals(type)) {
|
||||
} else if ("1".equals(type)) {
|
||||
// 生产订单:可能有更严格的过滤条件
|
||||
if (null == matType || "PR".equals(matType) || "".equals(matType) || "MO".equals(matType)) {
|
||||
if (null == matType || "MR".equals(matType) || "".equals(matType)) {
|
||||
isValid = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// // 判断是否为不符合条件的数据(根据类型可能有不同判断标准)
|
||||
// if (null != bomcode && "2".equals(bomcode)) {
|
||||
// isValid = false; // 采购件:不符合
|
||||
// } else 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 ("2".equals(type)) {
|
||||
// // 请购单:非制造件或PR类型不符合
|
||||
// if (null == matType || "PR".equals(matType) || "".equals(matType)) {
|
||||
// isValid = false;
|
||||
// }
|
||||
// } else if ("1".equals(type)) {
|
||||
// // 生产订单:可能有更严格的过滤条件
|
||||
// if (null == matType || "MR".equals(matType) || "".equals(matType)) {
|
||||
// isValid = false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
} else {
|
||||
// 有物料类型时的判断
|
||||
String sql = "SELECT bd_defdoc.code FROM bd_defdoc where bd_defdoc.pk_defdoc = '" + materalType + "'";
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ public class PickmToBuyingreqAction implements ICommonAction {
|
|||
BaseDAO dao = new BaseDAO();
|
||||
dao.executeUpdate(sql);
|
||||
}
|
||||
|
||||
// update mm_pickm_b set vbdef30='N' where mm_pickm_b.cpickm_bid='1001A11000000Z7F1F7V'
|
||||
// 增加isFromBid参数,标识是否来自cpickmbids查询
|
||||
public AggPickmVO[] processAggVOs(AggPickmVO[] aggVOs, boolean isFromBid) throws DAOException {
|
||||
List<AggPickmVO> resultList = new ArrayList<>();
|
||||
|
|
@ -247,7 +247,7 @@ public class PickmToBuyingreqAction implements ICommonAction {
|
|||
String hmateral = (String) dao.executeQuery(sql, new ColumnProcessor());
|
||||
|
||||
sql="SELECT bd_defdoc.code FROM bd_bom_b " +
|
||||
"LEFT JOIN bd_defdoc ON bd_bom_b.vdef1 = bd_defdoc.pk_defdoc " +
|
||||
"LEFT JOIN bd_defdoc ON bd_bom_b.vdef14 = bd_defdoc.pk_defdoc " +
|
||||
"WHERE 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' ) " +
|
||||
|
|
@ -257,11 +257,11 @@ public class PickmToBuyingreqAction implements ICommonAction {
|
|||
|
||||
if(null==bomcode){
|
||||
String secondsql=" SELECT bd_defdoc.code FROM bd_bom_b " +
|
||||
"LEFT JOIN bd_defdoc ON bd_bom_b.vdef1 = bd_defdoc.pk_defdoc " +
|
||||
"LEFT JOIN bd_defdoc ON bd_bom_b.vdef14 = bd_defdoc.pk_defdoc " +
|
||||
"WHERE 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 bd_bom_b.cmaterialvid FROM bd_bom_b " +
|
||||
"LEFT JOIN bd_defdoc ON bd_bom_b.vdef1 = bd_defdoc.pk_defdoc " +
|
||||
"LEFT JOIN bd_defdoc ON bd_bom_b.vdef14 = bd_defdoc.pk_defdoc " +
|
||||
"WHERE 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' ) " +
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import nc.vo.mmpac.pmo.pac0002.entity.PMOAggVO;
|
|||
import nc.vo.mmpac.pmo.pac0002.entity.PMOHeadVO;
|
||||
import nc.vo.mmpac.pmo.pac0002.entity.PMOItemVO;
|
||||
import nc.vo.pu.m20.entity.PraybillHeaderVO;
|
||||
import nc.vo.pu.m20.entity.PraybillItemVO;
|
||||
import nc.vo.pu.m20.entity.PraybillVO;
|
||||
import nc.vo.pub.AggregatedValueObject;
|
||||
import nc.vo.pub.BusinessException;
|
||||
|
|
@ -210,31 +211,37 @@ public class PickmToPmo implements ICommonAction {
|
|||
}
|
||||
}
|
||||
List<PMOAggVO> resultList = new ArrayList<>();
|
||||
Map<Object, List<PMOAggVO>> groupMap = new HashMap<>();
|
||||
|
||||
for (PMOAggVO vo : inVOS) {
|
||||
Object pk_org = vo.getParentVO().getPk_org();
|
||||
groupMap.computeIfAbsent(pk_org, k -> new ArrayList<>()).add(vo);
|
||||
}
|
||||
for (Map.Entry<Object, List<PMOAggVO>> entry : groupMap.entrySet()) {
|
||||
List<PMOAggVO> group = entry.getValue();
|
||||
|
||||
List<PMOItemVO> mergedChildren = new ArrayList<PMOItemVO>();
|
||||
for (PMOAggVO vo : group) {
|
||||
for (PMOItemVO child : vo.getChildrenVO()) {
|
||||
mergedChildren.add(child);
|
||||
}
|
||||
}
|
||||
if(mergedChildren.isEmpty()){
|
||||
continue;
|
||||
}
|
||||
PMOAggVO newVO = new PMOAggVO();
|
||||
newVO.setParent(group.get(0).getParentVO());
|
||||
newVO.setChildren(PickmItemVO.class, mergedChildren.toArray(new PMOItemVO[0]));
|
||||
|
||||
resultList.add(newVO);
|
||||
}
|
||||
return resultList.toArray(new PMOAggVO[0]);
|
||||
// // 使用特定标识表示采购员为空的情况
|
||||
// final String EMPTY_BUYER_KEY = "EMPTY_BUYER";
|
||||
// Map<String, List<PMOItemVO>> groupMap = new HashMap<>();
|
||||
//
|
||||
// // 根据采购员分单
|
||||
// for (PMOAggVO vo : inVOS) {
|
||||
// PMOItemVO[] praybillItemVOS = vo.getChildrenVO();
|
||||
// for (PMOItemVO praybillItemVO : praybillItemVOS) {
|
||||
// String pk_material = praybillItemVO.get();
|
||||
//
|
||||
// String groupKey = MMValueCheck.isEmpty(pk_material) ? EMPTY_BUYER_KEY : pk_material;
|
||||
//
|
||||
// groupMap.computeIfAbsent(groupKey, k -> new ArrayList<>()).add(praybillItemVO);
|
||||
// }
|
||||
// }
|
||||
// // 为每个分组创建新的请购单
|
||||
// for (Map.Entry<String, List<PMOItemVO>> entry : groupMap.entrySet()) {
|
||||
// List<PMOItemVO> items = entry.getValue();
|
||||
//
|
||||
// if(items.isEmpty()){
|
||||
// continue;
|
||||
// }
|
||||
// PMOHeadVO praybillHeaderVO =inVOS[0].getParentVO();
|
||||
// // 创建新的请购单,使用第一个VO的表头信息
|
||||
// PMOAggVO newVO = new PMOAggVO();
|
||||
// newVO.setParent((PMOHeadVO) praybillHeaderVO.clone()); // 复用第一个VO的表头
|
||||
// newVO.setChildrenVO(items.toArray(new PMOItemVO[0]));
|
||||
// resultList.add(newVO);
|
||||
// }
|
||||
// return resultList.toArray(new PMOAggVO[0]);
|
||||
return inVOS;
|
||||
}
|
||||
|
||||
private UFDateTime getnextmonth(UFDateTime date) {
|
||||
|
|
@ -288,7 +295,7 @@ public class PickmToPmo implements ICommonAction {
|
|||
String hmateral = (String) dao.executeQuery(sql, new ColumnProcessor());
|
||||
|
||||
sql="SELECT bd_defdoc.code FROM bd_bom_b " +
|
||||
"LEFT JOIN bd_defdoc ON bd_bom_b.vdef1 = bd_defdoc.pk_defdoc " +
|
||||
"LEFT JOIN bd_defdoc ON bd_bom_b.vdef14 = bd_defdoc.pk_defdoc " +
|
||||
"WHERE 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' ) " +
|
||||
|
|
@ -298,11 +305,11 @@ public class PickmToPmo implements ICommonAction {
|
|||
|
||||
if(null==bomcode){
|
||||
String secondsql=" SELECT bd_defdoc.code FROM bd_bom_b " +
|
||||
"LEFT JOIN bd_defdoc ON bd_bom_b.vdef1 = bd_defdoc.pk_defdoc " +
|
||||
"LEFT JOIN bd_defdoc ON bd_bom_b.vdef14 = bd_defdoc.pk_defdoc " +
|
||||
"WHERE 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 bd_bom_b.cmaterialvid FROM bd_bom_b " +
|
||||
"LEFT JOIN bd_defdoc ON bd_bom_b.vdef1 = bd_defdoc.pk_defdoc " +
|
||||
"LEFT JOIN bd_defdoc ON bd_bom_b.vdef14 = bd_defdoc.pk_defdoc " +
|
||||
"WHERE 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' ) " +
|
||||
|
|
|
|||
|
|
@ -99,6 +99,9 @@ public class PickmDeliverAction implements ICommonAction {
|
|||
Object GSDM = hybo.findColValue("org_factory", "code", " pk_factory = '" +agg.getParentVO().getPk_org() + "' ");
|
||||
|
||||
if(!GSDM.equals("C013")){
|
||||
for(PickmItemVO item : (PickmItemVO[])agg.getChildrenVO()) {
|
||||
pks.add(item.getCpickm_bid());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
for(PickmItemVO item : (PickmItemVO[])agg.getChildrenVO()) {
|
||||
|
|
@ -110,7 +113,7 @@ public class PickmDeliverAction implements ICommonAction {
|
|||
String hmateral = (String) dao.executeQuery(firstSql, new ColumnProcessor());
|
||||
|
||||
firstSql="SELECT bd_bom_b.vdef27 FROM bd_bom_b " +
|
||||
"LEFT JOIN bd_defdoc ON bd_bom_b.vdef1 = bd_defdoc.pk_defdoc " +
|
||||
"LEFT JOIN bd_defdoc ON bd_bom_b.vdef14 = bd_defdoc.pk_defdoc " +
|
||||
"WHERE bd_bom_b.cbomid in (select distinct bd_bom.cbomid from bd_bom bd_bom " +
|
||||
"where ( bd_bom.pk_org = '"+item.getPk_org()+"' AND bd_bom.hcmaterialid = '"+hmateral+"' " +
|
||||
"AND bd_bom.hfbomcategory = 1 AND bd_bom.hbcustomized = 'N' ) " +
|
||||
|
|
@ -120,11 +123,11 @@ public class PickmDeliverAction implements ICommonAction {
|
|||
|
||||
if(null==bomcode){
|
||||
String secondsql=" SELECT bd_bom_b.vdef27 FROM bd_bom_b " +
|
||||
"LEFT JOIN bd_defdoc ON bd_bom_b.vdef1 = bd_defdoc.pk_defdoc " +
|
||||
"LEFT JOIN bd_defdoc ON bd_bom_b.vdef14 = bd_defdoc.pk_defdoc " +
|
||||
"WHERE bd_bom_b.cbomid in (select bd_bom.cbomid from bd_bom bd_bom " +
|
||||
"WHERE bd_bom.pk_org = '"+item.getPk_org()+"' and bd_bom.hcmaterialid in " +
|
||||
"(SELECT bd_bom_b.cmaterialvid FROM bd_bom_b " +
|
||||
"LEFT JOIN bd_defdoc ON bd_bom_b.vdef1 = bd_defdoc.pk_defdoc " +
|
||||
"LEFT JOIN bd_defdoc ON bd_bom_b.vdef14 = bd_defdoc.pk_defdoc " +
|
||||
"WHERE bd_bom_b.cbomid in (select distinct bd_bom.cbomid from bd_bom bd_bom " +
|
||||
"where ( bd_bom.pk_org = '"+item.getPk_org()+"' AND bd_bom.hcmaterialid = '"+hmateral+"' " +
|
||||
"AND bd_bom.hfbomcategory = 1 AND bd_bom.hbcustomized = 'N' ) " +
|
||||
|
|
@ -168,9 +171,9 @@ public class PickmDeliverAction implements ICommonAction {
|
|||
deliverAppcode = "400802808";
|
||||
deliverPagecode = "5008010501";
|
||||
}
|
||||
// if(pks.isEmpty()){
|
||||
// pks.add("");
|
||||
// }
|
||||
if(pks.isEmpty()){
|
||||
throw new BusinessException("ÎŞ·ûºÏÁìÁÏÌõ¼şÊı¾İ");
|
||||
}
|
||||
Map<String, Object> returnMap = new HashMap();
|
||||
returnMap.put("pks", pks.toArray(new String[0]));
|
||||
returnMap.put("success", true);
|
||||
|
|
|
|||
Loading…
Reference in New Issue