备料计划优化
This commit is contained in:
parent
939f7ea0d1
commit
4bcbbe8cb0
|
@ -0,0 +1,101 @@
|
|||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package nccloud.web.mmpac.issue.action;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import nc.itf.mmpac.pickm.IPickmBusinessService;
|
||||
import nc.util.mmf.framework.base.MMArrayUtil;
|
||||
import nc.vo.mmpac.pickm.entity.AggPickmVO;
|
||||
import nc.vo.mmpac.pickm.entity.PickmItemVO;
|
||||
import nc.vo.mmpac.pickm.entity.PickmViewVO;
|
||||
import nccloud.dto.mmpac.pickm.pub.entity.PickmDeliverDTO;
|
||||
import nccloud.framework.core.exception.ExceptionUtils;
|
||||
import nccloud.framework.core.json.IJson;
|
||||
import nccloud.framework.service.ServiceLocator;
|
||||
import nccloud.framework.web.action.itf.ICommonAction;
|
||||
import nccloud.framework.web.container.IRequest;
|
||||
import nccloud.framework.web.json.JsonFactory;
|
||||
import nccloud.framework.web.ui.pattern.grid.Grid;
|
||||
import nccloud.framework.web.ui.pattern.grid.GridOperator;
|
||||
import nccloud.web.mmpac.issue.scale.IssueScaleForPickm;
|
||||
import nccloud.web.mmpac.issue.util.IssueInitDataUtil;
|
||||
import nccloud.web.mmpac.issue.util.IssueMapCatch;
|
||||
import nccloud.web.mmpac.issue.view.IssueValueHandle;
|
||||
import nccloud.web.mmpac.pwr.util.PwrUtil;
|
||||
|
||||
public class IssueQueryFromPickmAction implements ICommonAction {
|
||||
public IssueQueryFromPickmAction() {
|
||||
}
|
||||
|
||||
public Object doAction(IRequest request) {
|
||||
try {
|
||||
IJson json = JsonFactory.create();
|
||||
PickmDeliverDTO dto = (PickmDeliverDTO)json.fromJson(request.read(), PickmDeliverDTO.class);
|
||||
IPickmBusinessService service = (IPickmBusinessService)ServiceLocator.find(IPickmBusinessService.class);
|
||||
AggPickmVO[] aggPickVO = null;
|
||||
if (dto.getDeliverType() == 1) {
|
||||
aggPickVO = service.getDeliverAggVOByIDs((String[])null, dto.getCpickmbids());
|
||||
} else {
|
||||
aggPickVO = service.getSetDeliverAggVOByParams(dto.getSetParams(), dto.getDeliverType());
|
||||
}
|
||||
|
||||
List<PickmViewVO> list = new ArrayList();
|
||||
if(null!=aggPickVO){
|
||||
for(AggPickmVO aggVO : aggPickVO) {
|
||||
PickmItemVO[] itemVOs = (PickmItemVO[])aggVO.getChildren(PickmItemVO.class);
|
||||
if (!MMArrayUtil.isEmpty(itemVOs)) {
|
||||
for(PickmItemVO itemVO : itemVOs) {
|
||||
PickmViewVO pickmViewVO = new PickmViewVO();
|
||||
pickmViewVO.setItem(itemVO);
|
||||
pickmViewVO.setHead(aggVO.getParentVO());
|
||||
pickmViewVO.setPrimaryKey(aggVO.getPrimaryKey());
|
||||
list.add(pickmViewVO);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
}
|
||||
PickmViewVO[] vos = new PickmViewVO[0];
|
||||
if(list.size() > 0){
|
||||
vos = (PickmViewVO[])list.toArray(new PickmViewVO[0]);
|
||||
}else{
|
||||
PickmViewVO pickmViewVO = new PickmViewVO();
|
||||
return new Grid();
|
||||
}
|
||||
String pageCode = "5008010501";
|
||||
if (dto.getIsDispersed() != null && dto.getIsDispersed()) {
|
||||
pageCode = "5009010501";
|
||||
}
|
||||
|
||||
if (dto.getPageCode() != null) {
|
||||
pageCode = dto.getPageCode();
|
||||
}
|
||||
|
||||
GridOperator operator = new GridOperator(pageCode);
|
||||
Grid grid = operator.toGrid(vos);
|
||||
IssueMapCatch mc = IssueInitDataUtil.fillCatchInitDataForPickm(vos);
|
||||
IssueValueHandle.setIssuePickmValue(grid, vos, mc);
|
||||
IssueMapCatch returnMc = new IssueMapCatch();
|
||||
returnMc.setIsWWMap(mc.getIsWWMap());
|
||||
returnMc.setDeliveryOrgMap(mc.getDeliveryOrgMap());
|
||||
String issuePickmCache = json.toJson(returnMc);
|
||||
grid.setUserjson(issuePickmCache);
|
||||
this.afterProcess(grid);
|
||||
PwrUtil pwrUtil = new PwrUtil();
|
||||
pwrUtil.dealGridFlow(grid);
|
||||
return grid;
|
||||
} catch (Exception e) {
|
||||
ExceptionUtils.wrapException(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void afterProcess(Grid grid) {
|
||||
IssueScaleForPickm scaleUtil = new IssueScaleForPickm();
|
||||
scaleUtil.processGrid(grid);
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ package nccloud.web.mmpac.pickm.action;
|
|||
|
||||
import nc.bs.dao.BaseDAO;
|
||||
import nc.bs.dao.DAOException;
|
||||
import nc.bs.framework.common.InvocationInfoProxy;
|
||||
import nc.itf.ic.m4a.IGeneralInMaintain;
|
||||
import nc.itf.mmpac.pickm.IPickmQueryService;
|
||||
import nc.itf.pu.m20.IPraybillMaintain;
|
||||
|
@ -103,11 +104,24 @@ public class PickmToBuyingreqAction implements ICommonAction {
|
|||
for (PraybillVO inVO : inVOS) {
|
||||
// 其它入库单的仓库、交易类型取自【业务参数设置】的默认值
|
||||
PraybillHeaderVO head = inVO.getHVO();
|
||||
head.setCtrantypeid("0001A110000000001S1E");
|
||||
String ctrantypeid = getValueByCondtion("bd_billtype", " pk_billtypeid ", " istransaction = 'Y' and nvl ( islock, 'N' ) = 'N' and parentbilltype = '20' and pk_group = '"
|
||||
+ InvocationInfoProxy.getInstance().getGroupId() + "' and pk_billtypecode = '" + "20-01" + "' ");
|
||||
head.setCtrantypeid(ctrantypeid);
|
||||
// head.setCwarehouseid("");
|
||||
}
|
||||
return inVOS;
|
||||
}
|
||||
private String getValueByCondtion(String tablename, String fieldname, String contion) throws BusinessException {
|
||||
BaseDAO dao = new BaseDAO();
|
||||
|
||||
String result = "";
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(" SELECT " + fieldname + " FROM " + tablename + " ");
|
||||
sb.append(" WHERE nvl(" + tablename + " .dr,0)= 0 ");
|
||||
sb.append(" and " + contion + " ");
|
||||
result = (String) dao.executeQuery(sb.toString(), new ColumnProcessor());
|
||||
return result;
|
||||
}
|
||||
|
||||
private void updetaPmo(List<String> arrayList) throws DAOException {
|
||||
String result = "";
|
||||
|
|
|
@ -2,6 +2,7 @@ package nccloud.web.mmpac.pickm.action;
|
|||
|
||||
import nc.bs.dao.BaseDAO;
|
||||
import nc.bs.dao.DAOException;
|
||||
import nc.bs.framework.common.InvocationInfoProxy;
|
||||
import nc.itf.mmpac.pickm.IPickmQueryService;
|
||||
import nc.itf.mmpac.pmo.pac0002.IPMOMaintainService;
|
||||
import nc.itf.pu.m20.IPraybillMaintain;
|
||||
|
@ -129,8 +130,10 @@ public class PickmToPmo implements ICommonAction {
|
|||
for (PMOAggVO inVO : inVOS) {
|
||||
// 其它入库单的仓库、交易类型取自【业务参数设置】的默认值
|
||||
PMOHeadVO head = inVO.getParentVO();
|
||||
head.setCtrantypeid("0001A110000000001S1E");
|
||||
|
||||
// head.setCtrantypeid("0001A110000000001S1E");
|
||||
String ctrantypeid = getValueByCondtion("bd_billtype", " pk_billtypeid ", " istransaction = 'Y' and nvl ( islock, 'N' ) = 'N' and parentbilltype = '55A2' and pk_group = '"
|
||||
+ InvocationInfoProxy.getInstance().getGroupId() + "' and pk_billtypecode = '" + "55A2-01" + "' ");
|
||||
head.setCtrantypeid(ctrantypeid);
|
||||
for (PMOItemVO itemVO: inVO.getChildrenVO()){
|
||||
|
||||
}
|
||||
|
@ -138,7 +141,17 @@ public class PickmToPmo implements ICommonAction {
|
|||
}
|
||||
return inVOS;
|
||||
}
|
||||
private String getValueByCondtion(String tablename, String fieldname, String contion) throws BusinessException {
|
||||
BaseDAO dao = new BaseDAO();
|
||||
|
||||
String result = "";
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(" SELECT " + fieldname + " FROM " + tablename + " ");
|
||||
sb.append(" WHERE nvl(" + tablename + " .dr,0)= 0 ");
|
||||
sb.append(" and " + contion + " ");
|
||||
result = (String) dao.executeQuery(sb.toString(), new ColumnProcessor());
|
||||
return result;
|
||||
}
|
||||
public AggPickmVO[] processAggVOs(AggPickmVO[] aggVOs) throws DAOException {
|
||||
Map<Object, List<AggPickmVO>> groupMap = new HashMap<>();
|
||||
|
||||
|
@ -161,21 +174,54 @@ public class PickmToPmo implements ICommonAction {
|
|||
|
||||
// 未下达子表 切 若物料类型为“制造件”,则备料计划中所有制造件件生成一张开立状态的流程生产订单
|
||||
if(null != child.getVbdef13() && child.getVbdef13().equals("Y") ){
|
||||
continue;
|
||||
// continue;
|
||||
}
|
||||
String rowno=child.getVrowno();
|
||||
String materalType = child.getVbdef14();
|
||||
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 || "PR".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 = (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 || "".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)){
|
||||
continue;
|
||||
}
|
||||
}else {
|
||||
String sql="SELECT\n" +
|
||||
"\n" +
|
||||
" bd_defdoc.code \n" +
|
||||
"FROM\n" +
|
||||
" bd_defdoc where bd_defdoc.bd_defdoc.pk_defdoc='" + materalType + "'";
|
||||
BaseDAO dao = new BaseDAO();
|
||||
String bomcode = (String) dao.executeQuery(sql, new ColumnProcessor());
|
||||
if(null == bomcode || "2".equals(bomcode) || "".equals(bomcode) ){
|
||||
continue;
|
||||
}
|
||||
}else if("1".equals(materalType)){
|
||||
continue;
|
||||
}
|
||||
//只合并项目专用料数据
|
||||
if(child.getBprojectmaterial().booleanValue()){
|
||||
|
|
|
@ -98,7 +98,7 @@ public class PickmDeliverAction implements ICommonAction {
|
|||
// 流程生产订单明细表
|
||||
String id=agg.getParentVO().getVfirstmorowid();
|
||||
if(null != id &&!id.isEmpty()){
|
||||
String sql = "SELECT m.twillendtime from mm_mo m "+
|
||||
String sql = "SELECT m.tplanendtime from mm_mo m "+
|
||||
"WHERE\n" +
|
||||
"\tm.cmoid = '"+id+"' ";
|
||||
BaseDAO dao = new BaseDAO();
|
||||
|
@ -106,7 +106,7 @@ public class PickmDeliverAction implements ICommonAction {
|
|||
|
||||
UFDate now=new UFDate();
|
||||
// 领料校验 当前时间必须在计划结束时间前七天
|
||||
if(null!=data && (now.compareTo(new UFDate(data)) >0 || now.getDateAfter(7).compareTo(new UFDate(data)) >0)){
|
||||
if(null!=data && (now.compareTo(new UFDate(data)) >0 || now.getDateAfter(7).compareTo(new UFDate(data)) <0)){
|
||||
continue;
|
||||
};
|
||||
|
||||
|
@ -124,10 +124,9 @@ public class PickmDeliverAction implements ICommonAction {
|
|||
deliverAppcode = "400802808";
|
||||
deliverPagecode = "5008010501";
|
||||
}
|
||||
if(pks.isEmpty()){
|
||||
pks.add("");
|
||||
}
|
||||
|
||||
// if(pks.isEmpty()){
|
||||
// pks.add("");
|
||||
// }
|
||||
Map<String, Object> returnMap = new HashMap();
|
||||
returnMap.put("pks", pks.toArray(new String[0]));
|
||||
returnMap.put("success", true);
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package nc.bs.mmpac.pickm.bp.rule;
|
||||
|
||||
|
||||
import nc.bs.framework.common.NCLocator;
|
||||
import nc.bs.logging.Log;
|
||||
import nc.bs.mmpac.pmo.pac0002.bp.rule.util.SyncEpicMesUtil;
|
||||
import nc.impl.pubapp.pattern.rule.IRule;
|
||||
import nc.itf.gl.pub.IFreevaluePub;
|
||||
import nc.itf.mmpac.pmo.pac0002.IPMOMaintainService;
|
||||
import nc.itf.mmpac.pmo.pac0002.IPMOQueryService;
|
||||
import nc.util.mmf.framework.base.MMValueCheck;
|
||||
|
@ -35,7 +37,7 @@ public class AfterupdateSyncEpicMesRule implements IRule<AggPickmVO> {
|
|||
|
||||
for (AggPickmVO aggPickmVO : aggPickmVOS) {
|
||||
|
||||
IPMOQueryService queryService= ServiceLocator.find(IPMOQueryService.class);
|
||||
IPMOQueryService queryService= NCLocator.getInstance().lookup(IPMOQueryService.class);
|
||||
List<PMOAggVO> list = new ArrayList<PMOAggVO>();
|
||||
if(null!=aggPickmVO.getParentVO().getVfirstbilltype() && aggPickmVO.getParentVO().getVfirstbilltype().indexOf("55A2")!=-1){
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue