Merge branch 'main' of http://172.168.16.71:7070/taikai/taikai2312.git
This commit is contained in:
commit
f031caea12
|
|
@ -0,0 +1,109 @@
|
|||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package nc.bs.arap.actions;
|
||||
|
||||
import nc.bs.arap.bill.ArapBillPubUtil;
|
||||
import nc.bs.arap.util.ArapBillVOUtils;
|
||||
import nc.bs.arap.util.BillAccountCalendarUtils;
|
||||
import nc.bs.arap.util.BillDateUtils;
|
||||
import nc.bs.arap.validator.CrossRuleCheckValidator;
|
||||
import nc.bs.dao.BaseDAO;
|
||||
import nc.jdbc.framework.processor.MapProcessor;
|
||||
import nc.vo.arap.basebill.BaseBillVO;
|
||||
import nc.vo.arap.utils.StringUtil;
|
||||
import nc.vo.pub.AggregatedValueObject;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nc.vo.pub.CircularlyAccessibleValueObject;
|
||||
import nc.vo.pub.lang.UFDouble;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class GatheringbillEditSaveBatchBSAction extends BillUpdateBatchBSAction {
|
||||
public GatheringbillEditSaveBatchBSAction() {
|
||||
this.validatorCode.add(5);
|
||||
this.validatorCode.add(34);
|
||||
this.validatorCode.add(57);
|
||||
this.validatorCode.add(59);
|
||||
this.validatorCode.add(62);
|
||||
this.validatorCode.add(93);
|
||||
this.validatorCode.add(94);
|
||||
this.validatorCode.add(100);
|
||||
}
|
||||
|
||||
protected void doBeforeUpdate(AggregatedValueObject[] bills, AggregatedValueObject[] orginBills) throws BusinessException {
|
||||
ArapBillPubUtil.fillTradeTypeInfo(bills);
|
||||
|
||||
for(AggregatedValueObject bill : bills) {
|
||||
ArapBillPubUtil.processMoneyOnlySum(bill);
|
||||
}
|
||||
|
||||
/**
|
||||
* 收款单保存校验关联的销售订单实际收款金额是否超过价税合计
|
||||
*/
|
||||
int i = 0;
|
||||
|
||||
for(AggregatedValueObject bill : bills) {
|
||||
AggregatedValueObject oriBill = orginBills[i++];
|
||||
BaseBillVO billVO = (BaseBillVO) bill.getParentVO(); //修改的收款单
|
||||
BaseBillVO billOriVO = (BaseBillVO) oriBill.getParentVO(); //之前的收款单
|
||||
UFDouble money = billVO.getMoney(); //修改后的金额
|
||||
UFDouble oriMoney = billOriVO.getMoney(); //修改前的金额
|
||||
String pk_tradetype = billVO.getPk_tradetype();
|
||||
if(!"F2-Cxx-02".equals(pk_tradetype)){
|
||||
continue;
|
||||
}
|
||||
String def3 = billVO.getDef3(); //收款单对应的销售订单id
|
||||
if(StringUtil.isEmpty(def3) || "N".equals(def3) || "~".equals(def3)){
|
||||
//无绑定的销售订单则下一次循环
|
||||
continue;
|
||||
}
|
||||
//计算收款单金额差值
|
||||
UFDouble changeMoney = money.sub(oriMoney);
|
||||
//根据销售订单id去查询销售订单
|
||||
BaseDAO dao = new BaseDAO();
|
||||
String sql = "select nreceivedmny,ntotalorigmny from so_saleorder where dr = 0 and csaleorderid = '" +def3+"'";
|
||||
Map saleMap = (Map)dao.executeQuery(sql, new MapProcessor());
|
||||
//销售订单价税合计
|
||||
UFDouble ntotalorigmny = UFDouble.ZERO_DBL;
|
||||
//销售订单实际收款金额
|
||||
UFDouble nreceivedmny = UFDouble.ZERO_DBL;
|
||||
if(saleMap != null) {
|
||||
nreceivedmny = new UFDouble(saleMap.get("nreceivedmny") == null ? "0" : saleMap.get("nreceivedmny").toString());
|
||||
ntotalorigmny = new UFDouble(saleMap.get("ntotalorigmny") == null ? "0" : saleMap.get("ntotalorigmny").toString());
|
||||
}
|
||||
UFDouble moreMoney = nreceivedmny.add(changeMoney).sub(ntotalorigmny);
|
||||
if(nreceivedmny.add(changeMoney).compareTo(ntotalorigmny) > 0){
|
||||
throw new BusinessException("【该笔收款已超销售订单"+ moreMoney +"元,无法传输!请检查订单累计收款金额!】");
|
||||
}
|
||||
}
|
||||
|
||||
ArapBillVOUtils.prepareDefaultInfo(bills, true);
|
||||
BillDateUtils.setBillDateByNow(bills);
|
||||
int updateType = this.getUpdateType(bills, orginBills);
|
||||
|
||||
for(AggregatedValueObject bill : bills) {
|
||||
bill.getParentVO().setStatus(1);
|
||||
}
|
||||
|
||||
if (updateType == TEMP_2_SAVE || updateType == SAVE_2_SAVE) {
|
||||
for(AggregatedValueObject bill : bills) {
|
||||
for(CircularlyAccessibleValueObject item : bill.getChildrenVO()) {
|
||||
if (item.getStatus() != 2 && item.getStatus() != 3) {
|
||||
item.setStatus(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (updateType == TEMP_2_SAVE || updateType == SAVE_2_SAVE) {
|
||||
BillAccountCalendarUtils.setAccperiodYearMonth(bills);
|
||||
}
|
||||
|
||||
this.checkIsCorrdBillMoneyControl(bills, orginBills);
|
||||
this.checkOtherSystemBill(bills, orginBills);
|
||||
(new CrossRuleCheckValidator()).validate(bills);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package nc.bs.arap.actions;
|
||||
|
||||
import nc.bs.arap.bill.ArapBillPubUtil;
|
||||
import nc.bs.arap.util.ArapBillVOUtils;
|
||||
import nc.bs.arap.util.BillAccountCalendarUtils;
|
||||
import nc.bs.arap.util.BillDateUtils;
|
||||
import nc.bs.arap.util.BillMoneyVUtils;
|
||||
import nc.bs.arap.validator.CrossRuleCheckValidator;
|
||||
import nc.bs.dao.BaseDAO;
|
||||
import nc.jdbc.framework.processor.MapProcessor;
|
||||
import nc.vo.arap.basebill.BaseBillVO;
|
||||
import nc.vo.arap.utils.StringUtil;
|
||||
import nc.vo.pub.AggregatedValueObject;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nc.vo.pub.lang.UFDouble;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class GatheringbillSaveBatchBSAction extends BillInsertBatchBSAction {
|
||||
public GatheringbillSaveBatchBSAction() {
|
||||
this.validatorCode.add(5);
|
||||
this.validatorCode.add(15);
|
||||
this.validatorCode.add(29);
|
||||
this.validatorCode.add(19);
|
||||
this.validatorCode.add(8);
|
||||
this.validatorCode.add(24);
|
||||
this.validatorCode.add(28);
|
||||
this.validatorCode.add(44);
|
||||
this.validatorCode.add(46);
|
||||
this.validatorCode.add(31);
|
||||
this.validatorCode.add(36);
|
||||
this.validatorCode.add(23);
|
||||
this.validatorCode.add(49);
|
||||
this.validatorCode.add(57);
|
||||
this.validatorCode.add(59);
|
||||
this.validatorCode.add(62);
|
||||
this.validatorCode.add(93);
|
||||
this.validatorCode.add(94);
|
||||
this.validatorCode.add(100);
|
||||
}
|
||||
|
||||
protected void doBeforeInsert(AggregatedValueObject[] bills) throws BusinessException {
|
||||
ArapBillPubUtil.fillTradeTypeInfo(bills);
|
||||
BillDateUtils.setBillDateByNow(bills);
|
||||
ArapBillPubUtil.resetBasedocVid(bills);
|
||||
BillAccountCalendarUtils.setAccperiodYearMonth(bills);
|
||||
ArapBillVOUtils.prepareDefaultInfo(bills);
|
||||
BillMoneyVUtils.sumAllVoBodyToHead(bills);
|
||||
(new CrossRuleCheckValidator()).validate(bills);
|
||||
ArapBillPubUtil.resetDestVODoc(bills);
|
||||
ArapBillVOUtils.setMaterialInfo(bills);
|
||||
ArapBillVOUtils.setDefaultSagaFrozen(bills);
|
||||
ArapBillVOUtils.setDefaultFeeundertaker(bills);
|
||||
ArapBillVOUtils.setDefaultSettleFlag(bills);
|
||||
|
||||
/**
|
||||
* 收款单保存校验关联的销售订单实际收款金额是否超过价税合计
|
||||
*/
|
||||
|
||||
for(AggregatedValueObject bill : bills) {
|
||||
BaseBillVO billVO = (BaseBillVO) bill.getParentVO(); //修改的收款单
|
||||
UFDouble money = billVO.getMoney(); //金额
|
||||
String pk_tradetype = billVO.getPk_tradetype();
|
||||
if(!"F2-Cxx-02".equals(pk_tradetype)){
|
||||
continue;
|
||||
}
|
||||
String def3 = billVO.getDef3(); //收款单对应的销售订单id
|
||||
if(StringUtil.isEmpty(def3) || "N".equals(def3) || "~".equals(def3)){
|
||||
//无绑定的销售订单则下一次循环
|
||||
continue;
|
||||
}
|
||||
|
||||
//根据销售订单id去查询销售订单
|
||||
BaseDAO dao = new BaseDAO();
|
||||
String sql = "select nreceivedmny,ntotalorigmny from so_saleorder where dr = 0 and csaleorderid = '" +def3+"'";
|
||||
Map saleMap = (Map)dao.executeQuery(sql, new MapProcessor());
|
||||
//销售订单价税合计
|
||||
UFDouble ntotalorigmny = UFDouble.ZERO_DBL;
|
||||
//销售订单实际收款金额
|
||||
UFDouble nreceivedmny = UFDouble.ZERO_DBL;
|
||||
if(saleMap != null) {
|
||||
nreceivedmny = new UFDouble(saleMap.get("nreceivedmny") == null ? "0" : saleMap.get("nreceivedmny").toString());
|
||||
ntotalorigmny = new UFDouble(saleMap.get("ntotalorigmny") == null ? "0" : saleMap.get("ntotalorigmny").toString());
|
||||
}
|
||||
UFDouble moreMoney = nreceivedmny.add(money).sub(ntotalorigmny);
|
||||
if(nreceivedmny.add(money).compareTo(ntotalorigmny) > 0){
|
||||
throw new BusinessException("【该笔收款已超销售订单"+ moreMoney +"元,无法传输!请检查订单累计收款金额!】");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package nc.bs.mmpac.pmo.pac0002.bp;
|
||||
|
||||
import nc.bs.mmpac.pmo.pac0002.pluginpoint.PMOPluginPoint;
|
||||
import nc.bs.mmpac.pmo.pac0002.rule.PMOFilterBillStatusRule;
|
||||
import nc.bs.mmpac.pmo.pac0002.rule.PMOFinishAutoFinishPutPlanRule;
|
||||
import nc.bs.mmpac.pmo.pac0002.rule.PMOToFinishPickMRule;
|
||||
import nc.bs.mmpac.pmo.pac0002.rule.fill.PMOFillFinishValueRule;
|
||||
import nc.bs.mmpub.rule.MMVOSagaFrozenValidateRule;
|
||||
import nc.impl.pubapp.pattern.rule.IFilterRule;
|
||||
import nc.impl.pubapp.pattern.rule.IRule;
|
||||
import nc.impl.pubapp.pattern.rule.processer.CompareAroundProcesser;
|
||||
import nc.util.mmf.framework.gc.GCUpdateBPTemplate;
|
||||
import nc.vo.mmpac.pmo.pac0002.constant.PMOConstLang;
|
||||
import nc.vo.mmpac.pmo.pac0002.entity.PMOAggVO;
|
||||
import nc.vo.mmpac.pmo.pac0002.enumeration.PMOFBillstatusEnum;
|
||||
|
||||
public class PMOFinishBP {
|
||||
public PMOFinishBP() {
|
||||
}
|
||||
|
||||
public PMOAggVO[] finish(PMOAggVO[] fullBills, PMOAggVO[] originBills) {
|
||||
GCUpdateBPTemplate<PMOAggVO> bp = new GCUpdateBPTemplate(PMOPluginPoint.FINISH);
|
||||
this.addFinishBeforeRule(bp.getAroundProcesser());
|
||||
this.addFinishAfterRule(bp.getAroundProcesser());
|
||||
PMOAggVO[] retBills = (PMOAggVO[])bp.update(fullBills, originBills);
|
||||
return retBills;
|
||||
}
|
||||
|
||||
private void addFinishBeforeRule(CompareAroundProcesser<PMOAggVO> processer) {
|
||||
IRule<PMOAggVO> checkFrozenRule = new MMVOSagaFrozenValidateRule(true);
|
||||
processer.addBeforeRule(checkFrozenRule);
|
||||
IFilterRule<PMOAggVO> filterStatusRule = new PMOFilterBillStatusRule(PMOConstLang.getMSG_ACTION_NO_AUDIT(), PMOFBillstatusEnum.AUDIT);
|
||||
processer.addBeforeRule(filterStatusRule);
|
||||
IRule<PMOAggVO> fillFinishRule = new PMOFillFinishValueRule(false);
|
||||
processer.addBeforeRule(fillFinishRule);
|
||||
}
|
||||
|
||||
private void addFinishAfterRule(CompareAroundProcesser<PMOAggVO> processer) {
|
||||
IRule<PMOAggVO> finishPutPlanRule = new PMOFinishAutoFinishPutPlanRule();
|
||||
processer.addAfterRule(finishPutPlanRule);
|
||||
/** 同步修改备料计划完成(生产订单强制完工时) */
|
||||
IRule<PMOAggVO> pMOToFinishPickMRule = new PMOToFinishPickMRule();
|
||||
processer.addAfterRule(pMOToFinishPickMRule);
|
||||
}
|
||||
|
||||
public PMOAggVO[] finishCancel(PMOAggVO[] fullBills, PMOAggVO[] originBills) {
|
||||
GCUpdateBPTemplate<PMOAggVO> bp = new GCUpdateBPTemplate(PMOPluginPoint.UNFINISH);
|
||||
this.addFinishCancelBeforeRule(bp.getAroundProcesser());
|
||||
this.addFinishCancelAfterRule(bp.getAroundProcesser());
|
||||
PMOAggVO[] retBills = (PMOAggVO[])bp.update(fullBills, originBills);
|
||||
return retBills;
|
||||
}
|
||||
|
||||
private void addFinishCancelBeforeRule(CompareAroundProcesser<PMOAggVO> processer) {
|
||||
IFilterRule<PMOAggVO> filterStatusRule = new PMOFilterBillStatusRule(PMOConstLang.getMSG_ACTION_NO_AUDIT(), PMOFBillstatusEnum.AUDIT);
|
||||
processer.addBeforeRule(filterStatusRule);
|
||||
IRule<PMOAggVO> fillFinishRule = new PMOFillFinishValueRule(true);
|
||||
processer.addBeforeRule(fillFinishRule);
|
||||
}
|
||||
|
||||
private void addFinishCancelAfterRule(CompareAroundProcesser<PMOAggVO> processer) {
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package nc.bs.mmpac.pmo.pac0002.bp;
|
||||
|
||||
import nc.bs.mmpac.pmo.pac0002.bp.service.PMOBPService;
|
||||
import nc.bs.mmpac.pmo.pac0002.bp.util.PMOBPUtil;
|
||||
import nc.bs.mmpac.pmo.pac0002.pluginpoint.PMOPluginPoint;
|
||||
import nc.bs.mmpac.pmo.pac0002.rule.PMOFilterBillStatusRule;
|
||||
import nc.bs.mmpac.pmo.pac0002.rule.PMOFilterRowStatusRule;
|
||||
import nc.bs.mmpac.pmo.pac0002.rule.PMOFinishAutoFinishPutPlanRule;
|
||||
import nc.bs.mmpac.pmo.pac0002.rule.PMOToFinishPickMRule;
|
||||
import nc.bs.mmpac.pmo.pac0002.rule.fill.PMOFillFinishValueRule;
|
||||
import nc.bs.mmpub.rule.MMVOSagaFrozenValidateRule;
|
||||
import nc.impl.pubapp.pattern.rule.IRule;
|
||||
import nc.impl.pubapp.pattern.rule.processer.CompareAroundProcesser;
|
||||
import nc.util.mmf.framework.gc.GCBillTransferTool;
|
||||
import nc.util.mmf.framework.gc.GCBillUpdate;
|
||||
import nc.util.mmf.framework.gc.GCUpdateBPTemplate;
|
||||
import nc.vo.mmpac.pmo.pac0002.constant.PMOConstLang;
|
||||
import nc.vo.mmpac.pmo.pac0002.entity.PMOAggVO;
|
||||
import nc.vo.mmpac.pmo.pac0002.entity.PMOItemVO;
|
||||
import nc.vo.mmpac.pmo.pac0002.enumeration.PMOFBillstatusEnum;
|
||||
import nc.vo.mmpac.pmo.pac0002.enumeration.PMOFItemStatusEnum;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nc.vo.pub.CircularlyAccessibleValueObject;
|
||||
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class PMORowFinishBP {
|
||||
public PMORowFinishBP() {
|
||||
}
|
||||
|
||||
public PMOAggVO[] rowfinish(PMOAggVO[] vos) {
|
||||
GCUpdateBPTemplate<PMOAggVO> bp = new GCUpdateBPTemplate(PMOPluginPoint.ROWFINISH);
|
||||
CompareAroundProcesser<PMOAggVO> processer = bp.getAroundProcesser();
|
||||
this.addRowFinishBeforeRule(processer);
|
||||
this.addRowFinishAfterRule(processer);
|
||||
PMOAggVO[] returnvos = (PMOAggVO[])processer.before(vos, vos);
|
||||
List<PMOItemVO> upditemList = new ArrayList();
|
||||
Map<String, PMOItemVO> upditemMap = new HashMap();
|
||||
|
||||
for(PMOAggVO aggvo : returnvos) {
|
||||
PMOItemVO[] items = aggvo.getChildrenVO();
|
||||
|
||||
for(PMOItemVO item : items) {
|
||||
upditemList.add(item);
|
||||
upditemMap.put(item.getCmoid(), item);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
PMOAggVO aggvo = PMOBPService.getIPMOQueryService().queryByPk(vos[0].getParentVO().getCpmohid());
|
||||
PMOItemVO[] olditems = aggvo.getChildrenVO();
|
||||
List<PMOItemVO> tempitems = new ArrayList();
|
||||
|
||||
for(PMOItemVO item : olditems) {
|
||||
if (!upditemMap.containsKey(item.getCmoid())) {
|
||||
tempitems.add(item);
|
||||
} else {
|
||||
((PMOItemVO)upditemMap.get(item.getCmoid())).setStatus(1);
|
||||
PMOBPUtil.setGrandVOStatusUpdate((PMOItemVO)upditemMap.get(item.getCmoid()));
|
||||
tempitems.add((PMOItemVO)upditemMap.get(item.getCmoid()));
|
||||
}
|
||||
}
|
||||
|
||||
aggvo.setChildrenVO((CircularlyAccessibleValueObject[])tempitems.toArray(new PMOItemVO[tempitems.size()]));
|
||||
PMOAggVO[] aggvos = new PMOAggVO[]{aggvo};
|
||||
GCBillTransferTool<PMOAggVO> transferTool = new GCBillTransferTool(aggvos);
|
||||
PMOAggVO[] originBills = (PMOAggVO[])transferTool.getOriginBills();
|
||||
GCBillUpdate<PMOAggVO> billupdate = new GCBillUpdate();
|
||||
PMOAggVO[] newaggvos = (PMOAggVO[])billupdate.update(aggvos, originBills);
|
||||
PMOItemVO[] totalitems = newaggvos[0].getChildrenVO();
|
||||
Map<String, PMOItemVO> newitemMap = new HashMap();
|
||||
|
||||
for(PMOItemVO item : totalitems) {
|
||||
if (upditemMap.containsKey(item.getCmoid())) {
|
||||
newitemMap.put(item.getCmoid(), item);
|
||||
}
|
||||
}
|
||||
|
||||
returnvos[0].setChildrenVO((CircularlyAccessibleValueObject[])newitemMap.values().toArray(new PMOItemVO[0]));
|
||||
processer.after(returnvos, returnvos);
|
||||
|
||||
/** 同步修改备料计划完成(生产订单强制完工时) */
|
||||
IRule<PMOAggVO> pMOToFinishPickMRule = new PMOToFinishPickMRule();
|
||||
pMOToFinishPickMRule.process(newaggvos);
|
||||
/** ******************** */
|
||||
|
||||
PMOAggVO newaggvo = PMOBPService.getIPMOQueryService().queryByPk(vos[0].getParentVO().getCpmohid());
|
||||
return new PMOAggVO[]{newaggvo};
|
||||
} catch (BusinessException e) {
|
||||
ExceptionUtils.wrappException(e);
|
||||
return returnvos;
|
||||
}
|
||||
}
|
||||
|
||||
private void addRowFinishBeforeRule(CompareAroundProcesser<PMOAggVO> processer) {
|
||||
IRule<PMOAggVO> checkFrozenRule = new MMVOSagaFrozenValidateRule(true);
|
||||
processer.addBeforeRule(checkFrozenRule);
|
||||
processer.addBeforeRule(new PMOFilterBillStatusRule(PMOConstLang.getMSG_ACTION_NO_AUDIT(), PMOFBillstatusEnum.AUDIT));
|
||||
processer.addBeforeRule(new PMOFilterRowStatusRule(PMOConstLang.getMSG_RULE_NO_ROWDATA(), PMOFItemStatusEnum.PUT));
|
||||
processer.addBeforeRule(new PMOFillFinishValueRule(false));
|
||||
}
|
||||
|
||||
private void addRowFinishAfterRule(CompareAroundProcesser<PMOAggVO> processer) {
|
||||
processer.addAfterRule(new PMOFinishAutoFinishPutPlanRule());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
package nc.bs.mmpac.pmo.pac0002.rule;
|
||||
|
||||
import nc.bs.framework.common.NCLocator;
|
||||
import nc.impl.pubapp.pattern.rule.IRule;
|
||||
import nc.itf.mmpac.pickm.IPickmMaintainService;
|
||||
import nc.md.persist.framework.IMDPersistenceQueryService;
|
||||
import nc.util.mmf.framework.base.MMValueCheck;
|
||||
import nc.vo.mmpac.pickm.entity.AggPickmVO;
|
||||
import nc.vo.mmpac.pickm.entity.PickmHeadVO;
|
||||
import nc.vo.mmpac.pmo.pac0002.entity.PMOAggVO;
|
||||
import nc.vo.mmpac.pmo.pac0002.entity.PMOItemVO;
|
||||
import nc.vo.pub.BusinessException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class PMOToFinishPickMRule
|
||||
extends Object
|
||||
implements IRule<PMOAggVO>{
|
||||
public void process(PMOAggVO[] vos) {
|
||||
if (MMValueCheck.isEmpty(vos)) {
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* 业务逻辑:
|
||||
* 1.循环生产订单明细表
|
||||
* 2.查看生产订单明细行的状态是否为完工(2)
|
||||
* 3.若为完工状态,则根据生产订单明细表中生产订单行查询备料计划
|
||||
* 4.修改备料计划为完成状态(3)
|
||||
*/
|
||||
for(int i = 0; i < vos.length; i++) {
|
||||
PMOAggVO vo = vos[i];
|
||||
PMOItemVO[] items = vo.getChildrenVO();
|
||||
//循环生产订单明细
|
||||
for(int j = 0; j < items.length; j++) {
|
||||
PMOItemVO item = items[j];
|
||||
//查看生产订单行状态是否为完工(2)
|
||||
int fitemStatus = item.getFitemstatus();
|
||||
if(fitemStatus != 2) {
|
||||
continue;
|
||||
}
|
||||
//根据生产订单行查询备料计划
|
||||
String cmoid = item.getCmoid();
|
||||
String whereSql = "nvl(mm_pickm.dr,0) = 0 and mm_pickm.vsourcemorowid = '" + cmoid + "'";
|
||||
IMDPersistenceQueryService aggvoQueryService = NCLocator.getInstance().lookup(IMDPersistenceQueryService.class);
|
||||
// 根据主键查询得到aggvo
|
||||
try {
|
||||
@SuppressWarnings("unchecked")
|
||||
ArrayList<AggPickmVO> aggVOs = (ArrayList<AggPickmVO>)aggvoQueryService.queryBillOfVOByCond(AggPickmVO.class, whereSql, true, false);
|
||||
if(aggVOs.size() <= 0) {
|
||||
continue;
|
||||
}
|
||||
//数组转换
|
||||
AggPickmVO[] aggVOsArr = new AggPickmVO[aggVOs.size()];
|
||||
boolean flag = false;
|
||||
for(int z=0; z<aggVOs.size(); z++) {
|
||||
AggPickmVO aggPickmVO = aggVOs.get(z);
|
||||
PickmHeadVO pickmHeadVO = aggPickmVO.getParentVO();
|
||||
Integer fbillstatus = pickmHeadVO.getFbillstatus();
|
||||
//已经位完工态的备料计划不修改
|
||||
if(fbillstatus != 2){
|
||||
aggVOsArr[z] =aggVOs.get(z);
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
if(flag) {
|
||||
//备料计划完工
|
||||
IPickmMaintainService ipickmMaintainService = NCLocator.getInstance().lookup(IPickmMaintainService.class);
|
||||
ipickmMaintainService.finishPickm(aggVOsArr);
|
||||
}
|
||||
}catch(BusinessException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,166 @@
|
|||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package nc.bs.mmpac.wr.bp;
|
||||
|
||||
import nc.bs.mmpac.wr.plugin.WrPluginPoint;
|
||||
import nc.bs.mmpac.wr.rule.*;
|
||||
import nc.bs.mmpac.wr.rule.batch.WrCreateBatProdRule;
|
||||
import nc.bs.mmpac.wr.rule.batch.WrCreateBatchCodeRule;
|
||||
import nc.bs.mmpac.wr.rule.check.WrNullRule;
|
||||
import nc.bs.mmpac.wr.rule.instockbatch.WrInsertAndDelInStockBatchCodeBeforeRule;
|
||||
import nc.bs.mmpac.wr.rule.instockbatch.WrInsertInStockBatchCodeAfterRule;
|
||||
import nc.bs.mmpac.wr.rule.mo.MoDiscadNumRewriteRule;
|
||||
import nc.bs.mmpac.wr.rule.mo.WrMORewriteRule;
|
||||
import nc.bs.mmpac.wr.rule.output.WrOutputNotNullRule;
|
||||
import nc.bs.mmpac.wr.rule.pick.WrPickNotNullRule;
|
||||
import nc.bs.mmpac.wr.rule.putplan.WrInsertRewriteWrNumForPutPlanRule;
|
||||
import nc.bs.mmpac.wr.rule.serialno.*;
|
||||
import nc.bs.mmpub.rule.MMATOMaterialCheckRule;
|
||||
import nc.bs.mmpub.rule.MMAutoMaterialAssignRule;
|
||||
import nc.bs.pubapp.pub.rule.FieldLengthCheckRule;
|
||||
import nc.bs.pubapp.pub.rule.OrgDisabledCheckRule;
|
||||
import nc.impl.pubapp.bd.material.assistant.MarAssistantSaveRule;
|
||||
import nc.impl.pubapp.bd.userdef.UserDefSaveRule;
|
||||
import nc.impl.pubapp.pattern.rule.IRule;
|
||||
import nc.impl.pubapp.pattern.rule.processer.AroundProcesser;
|
||||
import nc.util.mmf.busi.rule.MMBillCodeCheckAndTrantypeRule;
|
||||
import nc.util.mmf.busi.rule.MMCheckMaterialVirtualRule;
|
||||
import nc.util.mmf.busi.rule.MMCreateBillcodeAndTrantypecodeRule;
|
||||
import nc.util.mmf.framework.gc.GCInsertBPTemplate;
|
||||
import nc.vo.mmpac.wr.entity.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class WrInsertBP {
|
||||
private boolean isOnlyInsert = false;
|
||||
|
||||
public WrInsertBP() {
|
||||
}
|
||||
|
||||
public AggWrVO[] insert(AggWrVO[] vos) {
|
||||
GCInsertBPTemplate<AggWrVO> bp = new GCInsertBPTemplate(WrPluginPoint.INSERT);
|
||||
AroundProcesser<AggWrVO> processor = bp.getAroundProcesser();
|
||||
Map<String, String> vbatchsMap = new HashMap();
|
||||
this.addBeforeRule(processor, vos, vbatchsMap);
|
||||
this.addAfterRule(processor, vbatchsMap);
|
||||
return (AggWrVO[])bp.insert(vos);
|
||||
}
|
||||
|
||||
private void addBeforeRule(AroundProcesser<AggWrVO> processer, AggWrVO[] vos, Map<String, String> vbatchsMap) {
|
||||
IRule<AggWrVO> wrNullRule = new WrNullRule();
|
||||
processer.addBeforeRule(wrNullRule);
|
||||
IRule<AggWrVO> mmatoMaterialCheckRule = new MMATOMaterialCheckRule((String)null, "cbmaterialvid", "cbffileid");
|
||||
processer.addBeforeRule(mmatoMaterialCheckRule);
|
||||
IRule<AggWrVO> orgRule = new OrgDisabledCheckRule("pk_org", "FACTORYTYPE000000000");
|
||||
processer.addBeforeRule(orgRule);
|
||||
IRule<AggWrVO> checkDefRule = new UserDefSaveRule(new String[]{"vdef", "vbdef", "vgdef", "vpdef"}, new Class[]{WrVO.class, WrItemVO.class, WrQualityVO.class, WrPickVO.class});
|
||||
processer.addBeforeRule(checkDefRule);
|
||||
MarAssistantSaveRule<AggWrVO> marRule = new MarAssistantSaveRule();
|
||||
processer.addBeforeRule(marRule);
|
||||
IRule<AggWrVO> fillInsertDataRule = new WrFillInsertDataRule();
|
||||
processer.addBeforeRule(fillInsertDataRule);
|
||||
IRule<AggWrVO> autoMaterialAssignRule = new MMAutoMaterialAssignRule((String)null, "cbmaterialvid", new String[]{"pk_org"}, (String[])null);
|
||||
processer.addBeforeFinalRule(autoMaterialAssignRule);
|
||||
IRule<AggWrVO> orgPermissionRule = new WrCheckMaterialPermissionRule();
|
||||
processer.addBeforeRule(orgPermissionRule);
|
||||
IRule<AggWrVO> moCloseRule = new WrCheckMoIsCloseRule();
|
||||
processer.addBeforeRule(moCloseRule);
|
||||
processer.addBeforeRule(new MMCheckMaterialVirtualRule(WrItemVO.class));
|
||||
IRule<AggWrVO> wrSetDefaultValueWhenInsertRule = new WrSetDefaultValueWhenInsertRule();
|
||||
processer.addBeforeRule(wrSetDefaultValueWhenInsertRule);
|
||||
IRule<AggWrVO> wrSetItemDefaultValueRule = new WrSetItemDefaultValueRule();
|
||||
processer.addBeforeRule(wrSetItemDefaultValueRule);
|
||||
IRule<AggWrVO> billcodeRule = new MMCreateBillcodeAndTrantypecodeRule("55A4", "vbillcode", "pk_group", "pk_org", "vtrantypecode");
|
||||
processer.addBeforeRule(billcodeRule);
|
||||
IRule<AggWrVO> wrHeadNotNullRule = new WrHeadNotNullRule();
|
||||
processer.addBeforeRule(wrHeadNotNullRule);
|
||||
IRule<AggWrVO> wrBatchCodeRule = new WrCreateBatchCodeRule();
|
||||
processer.addBeforeRule(wrBatchCodeRule);
|
||||
IRule<AggWrVO> wrClearNullProductBodyRule = new WrClearNullBodyRule();
|
||||
processer.addBeforeRule(wrClearNullProductBodyRule);
|
||||
processer.addBeforeRule(new WrRowNoRule());
|
||||
IRule<AggWrVO> wrQualityFilterRule = new WrQualityFilterRule();
|
||||
processer.addBeforeRule(wrQualityFilterRule);
|
||||
IRule<AggWrVO> wrPickFilterRule = new WrPickFilterRule();
|
||||
processer.addBeforeRule(wrPickFilterRule);
|
||||
IRule<AggWrVO> wrOutputNotNullRule = new WrOutputNotNullRule();
|
||||
processer.addBeforeRule(wrOutputNotNullRule);
|
||||
IRule<AggWrVO> wrNoneMainProductBomCheckRule = new WrNoneMainProductBomCheckRule();
|
||||
processer.addBeforeRule(wrNoneMainProductBomCheckRule);
|
||||
IRule<AggWrVO> wrConsumeNotNullRule = new WrPickNotNullRule();
|
||||
processer.addBeforeRule(wrConsumeNotNullRule);
|
||||
IRule<AggWrVO> lengthCheckRule = new FieldLengthCheckRule();
|
||||
processer.addBeforeRule(lengthCheckRule);
|
||||
IRule<AggWrVO> wrInsertAndDelInStockBatchCodeBeforeRule = new WrInsertAndDelInStockBatchCodeBeforeRule(vbatchsMap);
|
||||
processer.addBeforeRule(wrInsertAndDelInStockBatchCodeBeforeRule);
|
||||
WrSetQualityVODefaultValueRule wrSetQualityVODefaultValueRule = new WrSetQualityVODefaultValueRule();
|
||||
processer.addBeforeRule(wrSetQualityVODefaultValueRule);
|
||||
processer.addBeforeRule(new WrSerialNoCheckCodeRepeat());
|
||||
WrSerialNoAutoCreateBeforeRule wrAutoCreateSnBeforeRule = new WrSerialNoAutoCreateBeforeRule();
|
||||
processer.addBeforeRule(wrAutoCreateSnBeforeRule);
|
||||
WrSerialNoCheckRule wrSnCheckRule = new WrSerialNoCheckRule();
|
||||
processer.addBeforeRule(wrSnCheckRule);
|
||||
WrSnSynToQualtiyRule synToQRule = new WrSnSynToQualtiyRule();
|
||||
processer.addBeforeRule(synToQRule);
|
||||
WrMoSerialNoMarkIRule mosnMarkRule = new WrMoSerialNoMarkIRule();
|
||||
processer.addBeforeRule(mosnMarkRule);
|
||||
IRule<AggWrVO> wrCreateBatProdRule = new WrCreateBatProdRule();
|
||||
processer.addBeforeRule(wrCreateBatProdRule);
|
||||
processer.addBeforeRule(new WrCheckTranstypeCodeRule());
|
||||
}
|
||||
|
||||
private void addAfterRule(AroundProcesser<AggWrVO> processor, Map<String, String> vbatchsMap) {
|
||||
IRule<AggWrVO> rule = new MMBillCodeCheckAndTrantypeRule("55A4", "vbillcode", "pk_group", "pk_org", "vtrantypecode");
|
||||
processor.addAfterRule(rule);
|
||||
IRule<AggWrVO> wrCreateInStockBatchCodeAfterRule = new WrInsertInStockBatchCodeAfterRule(vbatchsMap);
|
||||
processor.addAfterRule(wrCreateInStockBatchCodeAfterRule);
|
||||
processor.addAfterRule(new WrInsertRewriteWrNumForPutPlanRule());
|
||||
IRule<AggWrVO> wrMORewriteRule = new WrMORewriteRule(2);
|
||||
processor.addAfterRule(wrMORewriteRule);
|
||||
IRule<AggWrVO> moDiscadNumRewriteRule = new MoDiscadNumRewriteRule(2);
|
||||
processor.addAfterRule(moDiscadNumRewriteRule);
|
||||
IRule<AggWrVO> snSaveRule = new WrSerialNoSaveRule();
|
||||
processor.addAfterRule(snSaveRule);
|
||||
/** 同步修改备料计划完成 */
|
||||
IRule<AggWrVO> pickMFinishRule = new PickMFinishRule();
|
||||
processor.addAfterRule(pickMFinishRule);
|
||||
/** ******************** */
|
||||
|
||||
if (!this.isOnlyInsert) {
|
||||
processor.addAfterRule(new WrIsSaveAndApproveRule());
|
||||
}
|
||||
|
||||
processor.addAfterRule(new WrAuditAndApplyCheckRule());
|
||||
processor.addAfterRule(new WrAuditAndProdInRule());
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
protected IRule<AggWrVO> getMoRewriteRule() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
protected IRule<AggWrVO> getMoDiscadNumRewriteRule() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
protected IRule<AggWrVO> getAuditRule() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isOnlyInsert() {
|
||||
return this.isOnlyInsert;
|
||||
}
|
||||
|
||||
public void setOnlyInsert(boolean isOnlyInsert) {
|
||||
this.isOnlyInsert = isOnlyInsert;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
package nc.bs.mmpac.wr.rule.serialno;
|
||||
|
||||
import nc.bs.framework.common.NCLocator;
|
||||
import nc.bs.mmpac.pmo.pac0002.bp.query.PMOItemVOQueryBP;
|
||||
import nc.bs.mmpac.wr.rule.serialno.doc.WrSerialNoDocInsertControl;
|
||||
import nc.impl.pubapp.pattern.rule.IRule;
|
||||
import nc.itf.mmpac.pickm.IPickmMaintainService;
|
||||
import nc.md.persist.framework.IMDPersistenceQueryService;
|
||||
import nc.util.mmf.framework.base.MMValueCheck;
|
||||
import nc.util.mmpac.wr.vochange.WrBusiVOToChangeVO;
|
||||
import nc.vo.mmpac.pickm.entity.AggPickmVO;
|
||||
import nc.vo.mmpac.pickm.entity.PickmHeadVO;
|
||||
import nc.vo.mmpac.pmo.pac0002.entity.PMOItemVO;
|
||||
import nc.vo.mmpac.wr.entity.AggWrChangeVO;
|
||||
import nc.vo.mmpac.wr.entity.AggWrVO;
|
||||
import nc.vo.mmpac.wr.entity.WrItemVO;
|
||||
import nc.vo.pub.BusinessException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class PickMFinishRule
|
||||
extends Object
|
||||
implements IRule<AggWrVO>
|
||||
{
|
||||
public void process(AggWrVO[] vos) {
|
||||
if (MMValueCheck.isEmpty(vos)) {
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* 业务逻辑:
|
||||
* 1.根据生产报告子表中生产订单行查看生产订单明细表
|
||||
* 2.查看生产订单明细行的状态是否为完工(2)
|
||||
* 3.若为完工状态,则根据生成报告子表中生产订单行查询备料计划
|
||||
* 4.修改备料计划为完成状态(3)
|
||||
*/
|
||||
for(int i = 0; i < vos.length; i++) {
|
||||
AggWrVO vo = vos[i];
|
||||
WrItemVO[] items = vo.getChildrenVO();
|
||||
//循环生产报告子表
|
||||
for(int j = 0; j < items.length; j++) {
|
||||
WrItemVO item = items[j];
|
||||
String cbmobid = item.getCbmobid();
|
||||
String[] keys = {cbmobid};
|
||||
//生产订单行查询
|
||||
PMOItemVO[] pmoItemvos = (new PMOItemVOQueryBP()).getPMOItemVOsByids(keys);
|
||||
//查看生产订单行状态是否为完工(2)
|
||||
if(pmoItemvos.length > 0) {
|
||||
PMOItemVO pmoItem = pmoItemvos[0];
|
||||
int fitemStatus = pmoItem.getFitemstatus();
|
||||
if(fitemStatus != 2) {
|
||||
continue;
|
||||
}
|
||||
//根据生产订单行查询备料计划
|
||||
// BillQuery<AggPickmVO> query = new BillQuery<AggPickmVO>(AggPickmVO.class);
|
||||
// AggPickmVO[] aggVOs = (AggPickmVO[])query.query(keys);
|
||||
|
||||
String whereSql = "nvl(mm_pickm.dr,0) = 0 and mm_pickm.vsourcemorowid = '" + cbmobid + "'";
|
||||
IMDPersistenceQueryService aggvoQueryService = NCLocator.getInstance().lookup(IMDPersistenceQueryService.class);
|
||||
// 根据主键查询得到aggvo
|
||||
try {
|
||||
@SuppressWarnings("unchecked")
|
||||
ArrayList<AggPickmVO> aggVOs = (ArrayList<AggPickmVO>)aggvoQueryService.queryBillOfVOByCond(AggPickmVO.class, whereSql, true, false);
|
||||
if(aggVOs.size() <= 0) {
|
||||
continue;
|
||||
}
|
||||
//数组转换
|
||||
AggPickmVO[] aggVOsArr = new AggPickmVO[aggVOs.size()];
|
||||
boolean flag = false;
|
||||
for(int z=0; z<aggVOs.size(); z++) {
|
||||
AggPickmVO aggPickmVO = aggVOs.get(z);
|
||||
PickmHeadVO pickmHeadVO = aggPickmVO.getParentVO();
|
||||
Integer fbillstatus = pickmHeadVO.getFbillstatus();
|
||||
if(fbillstatus != 2){
|
||||
aggVOsArr[z] =aggVOs.get(z);
|
||||
flag = true;
|
||||
}
|
||||
|
||||
}
|
||||
if(flag){
|
||||
//备料计划完工
|
||||
IPickmMaintainService ipickmMaintainService = NCLocator.getInstance().lookup(IPickmMaintainService.class);
|
||||
ipickmMaintainService.finishPickm(aggVOsArr);
|
||||
}
|
||||
}catch(BusinessException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
AggWrChangeVO[] aggChangeVOs = WrBusiVOToChangeVO.changeOnlySerialNoVO(vos);
|
||||
|
||||
WrSerialNoDocInsertControl inSertControl = new WrSerialNoDocInsertControl();
|
||||
inSertControl.process(aggChangeVOs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,165 @@
|
|||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package nc.bs.so.m30.maintain;
|
||||
|
||||
import nc.bs.scmpub.rule.CrossRuleValidateRule;
|
||||
import nc.bs.so.m30.maintain.rule.insert.RewriteBillInsertRule;
|
||||
import nc.bs.so.m30.maintain.rule.insert.RewritePromotePriceInsertRule;
|
||||
import nc.bs.so.m30.maintain.rule.insert.WritebackMaterialPriceRule;
|
||||
import nc.bs.so.m30.plugin.BP30PlugInPoint;
|
||||
import nc.bs.so.m30.rule.atp.SaleOrderVOATPAfterRule;
|
||||
import nc.bs.so.m30.rule.atp.SaleOrderVOATPBeforeRule;
|
||||
import nc.bs.so.m30.rule.billcode.AddNewBillCodeRule;
|
||||
import nc.bs.so.m30.rule.billcode.CheckUniqueBillCodeRule;
|
||||
import nc.bs.so.m30.rule.businessinfo.SaveTransferMsgRule;
|
||||
import nc.bs.so.m30.rule.credit.RenovateARByHidsBeginRule;
|
||||
import nc.bs.so.m30.rule.credit.RenovateARByHidsEndRule;
|
||||
import nc.bs.so.m30.rule.feature.CfgMatchCheckRule;
|
||||
import nc.bs.so.m30.rule.feature.CfgMatchSaveRule;
|
||||
import nc.bs.so.m30.rule.m35.ArsubOffsetBeforeSaveRule;
|
||||
import nc.bs.so.m30.rule.m35.LrgCashMarCheckRule;
|
||||
import nc.bs.so.m30.rule.maintaincheck.*;
|
||||
import nc.bs.so.m30.rule.maintainprocess.*;
|
||||
import nc.bs.so.m30.rule.pm.CheckBusiForPMRule;
|
||||
import nc.bs.so.m30.rule.pm.CheckProjectMFGRule;
|
||||
import nc.bs.so.m30.rule.pm.CheckProjectValueRule;
|
||||
import nc.bs.so.m30.rule.reserve.AutoReserveRule;
|
||||
import nc.bs.so.m30.rule.rewrite.price.RewritePriceFormRule;
|
||||
import nc.bs.so.pub.rule.FillBillTailInfoRuleForIns;
|
||||
import nc.impl.pubapp.bd.userdef.UserDefSaveRule;
|
||||
import nc.impl.pubapp.pattern.data.bill.BillInsert;
|
||||
import nc.impl.pubapp.pattern.rule.IRule;
|
||||
import nc.impl.pubapp.pattern.rule.processer.AroundProcesser;
|
||||
import nc.itf.scmpub.reference.uap.group.SysInitGroupQuery;
|
||||
import nc.vo.credit.engrossmaintain.pub.action.M30EngrossAction;
|
||||
import nc.vo.ml.NCLangRes4VoTransl;
|
||||
import nc.vo.pubapp.pattern.log.TimeLog;
|
||||
import nc.vo.pubapp.util.SetAddAuditInfoRule;
|
||||
import nc.vo.scmpub.rule.AutoMaterialAssignRule;
|
||||
import nc.vo.scmpub.rule.SaleOrgEnableCheckRule;
|
||||
import nc.vo.so.m30.entity.SaleOrderBVO;
|
||||
import nc.vo.so.m30.entity.SaleOrderHVO;
|
||||
import nc.vo.so.m30.entity.SaleOrderVO;
|
||||
import nccloud.bs.so.mobile.saleorder.operation.rule.MobAfterSaveMessageRule;
|
||||
|
||||
public class InsertSaleOrderBP {
|
||||
public InsertSaleOrderBP() {
|
||||
}
|
||||
|
||||
public SaleOrderVO[] insert(SaleOrderVO[] bills) {
|
||||
AroundProcesser<SaleOrderVO> processer = new AroundProcesser(BP30PlugInPoint.InsertBP);
|
||||
TimeLog.logStart();
|
||||
this.addBeforeRule(processer);
|
||||
processer.before(bills);
|
||||
TimeLog.info(NCLangRes4VoTransl.getNCLangRes().getStrByID("4006011_0", "04006011-0066"));
|
||||
TimeLog.logStart();
|
||||
BillInsert<SaleOrderVO> bo = new BillInsert();
|
||||
SaleOrderVO[] vos = (SaleOrderVO[])bo.insert(bills);
|
||||
TimeLog.info(NCLangRes4VoTransl.getNCLangRes().getStrByID("4006011_0", "04006011-0067"));
|
||||
TimeLog.logStart();
|
||||
this.addAfterRule(processer);
|
||||
processer.after(vos);
|
||||
TimeLog.info(NCLangRes4VoTransl.getNCLangRes().getStrByID("4006011_0", "04006011-0068"));
|
||||
return vos;
|
||||
}
|
||||
|
||||
private void addAfterRule(AroundProcesser<SaleOrderVO> processer) {
|
||||
IRule<SaleOrderVO> rule = null;
|
||||
IRule<SaleOrderVO> var4 = new InsertSoBalanceWhenAddNewRule();
|
||||
processer.addAfterRule(var4);
|
||||
IRule<SaleOrderVO> var5 = new RenovateARByHidsEndRule(M30EngrossAction.M30Insert);
|
||||
processer.addAfterRule(var5);
|
||||
IRule<SaleOrderVO> var6 = new ThisGatheringRule();
|
||||
processer.addAfterRule(var6);
|
||||
IRule<SaleOrderVO> var7 = new CheckUniqueBillCodeRule();
|
||||
processer.addAfterRule(var7);
|
||||
IRule<SaleOrderVO> var8 = new RewriteBillInsertRule();
|
||||
processer.addAfterRule(var8);
|
||||
IRule<SaleOrderVO> var9 = new SaveTransferMsgRule();
|
||||
processer.addAfterRule(var9);
|
||||
IRule<SaleOrderVO> var10 = new RewritePriceFormRule();
|
||||
processer.addAfterRule(var10);
|
||||
IRule<SaleOrderVO> var11 = new SourceToSaleOrderMsgRule();
|
||||
processer.addAfterRule(var11);
|
||||
boolean icEnable = SysInitGroupQuery.isICEnabled();
|
||||
if (icEnable) {
|
||||
IRule<SaleOrderVO> var12 = new SaleOrderVOATPAfterRule();
|
||||
processer.addAfterRule(var12);
|
||||
IRule<SaleOrderVO> var13 = new AutoReserveRule();
|
||||
processer.addAfterRule(var13);
|
||||
}
|
||||
|
||||
if (SysInitGroupQuery.isPRICEEnabled()) {
|
||||
IRule<SaleOrderVO> var14 = new RewritePromotePriceInsertRule();
|
||||
processer.addAfterRule(var14);
|
||||
}
|
||||
/**
|
||||
* 销售订单新增回写参考物料售价规则
|
||||
*/
|
||||
IRule<SaleOrderVO> var15 = new WritebackMaterialPriceRule();
|
||||
processer.addAfterRule(var15);
|
||||
|
||||
processer.addAfterRule(new MobAfterSaveMessageRule());
|
||||
}
|
||||
|
||||
private void addBeforeRule(AroundProcesser<SaleOrderVO> processer) {
|
||||
IRule<SaleOrderVO> rule = new SaleOrgEnableCheckRule();
|
||||
processer.addBeforeRule(rule);
|
||||
IRule<SaleOrderVO> var4 = new FillupRedundanceDataRule();
|
||||
processer.addBeforeRule(var4);
|
||||
IRule<SaleOrderVO> var5 = new FillupFretexchangeRule();
|
||||
processer.addBeforeRule(var5);
|
||||
IRule<SaleOrderVO> var6 = new AddNewBillCodeRule();
|
||||
processer.addBeforeRule(var6);
|
||||
IRule<SaleOrderVO> var7 = new CheckNumPriceMnyRule();
|
||||
processer.addBeforeRule(var7);
|
||||
IRule<SaleOrderVO> var8 = new SaleOrderCheckNumAndMnyRule();
|
||||
processer.addBeforeRule(var8);
|
||||
IRule<SaleOrderVO> var9 = new CheckMaterilaOVidRule();
|
||||
processer.addBeforeRule(var9);
|
||||
IRule<SaleOrderVO> var10 = new CheckSettleOrgRepeat();
|
||||
processer.addBeforeRule(var10);
|
||||
IRule<SaleOrderVO> var11 = new CheckDateRule();
|
||||
processer.addBeforeRule(var11);
|
||||
processer.addBeforeRule(new AutoMaterialAssignRule("cmaterialid", new String[]{"pk_org"}, new String[]{"pk_org", "csendstockorgid", "csettleorgid", "carorgid", "cprofitcenterid", "csprofitcenterid"}));
|
||||
IRule<SaleOrderVO> var12 = new CfgMatchSaveRule();
|
||||
processer.addBeforeRule(var12);
|
||||
IRule<SaleOrderVO> var13 = new CfgMatchCheckRule();
|
||||
processer.addBeforeRule(var13);
|
||||
IRule<SaleOrderVO> var14 = new CheckSaveBillRule();
|
||||
processer.addBeforeRule(var14);
|
||||
IRule<SaleOrderVO> var15 = new FillBillTailInfoRuleForIns();
|
||||
processer.addBeforeRule(var15);
|
||||
IRule<SaleOrderVO> var16 = new SetAddAuditInfoRule();
|
||||
processer.addBeforeRule(var16);
|
||||
IRule<SaleOrderVO> var17 = new RenovateARByHidsBeginRule(M30EngrossAction.M30Insert);
|
||||
processer.addBeforeRule(var17);
|
||||
boolean icEnable = SysInitGroupQuery.isICEnabled();
|
||||
if (icEnable) {
|
||||
IRule<SaleOrderVO> var18 = new SaleOrderVOATPBeforeRule();
|
||||
processer.addBeforeRule(var18);
|
||||
}
|
||||
|
||||
IRule<SaleOrderVO> var19 = new LrgCashMarCheckRule();
|
||||
processer.addBeforeRule(var19);
|
||||
IRule<SaleOrderVO> var20 = new ArsubOffsetBeforeSaveRule();
|
||||
processer.addBeforeRule(var20);
|
||||
IRule<SaleOrderVO> var21 = new CheckLrgTotalMoney();
|
||||
processer.addBeforeRule(var21);
|
||||
IRule<SaleOrderVO> var22 = new UserDefSaveRule(new Class[]{SaleOrderHVO.class, SaleOrderBVO.class});
|
||||
processer.addBeforeRule(var22);
|
||||
IRule<SaleOrderVO> var23 = new CrossRuleValidateRule();
|
||||
processer.addBeforeRule(var23);
|
||||
IRule<SaleOrderVO> var24 = new CheckProjectValueRule();
|
||||
processer.addBeforeRule(var24);
|
||||
IRule<SaleOrderVO> var25 = new CheckBusiForPMRule();
|
||||
processer.addBeforeRule(var25);
|
||||
IRule<SaleOrderVO> var26 = new CheckValueWhenIsdeliveryRule();
|
||||
processer.addBeforeRule(var26);
|
||||
IRule<SaleOrderVO> var27 = new CheckProjectMFGRule();
|
||||
processer.addBeforeRule(var27);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,171 @@
|
|||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package nc.bs.so.m30.maintain;
|
||||
|
||||
import nc.bs.scmpub.rule.CrossRuleValidateRule;
|
||||
import nc.bs.scmpub.rule.VOSagaFrozenValidateRule;
|
||||
import nc.bs.so.m30.maintain.rule.insert.WritebackMaterialPriceRule;
|
||||
import nc.bs.so.m30.maintain.rule.update.RewriteBillUpdateRule;
|
||||
import nc.bs.so.m30.maintain.rule.update.RewritePromotePriceUpdateRule;
|
||||
import nc.bs.so.m30.plugin.BP30PlugInPoint;
|
||||
import nc.bs.so.m30.rule.atp.SaleOrderVOATPAfterRule;
|
||||
import nc.bs.so.m30.rule.atp.SaleOrderVOATPBeforeRule;
|
||||
import nc.bs.so.m30.rule.billcode.CheckUniqueBillCodeRule;
|
||||
import nc.bs.so.m30.rule.billcode.UpdateBillCodeRule;
|
||||
import nc.bs.so.m30.rule.businessinfo.SaveTransferMsgRule;
|
||||
import nc.bs.so.m30.rule.credit.RenovateARByHidsBeginRule;
|
||||
import nc.bs.so.m30.rule.credit.RenovateARByHidsEndRule;
|
||||
import nc.bs.so.m30.rule.feature.CfgMatchCheckRule;
|
||||
import nc.bs.so.m30.rule.feature.CfgMatchSaveRule;
|
||||
import nc.bs.so.m30.rule.m35.ArsubOffsetBeforeSaveRule;
|
||||
import nc.bs.so.m30.rule.m35.LrgCashMarCheckRule;
|
||||
import nc.bs.so.m30.rule.maintaincheck.*;
|
||||
import nc.bs.so.m30.rule.maintainprocess.*;
|
||||
import nc.bs.so.m30.rule.pm.CheckBusiForPMRule;
|
||||
import nc.bs.so.m30.rule.pm.CheckProjectMFGRule;
|
||||
import nc.bs.so.m30.rule.pm.CheckProjectValueRule;
|
||||
import nc.bs.so.m30.rule.reserve.AutoReserveRule;
|
||||
import nc.bs.so.m30.rule.reserve.ReserveUpdateRule;
|
||||
import nc.bs.so.m30.rule.rewrite.price.RewritePriceFormRule;
|
||||
import nc.bs.so.pub.rule.CheckApproverRule;
|
||||
import nc.impl.pubapp.bd.userdef.UserDefSaveRule;
|
||||
import nc.impl.pubapp.pattern.data.bill.BillUpdate;
|
||||
import nc.impl.pubapp.pattern.rule.ICompareRule;
|
||||
import nc.impl.pubapp.pattern.rule.IRule;
|
||||
import nc.impl.pubapp.pattern.rule.processer.CompareAroundProcesser;
|
||||
import nc.itf.scmpub.reference.uap.group.SysInitGroupQuery;
|
||||
import nc.vo.credit.engrossmaintain.pub.action.M30EngrossAction;
|
||||
import nc.vo.ml.NCLangRes4VoTransl;
|
||||
import nc.vo.pubapp.pattern.log.TimeLog;
|
||||
import nc.vo.pubapp.util.SetUpdateAuditInfoRule;
|
||||
import nc.vo.scmpub.rule.AutoMaterialAssignRule;
|
||||
import nc.vo.so.m30.entity.SaleOrderBVO;
|
||||
import nc.vo.so.m30.entity.SaleOrderHVO;
|
||||
import nc.vo.so.m30.entity.SaleOrderVO;
|
||||
|
||||
public class UpdateSaleOrderBP {
|
||||
public UpdateSaleOrderBP() {
|
||||
}
|
||||
|
||||
public SaleOrderVO[] update(SaleOrderVO[] bills, SaleOrderVO[] originBills) {
|
||||
CompareAroundProcesser<SaleOrderVO> processer = new CompareAroundProcesser(BP30PlugInPoint.UpdateBP);
|
||||
TimeLog.logStart();
|
||||
this.addBeforeRule(processer);
|
||||
processer.before(bills, originBills);
|
||||
TimeLog.info(NCLangRes4VoTransl.getNCLangRes().getStrByID("4006011_0", "04006011-0069"));
|
||||
TimeLog.logStart();
|
||||
BillUpdate<SaleOrderVO> bo = new BillUpdate();
|
||||
SaleOrderVO[] vos = (SaleOrderVO[])bo.update(bills, originBills);
|
||||
TimeLog.info(NCLangRes4VoTransl.getNCLangRes().getStrByID("4006011_0", "04006011-0070"));
|
||||
TimeLog.logStart();
|
||||
this.addAfterRule(processer);
|
||||
processer.after(vos, originBills);
|
||||
TimeLog.info(NCLangRes4VoTransl.getNCLangRes().getStrByID("4006011_0", "04006011-0071"));
|
||||
return vos;
|
||||
}
|
||||
|
||||
private void addAfterRule(CompareAroundProcesser<SaleOrderVO> processer) {
|
||||
IRule<SaleOrderVO> rule = null;
|
||||
IRule<SaleOrderVO> var5 = new UpdateSoBalanceWhenUpdateRule();
|
||||
processer.addAfterRule(var5);
|
||||
IRule<SaleOrderVO> var6 = new RenovateARByHidsEndRule(M30EngrossAction.M30Edit);
|
||||
processer.addAfterRule(var6);
|
||||
IRule<SaleOrderVO> var7 = new ThisGatheringRule();
|
||||
processer.addAfterRule(var7);
|
||||
IRule<SaleOrderVO> var8 = new CheckUniqueBillCodeRule();
|
||||
processer.addAfterRule(var8);
|
||||
ICompareRule<SaleOrderVO> compareRule = new RewriteBillUpdateRule();
|
||||
processer.addAfterRule(compareRule);
|
||||
IRule<SaleOrderVO> var9 = new SaveTransferMsgRule();
|
||||
processer.addAfterRule(var9);
|
||||
IRule<SaleOrderVO> var10 = new RewritePriceFormRule();
|
||||
processer.addAfterRule(var10);
|
||||
IRule<SaleOrderVO> var11 = new UpdateSoBalanceWhenUpdateM30HeadRule();
|
||||
processer.addAfterRule(var11);
|
||||
boolean icEnable = SysInitGroupQuery.isICEnabled();
|
||||
if (icEnable) {
|
||||
IRule<SaleOrderVO> var12 = new SaleOrderVOATPAfterRule();
|
||||
processer.addAfterRule(var12);
|
||||
IRule<SaleOrderVO> var13 = new ReserveUpdateRule();
|
||||
processer.addAfterRule(var13);
|
||||
IRule<SaleOrderVO> var14 = new AutoReserveRule();
|
||||
processer.addAfterRule(var14);
|
||||
}
|
||||
|
||||
if (SysInitGroupQuery.isPRICEEnabled()) {
|
||||
ICompareRule<SaleOrderVO> var15 = new RewritePromotePriceUpdateRule();
|
||||
processer.addAfterRule(var15);
|
||||
}
|
||||
|
||||
/**
|
||||
* 销售订单新增回写参考物料售价规则
|
||||
*/
|
||||
IRule<SaleOrderVO> var16 = new WritebackMaterialPriceRule();
|
||||
processer.addAfterRule(var16);
|
||||
|
||||
}
|
||||
|
||||
private void addBeforeRule(CompareAroundProcesser<SaleOrderVO> processer) {
|
||||
IRule<SaleOrderVO> rule = null;
|
||||
IRule<SaleOrderVO> var5 = new VOSagaFrozenValidateRule();
|
||||
processer.addBeforeRule(var5);
|
||||
IRule<SaleOrderVO> var6 = new CheckCanUpdateWhenAuditing();
|
||||
processer.addBeforeRule(var6);
|
||||
IRule<SaleOrderVO> var7 = new CheckApproverRule();
|
||||
processer.addBeforeRule(var7);
|
||||
IRule<SaleOrderVO> var8 = new CfgMatchSaveRule();
|
||||
processer.addBeforeRule(var8);
|
||||
IRule<SaleOrderVO> var9 = new CfgMatchCheckRule();
|
||||
processer.addBeforeRule(var9);
|
||||
IRule<SaleOrderVO> var10 = new FillupRedundanceDataRule();
|
||||
processer.addBeforeRule(var10);
|
||||
IRule<SaleOrderVO> var11 = new FillupFretexchangeRule();
|
||||
processer.addBeforeRule(var11);
|
||||
IRule<SaleOrderVO> var12 = new SetUpdateAuditInfoRule();
|
||||
processer.addBeforeRule(var12);
|
||||
ICompareRule<SaleOrderVO> compareRule = new UpdateBillCodeRule();
|
||||
processer.addBeforeRule(compareRule);
|
||||
IRule<SaleOrderVO> var13 = new CheckMaterilaOVidRule();
|
||||
processer.addBeforeRule(var13);
|
||||
IRule<SaleOrderVO> var14 = new CheckNumPriceMnyRule();
|
||||
processer.addBeforeRule(var14);
|
||||
IRule<SaleOrderVO> var15 = new SaleOrderCheckNumAndMnyRule();
|
||||
processer.addBeforeRule(var15);
|
||||
IRule<SaleOrderVO> var16 = new CheckSettleOrgRepeat();
|
||||
processer.addBeforeRule(var16);
|
||||
IRule<SaleOrderVO> var17 = new CheckDateRule();
|
||||
processer.addBeforeRule(var17);
|
||||
processer.addBeforeRule(new AutoMaterialAssignRule("cmaterialid", new String[]{"pk_org"}, new String[]{"pk_org", "csendstockorgid", "csettleorgid", "carorgid", "cprofitcenterid", "csprofitcenterid"}));
|
||||
IRule<SaleOrderVO> var18 = new CheckSaveBillRule();
|
||||
processer.addBeforeRule(var18);
|
||||
IRule<SaleOrderVO> var19 = new RenovateARByHidsBeginRule(M30EngrossAction.M30Edit);
|
||||
processer.addBeforeRule(var19);
|
||||
boolean icEnable = SysInitGroupQuery.isICEnabled();
|
||||
if (icEnable) {
|
||||
IRule<SaleOrderVO> var20 = new SaleOrderVOATPBeforeRule();
|
||||
processer.addBeforeRule(var20);
|
||||
}
|
||||
|
||||
IRule<SaleOrderVO> var21 = new LrgCashMarCheckRule();
|
||||
processer.addBeforeRule(var21);
|
||||
IRule<SaleOrderVO> var22 = new ArsubOffsetBeforeSaveRule();
|
||||
processer.addBeforeRule(var22);
|
||||
IRule<SaleOrderVO> var23 = new CheckLrgTotalMoney();
|
||||
processer.addBeforeRule(var23);
|
||||
IRule<SaleOrderVO> var24 = new CrossRuleValidateRule();
|
||||
processer.addBeforeRule(var24);
|
||||
IRule<SaleOrderVO> var25 = new UserDefSaveRule(new Class[]{SaleOrderHVO.class, SaleOrderBVO.class});
|
||||
processer.addBeforeRule(var25);
|
||||
IRule<SaleOrderVO> var26 = new CheckProjectValueRule();
|
||||
processer.addBeforeRule(var26);
|
||||
IRule<SaleOrderVO> var27 = new CheckBusiForPMRule();
|
||||
processer.addBeforeRule(var27);
|
||||
IRule<SaleOrderVO> var28 = new CheckValueWhenIsdeliveryRule();
|
||||
processer.addBeforeRule(var28);
|
||||
IRule<SaleOrderVO> var29 = new CheckProjectMFGRule();
|
||||
processer.addBeforeRule(var29);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
package nc.bs.so.m30.maintain.rule.insert;
|
||||
|
||||
import nc.bs.framework.common.NCLocator;
|
||||
import nc.impl.pubapp.pattern.rule.IRule;
|
||||
import nc.itf.bd.material.sale.IMaterialSaleService;
|
||||
import nc.md.persist.framework.IMDPersistenceQueryService;
|
||||
import nc.vo.bd.material.sale.MaterialSaleVO;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nc.vo.pub.lang.UFDouble;
|
||||
import nc.vo.so.m30.entity.SaleOrderBVO;
|
||||
import nc.vo.so.m30.entity.SaleOrderVO;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class WritebackMaterialPriceRule implements IRule<SaleOrderVO>{
|
||||
|
||||
|
||||
@Override
|
||||
public void process(SaleOrderVO[] vos) {
|
||||
// TODO Auto-generated method stub
|
||||
for (SaleOrderVO vo : vos) {
|
||||
//根据销售订单子表的物料编码和销售组织查询物料主表
|
||||
SaleOrderBVO[] saleOrderitems = vo.getChildrenVO();
|
||||
//循环销售订单子表
|
||||
for(int i = 0; i < saleOrderitems.length; i++) {
|
||||
SaleOrderBVO item = saleOrderitems[i];
|
||||
//取销售订单子表的物料编码和销售组织
|
||||
String cmaterialvid = item.getCmaterialvid(); //物料主键
|
||||
String pk_org = item.getPk_org(); //销售组织
|
||||
UFDouble nqtorigprice = item.getNqtorigprice(); //无税单价
|
||||
IMDPersistenceQueryService aggvoQueryService = NCLocator.getInstance().lookup(IMDPersistenceQueryService.class);
|
||||
// 条件查询得到物料MaterialSaleVO
|
||||
try {
|
||||
String whereSql = "nvl(bd_materialsale.dr,0) = 0 and bd_materialsale.pk_material = '" + cmaterialvid + "' and bd_materialsale.pk_org = '" + pk_org + "'";
|
||||
@SuppressWarnings("unchecked")
|
||||
ArrayList<MaterialSaleVO> materialSaleVOs = (ArrayList<MaterialSaleVO>)aggvoQueryService.queryBillOfVOByCond(MaterialSaleVO.class, whereSql, true, false);
|
||||
if(materialSaleVOs.size() <= 0) {
|
||||
continue;
|
||||
}
|
||||
for(MaterialSaleVO materialSaleVO : materialSaleVOs) {
|
||||
materialSaleVO.setResaleprice(nqtorigprice);
|
||||
//实体更新物料销售表
|
||||
// IMaterialSaleService iMaterialSaleService = ServiceLocator.find(IMaterialSaleService.class);
|
||||
IMaterialSaleService iMaterialSaleService = NCLocator.getInstance().lookup(IMaterialSaleService.class);
|
||||
iMaterialSaleService.updateMaterialSaleVO(materialSaleVO);
|
||||
}
|
||||
}catch(BusinessException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,938 @@
|
|||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package nccloud.itf.sscivm.ivsale.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.internal.LinkedTreeMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import nc.bs.businessevent.EventDispatcher;
|
||||
import nc.bs.dao.BaseDAO;
|
||||
import nc.bs.framework.common.InvocationInfoProxy;
|
||||
import nc.bs.framework.common.NCLocator;
|
||||
import nc.bs.framework.common.RuntimeEnv;
|
||||
import nc.bs.pub.pf.PfUtilTools;
|
||||
import nc.bs.sscivm.ivsale.bp.IVApplicationDeleteBP;
|
||||
import nc.bs.sscivm.ivsale.bp.IVApplicationInsertBP;
|
||||
import nc.bs.sscivm.ivsale.bp.IVApplicationQueryBP;
|
||||
import nc.bs.sscivm.ivsale.bp.IVApplicationUpdateBP;
|
||||
import nc.bs.sscivm.ivsale.splitmerge.util.TransSpiltMergePksUtil;
|
||||
import nc.bs.sscivm.ivsale.util.ApplicationBusinessEvent;
|
||||
import nc.bs.sscivm.ivsale.util.IVApplicationBillDefValue;
|
||||
import nc.bs.sscivm.ivsale.util.IVApplicationSlsmUtil;
|
||||
import nc.bs.sscivm.ivsale.util.IVSaleUtil;
|
||||
import nc.bs.sscivm.logger.SSCIVMLogger;
|
||||
import nc.bs.sscivm.util.IVMSagaValidationUtils;
|
||||
import nc.impl.pubapp.pattern.data.bill.tool.BillTransferTool;
|
||||
import nc.itf.bd.material.baseinfo.IMaterialBaseInfoQueryService;
|
||||
import nc.itf.uap.pf.IWorkflowDefine;
|
||||
import nc.itf.uap.pf.IWorkflowMachine;
|
||||
import nc.itf.uap.pf.metadata.IFlowBizItf;
|
||||
import nc.jdbc.framework.processor.ColumnProcessor;
|
||||
import nc.pubitf.bbd.CurrtypeQuery;
|
||||
import nc.pubitf.para.SysInitQuery;
|
||||
import nc.pubitf.uapbd.CurrencyRateUtilHelper;
|
||||
import nc.pubitf.uapbd.ICustomerPubService;
|
||||
import nc.pubitf.uapbd.IMaterialPubService;
|
||||
import nc.uap.pf.metadata.PfMetadataTools;
|
||||
import nc.vo.bd.currtype.CurrtypeVO;
|
||||
import nc.vo.bd.material.MaterialVO;
|
||||
import nc.vo.bd.material.MaterialVersionVO;
|
||||
import nc.vo.ic.pub.util.StringUtil;
|
||||
import nc.vo.ml.NCLangRes4VoTransl;
|
||||
import nc.vo.org.OrgQueryUtil;
|
||||
import nc.vo.org.OrgVO;
|
||||
import nc.vo.pf.pub.util.SQLUtil;
|
||||
import nc.vo.pub.AggregatedValueObject;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nc.vo.pub.CircularlyAccessibleValueObject;
|
||||
import nc.vo.pub.lang.UFBoolean;
|
||||
import nc.vo.pub.lang.UFDate;
|
||||
import nc.vo.pub.lang.UFDateTime;
|
||||
import nc.vo.pub.lang.UFDouble;
|
||||
import nc.vo.pub.workflownote.WorkflownoteVO;
|
||||
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
|
||||
import nc.vo.sscivm.ivmpub.IVAplocationFPXZ;
|
||||
import nc.vo.sscivm.ivmpub.IVAplocationKPFS;
|
||||
import nc.vo.sscivm.ivsale.IVApplicationAggVO;
|
||||
import nc.vo.sscivm.ivsale.IVApplicationBodyVO;
|
||||
import nc.vo.sscivm.ivsale.IVApplicationHeadVO;
|
||||
import nc.vo.sscivm.ivsale.IVApplogVO;
|
||||
import nc.vo.sscivm.ivsale.IVBilltypeVO;
|
||||
import nc.vo.sscivm.ivsale.IVTspzsBodyVO;
|
||||
import nc.vo.sscivm.ivsale.MessageVO;
|
||||
import nc.vo.uap.pf.PFBusinessException;
|
||||
import nc.vo.uap.pf.PfProcessBatchRetObject;
|
||||
import nc.vo.wfengine.definition.WorkflowTypeEnum;
|
||||
import nccloud.commons.lang.StringUtils;
|
||||
import nccloud.itf.sscivm.ivsale.service.ApplicationLogService;
|
||||
import nccloud.itf.sscivm.ivsale.service.IVABilltypeExtService;
|
||||
import nccloud.itf.sscivm.ivsale.service.IVApplicationInvoiceService;
|
||||
import nccloud.itf.sscivm.ivsale.service.IVApplicationQueryService;
|
||||
import nccloud.itf.sscivm.ivsale.service.IVApplicationService;
|
||||
import nccloud.pubitf.riart.pflow.CloudPFlowContext;
|
||||
import nccloud.pubitf.riart.pflow.ICloudScriptPFlowService;
|
||||
import nccloud.putitf.riart.billtype.IBilltypeService;
|
||||
|
||||
public class IVApplicationServiceImpl implements IVApplicationService {
|
||||
public IVApplicationServiceImpl() {
|
||||
}
|
||||
|
||||
public IVApplicationAggVO save(IVApplicationAggVO ivApplicationVO) throws BusinessException {
|
||||
IVApplicationAggVO[] ivApplicationVOs = null;
|
||||
|
||||
try {
|
||||
ivApplicationVOs = this.saveBatch(new IVApplicationAggVO[]{ivApplicationVO});
|
||||
} catch (Exception e) {
|
||||
SSCIVMLogger.error(e.getMessage(), e);
|
||||
ExceptionUtils.marsh(e);
|
||||
}
|
||||
|
||||
return ivApplicationVOs != null && ivApplicationVOs.length != 0 ? ivApplicationVOs[0] : null;
|
||||
}
|
||||
|
||||
public IVApplicationAggVO[] saveBatch(IVApplicationAggVO[] clientFullVOs) throws BusinessException {
|
||||
IVApplicationAggVO[] retvos = null;
|
||||
HashSet<IVApplicationAggVO> retVOLits = new HashSet();
|
||||
|
||||
try {
|
||||
IVApplicationInsertBP action = new IVApplicationInsertBP();
|
||||
retvos = action.insert(clientFullVOs);
|
||||
HashSet<String> tradetypeids = new HashSet();
|
||||
|
||||
for(IVApplicationAggVO applicationAggVO : retvos) {
|
||||
tradetypeids.add(applicationAggVO.getParentVO().getTranstypecode());
|
||||
}
|
||||
|
||||
IVABilltypeExtService var10000 = (IVABilltypeExtService)NCLocator.getInstance().lookup(IVABilltypeExtService.class);
|
||||
String var10001 = InvocationInfoProxy.getInstance().getGroupId();
|
||||
IVBilltypeVO[] billtypeVOS = var10000.getBilltypeVOsByWhere(" pk_group ='" + var10001 + "' and " + SQLUtil.buildSqlForIn("billtypecode", (String[])tradetypeids.toArray(new String[tradetypeids.size()])));
|
||||
if (billtypeVOS != null && billtypeVOS.length > 0) {
|
||||
HashSet<IVApplicationAggVO> atuoVOs = new HashSet();
|
||||
HashSet<IVApplicationAggVO> noatuoVOs = new HashSet();
|
||||
|
||||
for(IVApplicationAggVO retvo : retvos) {
|
||||
boolean Isatuo_submit = UFBoolean.FALSE.booleanValue();
|
||||
|
||||
for(IVBilltypeVO billtypeVO : billtypeVOS) {
|
||||
if (retvo.getParentVO().getTranstypecode() != null && retvo.getParentVO().getTranstypecode().equals(billtypeVO.getBilltypecode()) && billtypeVO.getIsatuo_submit() == UFBoolean.TRUE) {
|
||||
Isatuo_submit = UFBoolean.TRUE.booleanValue();
|
||||
}
|
||||
}
|
||||
|
||||
if (Isatuo_submit) {
|
||||
atuoVOs.add(retvo);
|
||||
} else {
|
||||
noatuoVOs.add(retvo);
|
||||
}
|
||||
}
|
||||
|
||||
if (atuoVOs != null && atuoVOs.size() > 0) {
|
||||
Object submitObj = this.submit((IVApplicationAggVO[])atuoVOs.toArray(new IVApplicationAggVO[atuoVOs.size()]), (IVApplicationAggVO[])null, (Object)null);
|
||||
if (submitObj instanceof Map) {
|
||||
throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0", "01058sal-0053"));
|
||||
}
|
||||
|
||||
retvos = (IVApplicationAggVO[])submitObj;
|
||||
if (retvos != null && retvos.length > 0) {
|
||||
for(IVApplicationAggVO retvo : retvos) {
|
||||
retVOLits.add(retvo);
|
||||
}
|
||||
|
||||
if (noatuoVOs != null && noatuoVOs.size() > 0) {
|
||||
retVOLits.addAll(noatuoVOs);
|
||||
}
|
||||
}
|
||||
|
||||
retvos = (IVApplicationAggVO[])retVOLits.toArray(new IVApplicationAggVO[retVOLits.size()]);
|
||||
} else if (noatuoVOs != null && noatuoVOs.size() > 0) {
|
||||
retVOLits.addAll(noatuoVOs);
|
||||
retvos = (IVApplicationAggVO[])retVOLits.toArray(new IVApplicationAggVO[retVOLits.size()]);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
SSCIVMLogger.error(e.getMessage(), e);
|
||||
ExceptionUtils.marsh(e);
|
||||
}
|
||||
|
||||
return retvos;
|
||||
}
|
||||
|
||||
public void deleteById(String pk) throws BusinessException {
|
||||
this.deleteByIds(new String[]{pk});
|
||||
}
|
||||
|
||||
public void deleteByIds(String[] pks) throws BusinessException {
|
||||
IVApplicationAggVO[] retvos = (new IVApplicationQueryBP()).queryAggIVApplicationVOByCondition(SQLUtil.buildSqlForIn("pk_ivapplication", pks));
|
||||
(new IVApplicationDeleteBP()).delete(retvos);
|
||||
}
|
||||
|
||||
public void delete(IVApplicationAggVO vo) throws BusinessException {
|
||||
try {
|
||||
(new IVApplicationDeleteBP()).delete(new IVApplicationAggVO[]{vo});
|
||||
} catch (Exception e) {
|
||||
SSCIVMLogger.error(e.getMessage(), e);
|
||||
ExceptionUtils.marsh(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void deleteBatch(IVApplicationAggVO[] vos) throws BusinessException {
|
||||
try {
|
||||
(new IVApplicationDeleteBP()).delete(vos);
|
||||
} catch (Exception e) {
|
||||
SSCIVMLogger.error(e.getMessage(), e);
|
||||
ExceptionUtils.marsh(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void deleteBatchdUnCheckApproveStaus(IVApplicationAggVO[] vos) throws BusinessException {
|
||||
try {
|
||||
(new IVApplicationDeleteBP()).deleteUnCheckApproveStaus(vos);
|
||||
} catch (Exception e) {
|
||||
SSCIVMLogger.error(e.getMessage(), e);
|
||||
ExceptionUtils.marsh(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public IVApplicationAggVO update(IVApplicationAggVO ivApplicationVO) throws BusinessException {
|
||||
IVApplicationAggVO[] retvos = null;
|
||||
|
||||
try {
|
||||
if (ivApplicationVO == null || ivApplicationVO.getParentVO() == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Integer approveStatus = ivApplicationVO.getParentVO().getBillstatus();
|
||||
if (approveStatus == 1) {
|
||||
throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0", "01058sal-0024"));
|
||||
}
|
||||
|
||||
if (approveStatus == 3 || approveStatus == 2) {
|
||||
String billId = ivApplicationVO.getParentVO().getPk_ivapplication();
|
||||
String billType = ivApplicationVO.getParentVO().getTranstypecode();
|
||||
String userId = InvocationInfoProxy.getInstance().getUserId();
|
||||
if (!this.isFlowCheckman(billId, billType, userId)) {
|
||||
throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0", "01058sal-0050"));
|
||||
}
|
||||
}
|
||||
|
||||
retvos = this.updateBatch(new IVApplicationAggVO[]{ivApplicationVO}, (IVApplicationAggVO[])null);
|
||||
if (retvos != null && retvos.length > 0) {
|
||||
CircularlyAccessibleValueObject[] bodys = retvos[0].getChildrenVO();
|
||||
if (bodys != null && bodys.length > 0) {
|
||||
for(int m = 0; m < bodys.length; ++m) {
|
||||
CircularlyAccessibleValueObject body = bodys[m];
|
||||
body.setAttributeValue("rowid", ivApplicationVO.getChildrenVO()[m].getAttributeValue("rowid"));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
SSCIVMLogger.error(e.getMessage(), e);
|
||||
ExceptionUtils.marsh(e);
|
||||
}
|
||||
|
||||
return retvos != null && retvos.length != 0 ? retvos[0] : null;
|
||||
}
|
||||
|
||||
public IVApplicationAggVO[] updateBatch(IVApplicationAggVO[] clientFullVOs, IVApplicationAggVO[] originBills) throws BusinessException {
|
||||
IVApplicationAggVO[] retvos = null;
|
||||
|
||||
try {
|
||||
BillTransferTool<IVApplicationAggVO> transferTool = new BillTransferTool(clientFullVOs);
|
||||
IVApplicationUpdateBP action = new IVApplicationUpdateBP();
|
||||
originBills = (IVApplicationAggVO[])transferTool.getOriginBills();
|
||||
retvos = action.update(clientFullVOs, originBills);
|
||||
} catch (Exception e) {
|
||||
SSCIVMLogger.error(e.getMessage(), e);
|
||||
ExceptionUtils.marsh(e);
|
||||
}
|
||||
|
||||
return retvos;
|
||||
}
|
||||
|
||||
public IVApplicationAggVO updateForUI(IVApplicationAggVO ivApplicationVO) throws BusinessException {
|
||||
IVApplicationAggVO[] retvos = null;
|
||||
|
||||
try {
|
||||
if (ivApplicationVO == null || ivApplicationVO.getParentVO() == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Integer approveStatus = ivApplicationVO.getParentVO().getBillstatus();
|
||||
if (approveStatus == 1) {
|
||||
throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0", "01058sal-0024"));
|
||||
}
|
||||
|
||||
if (approveStatus == 3 || approveStatus == 2) {
|
||||
String billId = ivApplicationVO.getParentVO().getPk_ivapplication();
|
||||
String billType = ivApplicationVO.getParentVO().getTranstypecode();
|
||||
String userId = InvocationInfoProxy.getInstance().getUserId();
|
||||
if (!this.isFlowCheckman(billId, billType, userId)) {
|
||||
throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0", "01058sal-0050"));
|
||||
}
|
||||
}
|
||||
|
||||
//如果来源单据为销售发票,根据来源单据编号src_billno和来源单据类型(billtype = 32)查询销售发票价税合计(ntotalorigmny)与开票申请中价税合计(jshj)比较,须满足 jshj<ntotalorigmny
|
||||
String src_billtype = ivApplicationVO.getParentVO().getSrc_billtype(); //来源单据类型
|
||||
String src_billno = ivApplicationVO.getParentVO().getSrc_billno(); //来源单据号
|
||||
String def23 = ivApplicationVO.getParentVO().getDef23(); //bip开票类型 (3:出口发票)
|
||||
//根据开票申请自定义项23查询自定义档案编码
|
||||
BaseDAO dao = new BaseDAO();
|
||||
String sqlDefdoc = "select code from bd_defdoc where dr = 0 and pk_defdoc = '" +def23+"'";
|
||||
Object objDefdoc = dao.executeQuery(sqlDefdoc, new ColumnProcessor());
|
||||
String def23Code = "";
|
||||
if(objDefdoc != null) {
|
||||
def23Code = objDefdoc.toString();
|
||||
}
|
||||
/**
|
||||
* 2025-03-12新增:
|
||||
* 开票申请自定义项 23(bip开票类型) 不等于 3,def23Code != 3
|
||||
* 再做金额校验
|
||||
*/
|
||||
if("32".equals(src_billtype) && !StringUtil.isNullStringOrNull(src_billno) && !"3".equals(def23Code)){
|
||||
String sql = "select ntotalorigmny from so_saleinvoice where dr = 0 and vbillcode = '" +src_billno+"'";
|
||||
Object obj = dao.executeQuery(sql, new ColumnProcessor());
|
||||
//销售发票价税合计
|
||||
UFDouble ntotalorigmny = UFDouble.ZERO_DBL;
|
||||
if(obj != null) {
|
||||
ntotalorigmny = new UFDouble(obj.toString());
|
||||
}
|
||||
//开票申请价税合计
|
||||
UFDouble jshj = ivApplicationVO.getParentVO().getJshj();
|
||||
//如果开票申请价税合计 大于 销售发票价税合计则返回报错
|
||||
if(jshj != null && ntotalorigmny != null && jshj.compareTo(ntotalorigmny) > 0){
|
||||
throw new BusinessException("价税合计不能超过销售发票中价税合计");
|
||||
}
|
||||
}
|
||||
|
||||
retvos = this.updateBatchForUI(new IVApplicationAggVO[]{ivApplicationVO}, (IVApplicationAggVO[])null);
|
||||
if (retvos != null && retvos.length > 0) {
|
||||
CircularlyAccessibleValueObject[] bodys = retvos[0].getChildrenVO();
|
||||
if (bodys != null && bodys.length > 0) {
|
||||
for(int m = 0; m < bodys.length; ++m) {
|
||||
CircularlyAccessibleValueObject body = bodys[m];
|
||||
body.setAttributeValue("rowid", ivApplicationVO.getChildrenVO()[m].getAttributeValue("rowid"));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
SSCIVMLogger.error(e.getMessage(), e);
|
||||
ExceptionUtils.marsh(e);
|
||||
}
|
||||
|
||||
return retvos != null && retvos.length != 0 ? retvos[0] : null;
|
||||
}
|
||||
|
||||
private IVApplicationAggVO[] updateBatchForUI(IVApplicationAggVO[] clientFullVOs, IVApplicationAggVO[] originBills) throws BusinessException {
|
||||
IVApplicationAggVO[] retvos = null;
|
||||
|
||||
try {
|
||||
BillTransferTool<IVApplicationAggVO> transferTool = new BillTransferTool(clientFullVOs);
|
||||
IVApplicationUpdateBP action = new IVApplicationUpdateBP();
|
||||
originBills = (IVApplicationAggVO[])transferTool.getOriginBills();
|
||||
retvos = action.update(clientFullVOs, originBills);
|
||||
Map<String, IVApplicationAggVO> pkAndOldVOMap = new HashMap();
|
||||
|
||||
for(IVApplicationAggVO aggVO : originBills) {
|
||||
pkAndOldVOMap.put(aggVO.getPrimaryKey(), aggVO);
|
||||
}
|
||||
|
||||
HashSet<String> tradetypeids = new HashSet();
|
||||
|
||||
for(IVApplicationAggVO applicationAggVO : retvos) {
|
||||
IVApplicationAggVO oldApplicationAggVO = (IVApplicationAggVO)pkAndOldVOMap.get(applicationAggVO.getPrimaryKey());
|
||||
if (applicationAggVO.getParentVO().getBillstatus() == -1 && oldApplicationAggVO.getParentVO().getBillstatus() == -1) {
|
||||
tradetypeids.add(applicationAggVO.getParentVO().getTranstypecode());
|
||||
}
|
||||
}
|
||||
|
||||
if (tradetypeids.size() == 0) {
|
||||
return retvos;
|
||||
}
|
||||
|
||||
IVABilltypeExtService var10000 = (IVABilltypeExtService)NCLocator.getInstance().lookup(IVABilltypeExtService.class);
|
||||
String var10001 = InvocationInfoProxy.getInstance().getGroupId();
|
||||
IVBilltypeVO[] billtypeVOS = var10000.getBilltypeVOsByWhere(" pk_group ='" + var10001 + "' and " + SQLUtil.buildSqlForIn("billtypecode", (String[])tradetypeids.toArray(new String[tradetypeids.size()])));
|
||||
if (billtypeVOS != null && billtypeVOS.length > 0) {
|
||||
HashSet<IVApplicationAggVO> atuoVOs = new HashSet();
|
||||
HashSet<IVApplicationAggVO> noatuoVOs = new HashSet();
|
||||
|
||||
for(IVApplicationAggVO retvo : retvos) {
|
||||
boolean Isatuo_submit = UFBoolean.FALSE.booleanValue();
|
||||
|
||||
for(IVBilltypeVO billtypeVO : billtypeVOS) {
|
||||
if (retvo.getParentVO().getTranstypecode() != null && retvo.getParentVO().getTranstypecode().equals(billtypeVO.getBilltypecode()) && billtypeVO.getIsatuo_submit() == UFBoolean.TRUE) {
|
||||
Isatuo_submit = UFBoolean.TRUE.booleanValue();
|
||||
}
|
||||
}
|
||||
|
||||
if (Isatuo_submit) {
|
||||
atuoVOs.add(retvo);
|
||||
} else {
|
||||
noatuoVOs.add(retvo);
|
||||
}
|
||||
}
|
||||
|
||||
List<IVApplicationAggVO> retVOLits = new ArrayList();
|
||||
if (atuoVOs != null && atuoVOs.size() > 0) {
|
||||
Object submitObj = this.submit((IVApplicationAggVO[])atuoVOs.toArray(new IVApplicationAggVO[atuoVOs.size()]), (IVApplicationAggVO[])null, (Object)null);
|
||||
if (submitObj instanceof Map) {
|
||||
throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0", "01058sal-0053"));
|
||||
}
|
||||
|
||||
retvos = (IVApplicationAggVO[])submitObj;
|
||||
if (retvos != null && retvos.length > 0) {
|
||||
for(IVApplicationAggVO retvo : retvos) {
|
||||
retVOLits.add(retvo);
|
||||
}
|
||||
|
||||
if (noatuoVOs != null && noatuoVOs.size() > 0) {
|
||||
retVOLits.addAll(noatuoVOs);
|
||||
}
|
||||
}
|
||||
|
||||
retvos = (IVApplicationAggVO[])retVOLits.toArray(new IVApplicationAggVO[retVOLits.size()]);
|
||||
} else if (noatuoVOs != null && noatuoVOs.size() > 0) {
|
||||
retVOLits.addAll(noatuoVOs);
|
||||
retvos = (IVApplicationAggVO[])retVOLits.toArray(new IVApplicationAggVO[retVOLits.size()]);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
SSCIVMLogger.error(e.getMessage(), e);
|
||||
ExceptionUtils.marsh(e);
|
||||
}
|
||||
|
||||
return retvos;
|
||||
}
|
||||
|
||||
public Object submit(IVApplicationAggVO[] clientBills, IVApplicationAggVO[] originBills, Object assingUsers) throws BusinessException {
|
||||
if (clientBills != null && clientBills.length > 0) {
|
||||
String[] pks = new String[clientBills.length];
|
||||
|
||||
for(int i = 0; i < clientBills.length; ++i) {
|
||||
pks[i] = clientBills[i].getParentVO().getPk_ivapplication();
|
||||
}
|
||||
|
||||
IVMSagaValidationUtils.checkSagaStatus(pks, IVApplicationHeadVO.getDefaultTableName(), "pk_ivapplication");
|
||||
}
|
||||
|
||||
List<IVApplicationAggVO> retvos = new ArrayList();
|
||||
|
||||
try {
|
||||
for(int i = 0; i < clientBills.length; ++i) {
|
||||
AggregatedValueObject billVO = clientBills[i];
|
||||
if (clientBills[i].getParentVO().getBillstatus() != -1) {
|
||||
String var10002 = NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0", "01058sal-0025");
|
||||
throw new BusinessException(var10002 + (i + 1) + NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0", "01058sal-0026"));
|
||||
}
|
||||
|
||||
Object retObj = this.doNccCommit(billVO, assingUsers);
|
||||
if (retObj instanceof Map) {
|
||||
return retObj;
|
||||
}
|
||||
|
||||
if (retObj != null) {
|
||||
retvos.add((IVApplicationAggVO)((MessageVO)retObj).getSuccessVO());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
SSCIVMLogger.error(e.getMessage(), e);
|
||||
ExceptionUtils.marsh(e);
|
||||
}
|
||||
|
||||
return retvos.toArray(new IVApplicationAggVO[retvos.size()]);
|
||||
}
|
||||
|
||||
private Object doNccCommit(AggregatedValueObject aggVos, Object assingUsers) throws Exception {
|
||||
MessageVO result = null;
|
||||
IVApplicationQueryService ivApplicationQueryService = (IVApplicationQueryService)NCLocator.getInstance().lookup(IVApplicationQueryService.class);
|
||||
AggregatedValueObject billVO = aggVos;
|
||||
String djlxbm = null;
|
||||
|
||||
try {
|
||||
if (billVO.getParentVO() instanceof IVApplicationHeadVO) {
|
||||
IVApplicationAggVO[] submitVos = ivApplicationQueryService.queryAggVOsByPks(new String[]{((IVApplicationHeadVO)billVO.getParentVO()).getPrimaryKey()});
|
||||
if (submitVos != null && submitVos.length > 0 && (null == ((IVApplicationHeadVO)billVO.getParentVO()).getTs() || ((IVApplicationHeadVO)billVO.getParentVO()).getTs().compareTo(submitVos[0].getParentVO().getTs()) != 0)) {
|
||||
throw new Exception(NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0", "01058sal-0057"));
|
||||
}
|
||||
|
||||
String tradetypePk = ((IVApplicationHeadVO)billVO.getParentVO()).getPk_tradetype();
|
||||
djlxbm = ((IBilltypeService)NCLocator.getInstance().lookup(IBilltypeService.class)).getBilltypeCode(tradetypePk);
|
||||
}
|
||||
|
||||
Object retObj = null;
|
||||
HashMap<String, String> paramMap = new HashMap();
|
||||
paramMap.put("silently", "silently");
|
||||
String cuserid = InvocationInfoProxy.getInstance().getUserId();
|
||||
UFDateTime currTime = new UFDateTime(InvocationInfoProxy.getInstance().getBizDateTime());
|
||||
WorkflownoteVO noteVO = null;
|
||||
|
||||
try {
|
||||
noteVO = ((IWorkflowMachine)NCLocator.getInstance().lookup(IWorkflowMachine.class)).checkWorkFlow("SAVE", djlxbm, billVO, (HashMap)null);
|
||||
} catch (BusinessException e) {
|
||||
SSCIVMLogger.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
boolean hasWorkfFlow = false;
|
||||
if (noteVO == null) {
|
||||
try {
|
||||
IFlowBizItf fbi = (IFlowBizItf)PfMetadataTools.getBizItfImpl(billVO, IFlowBizItf.class);
|
||||
IWorkflowDefine wfDefine = (IWorkflowDefine)NCLocator.getInstance().lookup(IWorkflowDefine.class);
|
||||
hasWorkfFlow = wfDefine.hasValidProcessDef(((IVApplicationHeadVO)billVO.getParentVO()).getPk_org(), ((IVApplicationHeadVO)billVO.getParentVO()).getTranstypecode(), fbi.getPkorg(), fbi.getBillMaker(), fbi.getEmendEnum(), WorkflowTypeEnum.Workflow.getIntValue());
|
||||
if (!hasWorkfFlow) {
|
||||
hasWorkfFlow = wfDefine.hasValidProcessDef(InvocationInfoProxy.getInstance().getGroupId(), ((IVApplicationHeadVO)billVO.getParentVO()).getTranstypecode(), fbi.getPkorg(), fbi.getBillMaker(), fbi.getEmendEnum(), WorkflowTypeEnum.Workflow.getIntValue());
|
||||
}
|
||||
} catch (PFBusinessException var16) {
|
||||
String err = NCLangRes4VoTransl.getNCLangRes().getStrByID("pfworkflow", "UPPpfworkflow-000058");
|
||||
if (var16.getMessage() == null || !var16.getMessage().contains(err)) {
|
||||
throw new PFBusinessException(var16);
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasWorkfFlow) {
|
||||
((IVApplicationHeadVO)billVO.getParentVO()).setApprover(cuserid);
|
||||
((IVApplicationHeadVO)billVO.getParentVO()).setApprovedate(currTime);
|
||||
((IVApplicationHeadVO)billVO.getParentVO()).setBillstatus(1);
|
||||
UFDate preDate = ((IVApplicationHeadVO)billVO.getParentVO()).getPreparedate();
|
||||
if (preDate.toStdString().substring(0, 10).compareTo(currTime.toStdString().substring(0, 10)) > 0) {
|
||||
throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0", "01058sal-0150"));
|
||||
}
|
||||
|
||||
retObj = this.approveVOs(new IVApplicationAggVO[]{(IVApplicationAggVO)billVO});
|
||||
} else {
|
||||
retObj = this.commitScriptPFlow("START", djlxbm, billVO, assingUsers);
|
||||
}
|
||||
} else {
|
||||
retObj = this.commitScriptPFlow("SAVE", djlxbm, billVO, assingUsers);
|
||||
}
|
||||
|
||||
if (retObj == null) {
|
||||
result = new MessageVO(billVO, 8);
|
||||
result.setSuccess(false);
|
||||
result.setErrorMessage(NCLangRes4VoTransl.getNCLangRes().getStrByID("2011", "UPP2011-000339"));
|
||||
} else {
|
||||
if (retObj instanceof Map) {
|
||||
return retObj;
|
||||
}
|
||||
|
||||
if (retObj instanceof AggregatedValueObject) {
|
||||
result = new MessageVO((AggregatedValueObject)retObj, 8);
|
||||
} else if (retObj instanceof MessageVO[]) {
|
||||
MessageVO[] messages = (MessageVO[])retObj;
|
||||
result = messages[0];
|
||||
} else if (retObj instanceof MessageVO) {
|
||||
result = (MessageVO)retObj;
|
||||
} else if (retObj instanceof PfProcessBatchRetObject) {
|
||||
if ((PfProcessBatchRetObject)retObj != null && ((PfProcessBatchRetObject)retObj).getRetObj() != null) {
|
||||
result = (MessageVO)((PfProcessBatchRetObject)retObj).getRetObj()[0];
|
||||
} else {
|
||||
result = new MessageVO((AggregatedValueObject)null, 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
SSCIVMLogger.error(e.getMessage(), e);
|
||||
ExceptionUtils.marsh(e);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private Object commitScriptPFlow(String actionName, String djlxbm, AggregatedValueObject aggVo, Object assingUsers) throws BusinessException {
|
||||
new JSONObject();
|
||||
HashMap<Object, Object> eParam = new HashMap();
|
||||
if (assingUsers instanceof LinkedTreeMap) {
|
||||
JSONObject assignContent = JSON.parseObject((new Gson()).toJson(assingUsers));
|
||||
eParam.put("content", assignContent);
|
||||
}
|
||||
|
||||
eParam.put("silently", "silently");
|
||||
if ("START".equals(actionName)) {
|
||||
String checkman = "";
|
||||
BaseDAO dao = new BaseDAO();
|
||||
String sql = " SELECT a.checkman FROM PUB_WORKFLOWNOTE a INNER JOIN PUB_WF_TASK b ON a.PK_WF_TASK = b.PK_WF_TASK WHERE a.billid ='" + aggVo.getParentVO().getPrimaryKey() + "' and a.actiontype='MAKEBILL' and b.REJECTTACHEACTIVITYID is not null and a.ischeck='N' ";
|
||||
Object obj = dao.executeQuery(sql, new ColumnProcessor());
|
||||
if (obj != null) {
|
||||
checkman = (String)obj;
|
||||
actionName = "SIGNAL" + checkman;
|
||||
}
|
||||
}
|
||||
|
||||
CloudPFlowContext context = new CloudPFlowContext();
|
||||
context.setActionName(actionName);
|
||||
context.setBillType(djlxbm);
|
||||
context.setBillVos(new AggregatedValueObject[]{aggVo});
|
||||
context.seteParam(eParam);
|
||||
Object[] ss = null;
|
||||
if ("START".equals(actionName)) {
|
||||
WorkflownoteVO noteVO = null;
|
||||
|
||||
try {
|
||||
noteVO = ((IWorkflowMachine)NCLocator.getInstance().lookup(IWorkflowMachine.class)).checkWorkFlow("START", djlxbm, aggVo, (HashMap)null);
|
||||
} catch (BusinessException e) {
|
||||
SSCIVMLogger.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
WorkflowTypeEnum flowtype = PfUtilTools.runningFlowStatus(StringUtils.isNotEmpty(context.getTrantype()) ? context.getTrantype() : context.getBillType(), aggVo.getParentVO().getPrimaryKey());
|
||||
if (flowtype == null && (noteVO == null || noteVO.getTaskInfo().getAssignableInfos().size() == 0)) {
|
||||
ss = ((ICloudScriptPFlowService)NCLocator.getInstance().lookup(ICloudScriptPFlowService.class)).exeScriptPFlow_CommitNoFlowBatch(context);
|
||||
}
|
||||
}
|
||||
|
||||
if (ss == null) {
|
||||
ss = ((ICloudScriptPFlowService)NCLocator.getInstance().lookup(ICloudScriptPFlowService.class)).exeScriptPFlow(context);
|
||||
}
|
||||
|
||||
Object obj = ss[0];
|
||||
if (obj instanceof Map map && ((Map)obj).get("workflow") != null && ("approveflow".equals(String.valueOf(((Map)obj).get("workflow"))) || "workflow".equals(String.valueOf(((Map)obj).get("workflow"))))) {
|
||||
if (map.get("workflow") != null) {
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
public IVApplicationAggVO[] recall(IVApplicationAggVO[] clientBills, IVApplicationAggVO[] originBills) throws BusinessException {
|
||||
if (clientBills != null && clientBills.length > 0) {
|
||||
String[] pks = new String[clientBills.length];
|
||||
|
||||
for(int i = 0; i < clientBills.length; ++i) {
|
||||
pks[i] = clientBills[i].getParentVO().getPk_ivapplication();
|
||||
}
|
||||
|
||||
IVMSagaValidationUtils.checkSagaStatus(pks, IVApplicationHeadVO.getDefaultTableName(), "pk_ivapplication");
|
||||
}
|
||||
|
||||
List<IVApplicationAggVO> retvos = new ArrayList();
|
||||
|
||||
try {
|
||||
for(int i = 0; i < clientBills.length; ++i) {
|
||||
AggregatedValueObject billVO = clientBills[i];
|
||||
if (clientBills[i].getParentVO().getBillstatus() != 3 && clientBills[i].getParentVO().getBillstatus() != 1) {
|
||||
String var11 = NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0", "01058sal-0025");
|
||||
throw new BusinessException(var11 + (i + 1) + NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0", "01058sal-0028"));
|
||||
}
|
||||
|
||||
List<IVApplogVO> applogVOList = ((ApplicationLogService)NCLocator.getInstance().lookup(ApplicationLogService.class)).queryApplicationLogByLyid(TransSpiltMergePksUtil.transIvapplicationToLyid(new String[]{clientBills[i].getParentVO().getPk_ivapplication()}));
|
||||
if (applogVOList != null && applogVOList.size() > 0) {
|
||||
String var10002 = NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0", "01058sal-0029");
|
||||
throw new BusinessException(var10002 + clientBills[i].getParentVO().getBillno() + NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0", "01058sal-0030"));
|
||||
}
|
||||
|
||||
Object retObj = this.doNccRecall(billVO);
|
||||
retvos.add((IVApplicationAggVO)((MessageVO)retObj).getSuccessVO());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
SSCIVMLogger.error(e.getMessage(), e);
|
||||
ExceptionUtils.marsh(e);
|
||||
}
|
||||
|
||||
return (IVApplicationAggVO[])retvos.toArray(new IVApplicationAggVO[retvos.size()]);
|
||||
}
|
||||
|
||||
private Object doNccRecall(AggregatedValueObject billVO) throws Exception {
|
||||
MessageVO result = null;
|
||||
IVApplicationQueryService ivApplicationQueryService = (IVApplicationQueryService)NCLocator.getInstance().lookup(IVApplicationQueryService.class);
|
||||
String djlxbm = null;
|
||||
|
||||
try {
|
||||
if (billVO.getParentVO() instanceof IVApplicationHeadVO) {
|
||||
IVApplicationAggVO[] submitVos = ivApplicationQueryService.queryAggVOsByPks(new String[]{((IVApplicationHeadVO)billVO.getParentVO()).getPrimaryKey()});
|
||||
if (submitVos != null && submitVos.length > 0 && (null == ((IVApplicationHeadVO)billVO.getParentVO()).getTs() || ((IVApplicationHeadVO)billVO.getParentVO()).getTs().compareTo(submitVos[0].getParentVO().getTs()) != 0)) {
|
||||
throw new Exception(NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0", "01058sal-0057"));
|
||||
}
|
||||
|
||||
String tradetypePk = ((IVApplicationHeadVO)billVO.getParentVO()).getPk_tradetype();
|
||||
djlxbm = ((IBilltypeService)NCLocator.getInstance().lookup(IBilltypeService.class)).getBilltypeCode(tradetypePk);
|
||||
}
|
||||
|
||||
String actionName = "RECALL";
|
||||
boolean isApproveflowFlag = IVSaleUtil.isApproveFlowStartup(billVO.getParentVO().getPrimaryKey(), djlxbm);
|
||||
if (isApproveflowFlag) {
|
||||
actionName = "UNSAVE";
|
||||
}
|
||||
|
||||
Object[] exeScriptPFlow = null;
|
||||
CloudPFlowContext context = new CloudPFlowContext();
|
||||
context.setActionName(actionName);
|
||||
context.setBillType(djlxbm);
|
||||
context.setBillVos(new AggregatedValueObject[]{billVO});
|
||||
context.seteParam(new HashMap());
|
||||
WorkflowTypeEnum flowtype = PfUtilTools.runningFlowStatus(StringUtils.isNotEmpty(context.getTrantype()) ? context.getTrantype() : context.getBillType(), billVO.getParentVO().getPrimaryKey());
|
||||
ICloudScriptPFlowService service = (ICloudScriptPFlowService)NCLocator.getInstance().lookup(ICloudScriptPFlowService.class);
|
||||
if (flowtype == null) {
|
||||
exeScriptPFlow = service.exeScriptPFlow_UnSaveNoFlowBatch(context);
|
||||
} else {
|
||||
exeScriptPFlow = service.exeScriptPFlow(context);
|
||||
}
|
||||
|
||||
if (exeScriptPFlow[0] instanceof PfProcessBatchRetObject) {
|
||||
if ((PfProcessBatchRetObject)exeScriptPFlow[0] != null && ((PfProcessBatchRetObject)exeScriptPFlow[0]).getRetObj() != null) {
|
||||
result = new MessageVO((AggregatedValueObject)((PfProcessBatchRetObject)exeScriptPFlow[0]).getRetObj()[0], 9);
|
||||
} else {
|
||||
result = new MessageVO((AggregatedValueObject)null, 9);
|
||||
}
|
||||
} else if (exeScriptPFlow[0] instanceof AggregatedValueObject) {
|
||||
result = new MessageVO((AggregatedValueObject)exeScriptPFlow[0], 9);
|
||||
}
|
||||
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
SSCIVMLogger.error(e.getMessage(), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public IVApplicationAggVO dealDefValue(String uistate, String pk_group, String pk_user, String pk_tradetype, String appcode) throws Exception {
|
||||
IVApplicationAggVO retvos = new IVApplicationAggVO();
|
||||
IVApplicationBillDefValue billDefValue = new IVApplicationBillDefValue();
|
||||
if (!"onInit".equals(uistate) && !"add".equals(uistate)) {
|
||||
if (!"onChange".equals(uistate) && "edit".equals(uistate)) {
|
||||
}
|
||||
} else {
|
||||
retvos = billDefValue.getNewVO(pk_group, pk_user, pk_tradetype, appcode);
|
||||
}
|
||||
|
||||
return retvos;
|
||||
}
|
||||
|
||||
public String getOrgLocalCurrPK(String pk_org) throws BusinessException {
|
||||
String orgLocalCurrPK = CurrencyRateUtilHelper.getInstance().getLocalCurrtypeByOrgID(pk_org);
|
||||
return orgLocalCurrPK;
|
||||
}
|
||||
|
||||
public Integer getCurrDigit(String pk_currtype) throws BusinessException {
|
||||
if (StringUtils.isEmpty(pk_currtype)) {
|
||||
return 0;
|
||||
} else {
|
||||
CurrtypeVO currtypeVO = null;
|
||||
if (RuntimeEnv.getInstance().isRunningInServer()) {
|
||||
currtypeVO = CurrtypeQuery.getInstance().getCurrtypeVO(pk_currtype);
|
||||
}
|
||||
|
||||
return currtypeVO == null ? 0 : currtypeVO.getCurrdigit();
|
||||
}
|
||||
}
|
||||
|
||||
public String getOrgVersion(String voclassname, String name, String pk_org) throws Exception {
|
||||
OrgVO[] vos = OrgQueryUtil.queryOrgVOByPks(new String[]{pk_org});
|
||||
return vos[0].getPk_vid();
|
||||
}
|
||||
|
||||
public MessageVO[] approveVOs(IVApplicationAggVO[] applicationAggVOs) throws Exception {
|
||||
if (applicationAggVOs != null && applicationAggVOs.length != 0) {
|
||||
for(int i = 0; i < applicationAggVOs.length; ++i) {
|
||||
applicationAggVOs[i].getParentVO().setStatus(1);
|
||||
}
|
||||
|
||||
IVApplicationAggVO[] aggVOs = this.updateBatch(applicationAggVOs, (IVApplicationAggVO[])null);
|
||||
MessageVO[] msgs = new MessageVO[aggVOs.length];
|
||||
|
||||
for(int i = 0; i < aggVOs.length; ++i) {
|
||||
msgs[i] = new MessageVO(aggVOs[i], 1);
|
||||
}
|
||||
|
||||
EventDispatcher.fireEvent(new ApplicationBusinessEvent("f4555e3d-c6a1-42bf-8354-57be38eb5dd6", "1020", aggVOs));
|
||||
IVApplicationInvoiceService applicationInvoiceService = (IVApplicationInvoiceService)NCLocator.getInstance().lookup(IVApplicationInvoiceService.class);
|
||||
|
||||
for(int i = 0; i < aggVOs.length; ++i) {
|
||||
String billTypePk = aggVOs[i].getParentVO().getPk_tradetype();
|
||||
String billtypeCode = ((IBilltypeService)NCLocator.getInstance().lookup(IBilltypeService.class)).getBilltypeCode(billTypePk);
|
||||
IVBilltypeVO billtypeVO = ((IVABilltypeExtService)NCLocator.getInstance().lookup(IVABilltypeExtService.class)).getBilltypeVOByCode(billtypeCode, InvocationInfoProxy.getInstance().getGroupId());
|
||||
if (null != billtypeVO && IVApplicationSlsmUtil.slsmCheck(aggVOs[i]) && billtypeVO.getIsatuo_invoice() == UFBoolean.TRUE) {
|
||||
JSONObject jsonObj = new JSONObject();
|
||||
IVApplicationAggVO[] voAfterMakeInvoice = applicationInvoiceService.makeInvoice(new IVApplicationAggVO[]{aggVOs[i]}, jsonObj, (Map)null, false);
|
||||
msgs[i] = new MessageVO(voAfterMakeInvoice[0], 1);
|
||||
}
|
||||
}
|
||||
|
||||
return msgs;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public Object unApproveVOs(IVApplicationAggVO[] applicationAggVOs) throws BusinessException {
|
||||
if (applicationAggVOs != null && applicationAggVOs.length != 0) {
|
||||
for(int i = 0; i < applicationAggVOs.length; ++i) {
|
||||
List<IVApplogVO> applogVOList = ((ApplicationLogService)NCLocator.getInstance().lookup(ApplicationLogService.class)).queryApplicationLogByLyid(TransSpiltMergePksUtil.transIvapplicationToLyid(new String[]{applicationAggVOs[i].getParentVO().getPk_ivapplication()}));
|
||||
if (applogVOList != null && applogVOList.size() > 0) {
|
||||
String var10002 = NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0", "01058sal-0029");
|
||||
throw new BusinessException(var10002 + applicationAggVOs[i].getParentVO().getBillno() + NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0", "01058sal-0030"));
|
||||
}
|
||||
|
||||
applicationAggVOs[i].getParentVO().setStatus(1);
|
||||
}
|
||||
|
||||
IVApplicationAggVO[] aggVOs = this.updateBatch(applicationAggVOs, (IVApplicationAggVO[])null);
|
||||
MessageVO[] msgs = new MessageVO[aggVOs.length];
|
||||
|
||||
for(int i = 0; i < aggVOs.length; ++i) {
|
||||
msgs[i] = new MessageVO(aggVOs[i], 2);
|
||||
}
|
||||
|
||||
EventDispatcher.fireEvent(new ApplicationBusinessEvent("f4555e3d-c6a1-42bf-8354-57be38eb5dd6", "1022", aggVOs));
|
||||
return msgs;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public IVApplicationAggVO copyApplication(String pk) throws Exception {
|
||||
IVApplicationAggVO aggVO = ((IVApplicationQueryService)NCLocator.getInstance().lookup(IVApplicationQueryService.class)).queryByPK(pk);
|
||||
if (aggVO == null) {
|
||||
throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0", "01058sal-0057"));
|
||||
} else if (aggVO.getParentVO().getHzfp() != UFBoolean.TRUE && aggVO.getParentVO().getZffp() != UFBoolean.TRUE) {
|
||||
if (aggVO.getParentVO().getSrc_pkbusibill() != null) {
|
||||
throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0", "01058sal-0032"));
|
||||
} else {
|
||||
IVApplicationAggVO copyVo = aggVO.clone();
|
||||
IVApplicationHeadVO headvo = copyVo.getParentVO();
|
||||
String[] headFieldNotCopy = new String[]{"pk_ivapplication", "approvedate", "approver", "billno", "billstatus", "creationtime", "creator", "kpr", "kpzt", "lyid", "modifiedtime", "modifier", "preparedate", "src_billno", "src_pkbusibill", "src_tradetype", "saga_frozen", "saga_gtxid", "saga_btxid", "saga_status", "invoiced_hjje", "invoiced_hjse", "invoiced_jshj", "invoiceing_hjje", "invoiceing_hjse", "invoiceing_jshj", "caninvoice_hjje", "caninvoice_hjse", "caninvoice_jshj", "hzxxsqb", "email", "slsm"};
|
||||
|
||||
for(int i = 0; i < headFieldNotCopy.length; ++i) {
|
||||
headvo.setAttributeValue(headFieldNotCopy[i], (Object)null);
|
||||
}
|
||||
|
||||
Set<String> meterialPKs = new HashSet();
|
||||
|
||||
for(int i = 0; i < copyVo.getChildrenVO().length; ++i) {
|
||||
IVApplicationBodyVO bodyVO = (IVApplicationBodyVO)copyVo.getChildrenVO()[i];
|
||||
bodyVO.setPk_ivappdetail((String)null);
|
||||
bodyVO.setPk_ivapplication((String)null);
|
||||
bodyVO.setCaninvoice_se(UFDouble.ZERO_DBL);
|
||||
bodyVO.setCaninvoice_xmje(UFDouble.ZERO_DBL);
|
||||
bodyVO.setCaninvoice_xmjshj(UFDouble.ZERO_DBL);
|
||||
bodyVO.setCaninvoice_xmsl(UFDouble.ZERO_DBL);
|
||||
bodyVO.setInvoiced_se(UFDouble.ZERO_DBL);
|
||||
bodyVO.setInvoiced_xmje(UFDouble.ZERO_DBL);
|
||||
bodyVO.setInvoiced_xmjshj(UFDouble.ZERO_DBL);
|
||||
bodyVO.setInvoiced_xmsl(UFDouble.ZERO_DBL);
|
||||
bodyVO.setInvoiceing_se(UFDouble.ZERO_DBL);
|
||||
bodyVO.setInvoiceing_xmje(UFDouble.ZERO_DBL);
|
||||
bodyVO.setInvoiceing_xmjshj(UFDouble.ZERO_DBL);
|
||||
bodyVO.setInvoiceing_xmsl(UFDouble.ZERO_DBL);
|
||||
if (bodyVO.getPk_materiel() != null) {
|
||||
meterialPKs.add(bodyVO.getPk_materiel());
|
||||
}
|
||||
|
||||
if (IVAplocationFPXZ.FPXZ_ZCH.toIntValue() == bodyVO.getFphxz()) {
|
||||
bodyVO.setHh((String)null);
|
||||
bodyVO.setZkhhh((String)null);
|
||||
}
|
||||
}
|
||||
|
||||
if (copyVo.getIvTspzsBodyVO() != null) {
|
||||
for(int i = 0; i < copyVo.getIvTspzsBodyVO().length; ++i) {
|
||||
IVTspzsBodyVO ivTspzsBodyVO = copyVo.getIvTspzsBodyVO()[i];
|
||||
ivTspzsBodyVO.setPk_ivtspzsdetail((String)null);
|
||||
ivTspzsBodyVO.setPk_ivapplication((String)null);
|
||||
ivTspzsBodyVO.setPk_ivappdetail((String)null);
|
||||
}
|
||||
}
|
||||
|
||||
if (meterialPKs.size() > 0) {
|
||||
Map<String, String> meterialMap = new HashMap();
|
||||
MaterialVO[] materialVOS = ((IMaterialBaseInfoQueryService)NCLocator.getInstance().lookup(IMaterialBaseInfoQueryService.class)).queryDataByPks((String[])meterialPKs.toArray(new String[0]));
|
||||
meterialPKs.clear();
|
||||
|
||||
for(MaterialVO materialVO : materialVOS) {
|
||||
meterialPKs.add(materialVO.getPk_source());
|
||||
meterialMap.put(materialVO.getPk_material(), materialVO.getPk_source());
|
||||
}
|
||||
|
||||
Map<String, MaterialVersionVO> map = ((IMaterialPubService)NCLocator.getInstance().lookup(IMaterialPubService.class)).queryMaterialBaseInfoByOidPks((String[])meterialPKs.toArray(new String[0]), new String[]{"pk_material"});
|
||||
|
||||
for(int i = 0; i < copyVo.getChildrenVO().length; ++i) {
|
||||
IVApplicationBodyVO bodyVO = (IVApplicationBodyVO)copyVo.getChildrenVO()[i];
|
||||
if (bodyVO.getPk_materiel() != null) {
|
||||
bodyVO.setPk_materiel(((MaterialVersionVO)map.get(meterialMap.get(bodyVO.getPk_materiel()))).getPk_material());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String cuserid = InvocationInfoProxy.getInstance().getUserId();
|
||||
UFDateTime currTime = new UFDateTime(InvocationInfoProxy.getInstance().getBizDateTime());
|
||||
UFDate currDate = currTime.getDate();
|
||||
headvo.setBillstatus(-1);
|
||||
headvo.setPreparedate(currDate);
|
||||
headvo.setCreator(cuserid);
|
||||
headvo.setCreationtime(currTime);
|
||||
headvo.setModifier(cuserid);
|
||||
headvo.setModifiedtime(currTime);
|
||||
headvo.setHzfp(UFBoolean.FALSE);
|
||||
headvo.setCkfp(UFBoolean.FALSE);
|
||||
headvo.setZffp(UFBoolean.FALSE);
|
||||
headvo.setFpdm("");
|
||||
headvo.setFphm("");
|
||||
Integer paramValue = SysInitQuery.getParaInt(headvo.getPk_org(), "SSCIVA01");
|
||||
headvo.setKpfs(paramValue == null ? IVAplocationKPFS.ZLKP.toIntValue() : paramValue);
|
||||
Map<String, UFDate> map = new HashMap();
|
||||
map.put(headvo.getPk_customer(), headvo.getPreparedate());
|
||||
Map<String, String> idMap = ((ICustomerPubService)NCLocator.getInstance().lookup(ICustomerPubService.class)).getCustomerLastVIDByOidAndDate(map);
|
||||
headvo.setPk_customer_v((String)idMap.get(headvo.getPk_customer()));
|
||||
|
||||
for(int i = 0; i < copyVo.getChildrenVO().length; ++i) {
|
||||
IVApplicationBodyVO bodyvo = (IVApplicationBodyVO)copyVo.getChildrenVO()[i];
|
||||
bodyvo.setStatus(2);
|
||||
}
|
||||
|
||||
return copyVo;
|
||||
}
|
||||
} else {
|
||||
throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0", "01058sal-0031"));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isFlowCheckman(String billId, String billType, String userId) throws BusinessException {
|
||||
return IVSaleUtil.isCheckman(billId, billType, userId);
|
||||
}
|
||||
|
||||
public IVApplicationAggVO calHeadJe(IVApplicationAggVO vo) throws BusinessException {
|
||||
UFDouble hjje = UFDouble.ZERO_DBL;
|
||||
UFDouble hjse = UFDouble.ZERO_DBL;
|
||||
UFDouble jshj = UFDouble.ZERO_DBL;
|
||||
UFDouble can_hjje = UFDouble.ZERO_DBL;
|
||||
UFDouble can_hjse = UFDouble.ZERO_DBL;
|
||||
UFDouble can_jshj = UFDouble.ZERO_DBL;
|
||||
|
||||
for(IVApplicationBodyVO bvo : vo.getBodyVOs()) {
|
||||
if (bvo.getStatus() != 3) {
|
||||
UFDouble xmje = bvo.getXmje() == null ? UFDouble.ZERO_DBL : bvo.getXmje();
|
||||
UFDouble se = bvo.getSe() == null ? UFDouble.ZERO_DBL : bvo.getSe();
|
||||
UFDouble xmjshj = bvo.getXmjshj() == null ? UFDouble.ZERO_DBL : bvo.getXmjshj();
|
||||
UFDouble can_xmje = bvo.getCaninvoice_xmje() == null ? UFDouble.ZERO_DBL : bvo.getCaninvoice_xmje();
|
||||
UFDouble can_se = bvo.getCaninvoice_se() == null ? UFDouble.ZERO_DBL : bvo.getCaninvoice_se();
|
||||
UFDouble can_xmjshj = bvo.getCaninvoice_xmjshj() == null ? UFDouble.ZERO_DBL : bvo.getCaninvoice_xmjshj();
|
||||
hjje = hjje.add(xmje);
|
||||
hjse = hjse.add(se);
|
||||
jshj = jshj.add(xmjshj);
|
||||
can_hjje = can_hjje.add(can_xmje);
|
||||
can_hjse = can_hjse.add(can_se);
|
||||
can_jshj = can_jshj.add(can_xmjshj);
|
||||
}
|
||||
}
|
||||
|
||||
IVApplicationHeadVO headvo = vo.getHeadVO();
|
||||
headvo.setHjje(hjje);
|
||||
headvo.setHjse(hjse);
|
||||
headvo.setJshj(jshj);
|
||||
headvo.setCaninvoice_hjje(can_hjje);
|
||||
headvo.setCaninvoice_hjse(can_hjse);
|
||||
headvo.setCaninvoice_jshj(can_jshj);
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package nccloud.web.uapbd.ref.pub;
|
||||
|
||||
import nc.uap.utils.SQLHelper;
|
||||
import nc.vo.bd.material.MaterialVO;
|
||||
import nc.vo.bd.material.MaterialVersionVO;
|
||||
import nc.vo.bd.material.marbasclass.MarBasClassVO;
|
||||
import nc.vo.ml.MultiLangUtil;
|
||||
import nccloud.framework.web.processor.IRefSqlBuilder;
|
||||
import nccloud.framework.web.processor.refgrid.RefQueryInfo;
|
||||
import nccloud.framework.web.ui.meta.RefMeta;
|
||||
import nccloud.framework.web.ui.meta.TreeRefMeta;
|
||||
import nccloud.web.refer.action.DefaultTreeGridRefAction;
|
||||
import nccloud.web.refer.sqlbuilder.StrongDefaultTreeGridRefSqlBuilder;
|
||||
|
||||
public class MaterialGridRef extends DefaultTreeGridRefAction {
|
||||
public MaterialGridRef() {
|
||||
this.setClassPkFieldName("pk_marbasclass");
|
||||
this.setClassTableName((new MarBasClassVO()).getTableName());
|
||||
this.setClassIsShowDisableData(false);
|
||||
this.setClassMdClassId("c099f7d7-52a9-4b98-bee7-2e3a6c3ea263");
|
||||
this.setClassResourceCode("materialbasclass");
|
||||
this.setShowDisabledData(false);
|
||||
this.setUnitPkKey("pk_org");
|
||||
this.setMdClassId("c7dc0ccd-8872-4eee-8882-160e8f49dfad");
|
||||
this.setResourceCode("material_v");
|
||||
this.setUsualDataPkFieldName("pk_material");
|
||||
this.setUsualDataTableName(MaterialVO.getDefaultTableName());
|
||||
}
|
||||
|
||||
public String getOrderSql(RefQueryInfo paramRefQueryInfo, RefMeta paramRefMeta) {
|
||||
return " order by code";
|
||||
}
|
||||
|
||||
public RefMeta getRefMeta(RefQueryInfo refQueryInfo) {
|
||||
TreeRefMeta meta = new TreeRefMeta();
|
||||
meta.setCodeField("code");
|
||||
meta.setNameField("name");
|
||||
meta.setFullTxtNameField("name" + MultiLangUtil.getCurrentLangSeqSuffix());
|
||||
meta.setPkField("pk_source");
|
||||
meta.setPidField("pk_marbasclass");
|
||||
meta.setMutilLangNameRef(true);
|
||||
meta.setExtraFields(new String[]{"pk_org", "materialspec", "materialtype", "materialshortname",
|
||||
"materialmnecode", "graphid", "pk_measdoc", "measdoc_name", "org_name", "materialmgt", "pk_material", "memo"});
|
||||
String var10001 = SQLHelper.getMultiLangNameColumn("bd_material_v.name");
|
||||
meta.setTableName("(select bd_material_v.pk_material as pk_material, bd_material_v.pk_marbasclass as pk_marbasclass," +
|
||||
" bd_material_v.pk_org as pk_org,bd_material_v.dr as dr,bd_material_v.setpartsflag as setpartsflag,bd_material_v.code as code," +
|
||||
var10001 + " as name,bd_material_v.version as version,bd_material_v.enablestate as enablestate," +
|
||||
"bd_material_v.discountflag as discountflag,bd_material_v.fee as fee,bd_material_v.pk_group as pk_group," +
|
||||
"bd_material_v.materialspec as materialspec,bd_material_v.materialtype as materialtype,bd_material_v.materialshortname as materialshortname," +
|
||||
"bd_material_v.materialmgt as materialmgt,bd_material_v.materialmnecode as materialmnecode,bd_material_v.graphid as graphid," +
|
||||
"bd_material_v.pk_measdoc as pk_measdoc,bd_material_v.pk_source as pk_source,bd_material_v.memo as memo,bd_material_v.retail as retail, " +
|
||||
"bd_material_v.electronicsale as electronicsale, bd_material_v.isfeature as isfeature,bd_material_v.matchmode as matchmode, " +
|
||||
SQLHelper.getMultiLangNameColumn("org_orgs.name") + " as org_name," + SQLHelper.getMultiLangNameColumn("bd_measdoc.name") +
|
||||
" as measdoc_name,bd_material_v.name2 as name2,bd_material_v.name3 as name3,bd_material_v.name4 as name4,bd_material_v.name5 as name5," +
|
||||
"bd_material_v.name6 as name6 from bd_material_v left join org_orgs on bd_material_v.pk_org=org_orgs.pk_org " +
|
||||
"left join bd_measdoc on bd_material_v.pk_measdoc = bd_measdoc.pk_measdoc ) aa");
|
||||
meta.setDefaultTableName(MaterialVersionVO.getDefaultTableName());
|
||||
meta.setFullTxtTabName(MaterialVersionVO.getDefaultTableName());
|
||||
return meta;
|
||||
}
|
||||
|
||||
protected IRefSqlBuilder getRefSqlBuilder(RefQueryInfo refQueryInfo) {
|
||||
return new StrongDefaultTreeGridRefSqlBuilder(this, this, refQueryInfo);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,122 @@
|
|||
package nc.bs.uapbd.task;
|
||||
|
||||
import nc.bs.dao.BaseDAO;
|
||||
import nc.bs.logging.Logger;
|
||||
import nc.bs.pub.pa.PreAlertObject;
|
||||
import nc.bs.pub.taskcenter.BgWorkingContext;
|
||||
import nc.bs.pub.taskcenter.IBackgroundWorkPlugin;
|
||||
import nc.bs.trade.business.HYSuperDMO;
|
||||
import nc.jdbc.framework.processor.MapListProcessor;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nc.vo.sscivm.ivsale.IVApplicationHeadVO;
|
||||
import nc.vo.sscivm.ivsale.IVApplogVO;
|
||||
import uap.mw.trans.TransactionFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class InvoiceTaskPlugin implements IBackgroundWorkPlugin{
|
||||
|
||||
@Override
|
||||
public PreAlertObject executeTask(BgWorkingContext arg0) throws BusinessException {
|
||||
// TODO Auto-generated method stub
|
||||
Logger.error("---start----任务开始运行--");
|
||||
try {
|
||||
BaseDAO dao = new BaseDAO();
|
||||
String sql = " SELECT sscivm_invoice.pk_invoice,so_saleinvoice.csaleinvoiceid,so_saleinvoice.vbillcode billcode, sscivm_invoice.fphm, " +
|
||||
"sscivm_invoice.Gmfmc, sscivm_invoice.Jshj, sscivm_invoice.viewurl, sscivm_invoice.billno " +
|
||||
" FROM sscivm_invoice " +
|
||||
" left join sscivm_invoice_relation on sscivm_invoice_relation.PK_INVOICE = sscivm_invoice.pk_invoice " +
|
||||
" left join so_saleinvoice on so_saleinvoice.csaleinvoiceid = sscivm_invoice_relation.billid " +
|
||||
" left join sscivm_ivapplog on sscivm_ivapplog.fphm = sscivm_invoice.fphm " +
|
||||
" where " +
|
||||
" sscivm_invoice_relation.billtype = '32' " +
|
||||
" and so_saleinvoice.vdef20 <> 'Y' " +
|
||||
" and sscivm_invoice.dr = 0 " +
|
||||
" and sscivm_ivapplog.kpzt = 2 ";
|
||||
// + " so_saleinvoice.vbillcode = 'SI2024070400000738' ";
|
||||
ArrayList<HashMap<String, Object>> al = (ArrayList<HashMap<String, Object>>)dao.executeQuery(sql, new MapListProcessor());
|
||||
Logger.error("---alData------"+al);
|
||||
if(al.size() > 0) {
|
||||
for(HashMap<String, Object> sscivm_invoice : al) {
|
||||
Object pk_invoice = sscivm_invoice.get("pk_invoice"); //bip发票主键
|
||||
Object csaleinvoiceid = sscivm_invoice.get("csaleinvoiceid"); //销售发票id
|
||||
Object billcode = sscivm_invoice.get("billcode"); //销售发票编码
|
||||
Object billno = sscivm_invoice.get("billno"); //bip单据编码编码
|
||||
Object fphm = sscivm_invoice.get("fphm");
|
||||
Object Gmfmc = sscivm_invoice.get("Gmfmc");
|
||||
Object Jshj = sscivm_invoice.get("Jshj");
|
||||
Object viewurl = sscivm_invoice.get("viewurl");
|
||||
String ctcode="";
|
||||
HYSuperDMO dmo = new HYSuperDMO();
|
||||
IVApplogVO[] ivApplogVO=(IVApplogVO[]) dmo.queryByWhereClause(IVApplogVO.class, "fphm='"+fphm+"' and dr=0 ");
|
||||
Logger.error("---ivApplogVO------"+ivApplogVO);
|
||||
if(ivApplogVO!=null&&ivApplogVO.length>0) {
|
||||
ivApplogVO[0].getLyid();//开票申请单主键
|
||||
IVApplicationHeadVO ivApplicationHeadVO =(IVApplicationHeadVO) dmo.queryByPrimaryKey(IVApplicationHeadVO.class, ivApplogVO[0].getLyid());
|
||||
ctcode=ivApplicationHeadVO.getDef2();//合同号
|
||||
}
|
||||
Object url = ctcode+"_"+Gmfmc+"_"+fphm+"_"+Jshj + ".pdf";
|
||||
/**
|
||||
* 回写逻辑:
|
||||
* 1.修改发票关联关系单据编码
|
||||
* 2.ERP销售发票回传,根据销售发票id,回写发票号和单据编号
|
||||
* 3.根据销售发票id 回写下游应收单表头表体发票号
|
||||
* 4.查询销售发票下游单据,如果有将下游单据表体字段【来源单据号】更新成新的发票号
|
||||
*/
|
||||
//手动开启事务
|
||||
TransactionFactory.getTMProxy().begin(3,0);
|
||||
//修改发票信息单据号
|
||||
String sscivmSql = "UPDATE sscivm_invoice set billno = '" + fphm +"' where pk_invoice = '"+ pk_invoice +"'";
|
||||
dao.executeUpdate(sscivmSql);
|
||||
Logger.error("---sscivmSqlExecute------"+sscivmSql);
|
||||
//修改发票关联关系单据编码
|
||||
String sirSql = "UPDATE sscivm_invoice_relation set billno = '" + fphm +"' where pk_invoice = '"+ pk_invoice +"' and billid = '"+ csaleinvoiceid +"'";
|
||||
dao.executeUpdate(sirSql);
|
||||
Logger.error("---sirSqlExecute------"+sirSql);
|
||||
//ERP销售发票回传,根据销售发票id,回写发票号和单据编号
|
||||
String sSaleSql = "UPDATE so_saleinvoice set vdef20 = 'Y' , vdef13 = '" + fphm + "', vbillcode = '" + fphm +"' where csaleinvoiceid = '" + csaleinvoiceid + "'";
|
||||
dao.executeUpdate(sSaleSql);
|
||||
Logger.error("---sSaleSqlExecute------"+sSaleSql);
|
||||
//根据销售发票id 回写下游应收单表头发票号
|
||||
String recBillSql = "MERGE INTO ar_recbill a USING (select DISTINCT pk_recbill,top_billid,top_billtype from ar_recitem) b ON ( a.pk_recbill = b.pk_recbill AND b.top_billid = '" + csaleinvoiceid + "' AND b.top_billtype = '32' ) \n" +
|
||||
"WHEN MATCHED THEN\n" +
|
||||
"UPDATE \n" +
|
||||
"SET a.invoiceno = '" + fphm + "'";
|
||||
dao.executeUpdate(recBillSql);
|
||||
Logger.error("---recBillSqlExecute------"+recBillSql);
|
||||
//根据销售发票id 回写下游应收单表体发票号
|
||||
String recItemSql = "UPDATE ar_recitem \n" +
|
||||
"SET invoiceno = '" + fphm + "' \n" +
|
||||
"WHERE\n" +
|
||||
"top_billid = '" + csaleinvoiceid + "' \n" +
|
||||
"AND top_billtype = '32'";
|
||||
dao.executeUpdate(recItemSql);
|
||||
Logger.error("---recItemSqlExecute------"+recItemSql);
|
||||
//查询销售发票下游单据,如果有将下游单据表体字段【来源单据号】更新成新的发票号
|
||||
String saleOutSql = "UPDATE ic_saleout_b \n" +
|
||||
"SET vsourcebillcode = '"+ fphm +"' \n" +
|
||||
"WHERE\n" +
|
||||
"csourcetype = '32' \n" +
|
||||
"AND csourcebillhid = '" + csaleinvoiceid +"'";
|
||||
dao.executeUpdate(saleOutSql);
|
||||
Logger.error("---saleOutSqlExecute------"+saleOutSql);
|
||||
//正常结束
|
||||
TransactionFactory.getTMProxy().end(null);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
//异常回滚
|
||||
TransactionFactory.getTMProxy().end(e);
|
||||
Logger.error("writeBack Error: ",e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue