Compare commits
6 Commits
0fafc2b8c4
...
f6270650fc
Author | SHA1 | Date |
---|---|---|
|
f6270650fc | |
|
669eb4618b | |
|
4b7ca00e4c | |
|
f76fc42505 | |
|
ad8c2fa6d6 | |
|
fed80fd269 |
|
@ -0,0 +1,223 @@
|
|||
/* */ package nc.bs.so.m30.maintain;
|
||||
/* */
|
||||
/* */ import nc.bs.scmpub.rule.CrossRuleValidateRule;
|
||||
import nc.bs.so.m30.maintain.rule.insert.JudgeMaterialPriceInsertRule;
|
||||
/* */ 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.FeatureSelectSaveRule;
|
||||
/* */ import nc.bs.so.m30.rule.m35.ArsubOffsetBeforeSaveRule;
|
||||
/* */ import nc.bs.so.m30.rule.m35.LrgCashMarCheckRule;
|
||||
/* */ import nc.bs.so.m30.rule.maintaincheck.CheckDateRule;
|
||||
/* */ import nc.bs.so.m30.rule.maintaincheck.CheckLrgTotalMoney;
|
||||
/* */ import nc.bs.so.m30.rule.maintaincheck.CheckNumPriceMnyRule;
|
||||
/* */ import nc.bs.so.m30.rule.maintaincheck.CheckSaveBillRule;
|
||||
/* */ import nc.bs.so.m30.rule.maintaincheck.CheckSettleOrgRepeat;
|
||||
/* */ import nc.bs.so.m30.rule.maintainprocess.FillupFretexchangeRule;
|
||||
/* */ import nc.bs.so.m30.rule.maintainprocess.FillupRedundanceDataRule;
|
||||
/* */ import nc.bs.so.m30.rule.maintainprocess.InsertSoBalanceWhenAddNewRule;
|
||||
/* */ import nc.bs.so.m30.rule.maintainprocess.SourceToSaleOrderMsgRule;
|
||||
/* */ import nc.bs.so.m30.rule.maintainprocess.ThisGatheringRule;
|
||||
/* */ 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.pubapp.pattern.log.TimeLog;
|
||||
/* */ import nc.vo.pubapp.util.SetAddAuditInfoRule;
|
||||
/* */ 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 SaleOrderVO[] insert(SaleOrderVO[] bills) {
|
||||
/* 56 */ AroundProcesser<SaleOrderVO> processer = new AroundProcesser(BP30PlugInPoint.InsertBP);
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 60 */ TimeLog.logStart();
|
||||
/* 61 */ this.addBeforeRule(processer);
|
||||
/* 62 */ processer.before(bills);
|
||||
/* 63 */ TimeLog.info("调用新增保存前BP插入点");
|
||||
/* */
|
||||
/* 65 */ TimeLog.logStart();
|
||||
/* 66 */ BillInsert<SaleOrderVO> bo = new BillInsert();
|
||||
/* 67 */ SaleOrderVO[] vos = (SaleOrderVO[])bo.insert(bills);
|
||||
/* 68 */ TimeLog.info("保存单据到数据库");
|
||||
/* */
|
||||
/* */
|
||||
/* 71 */ TimeLog.logStart();
|
||||
/* 72 */ this.addAfterRule(processer);
|
||||
/* 73 */ processer.after(vos);
|
||||
/* 74 */ TimeLog.info("调用新增保存后BP插入点");
|
||||
/* */
|
||||
/* 76 */ return vos;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ private void addAfterRule(AroundProcesser<SaleOrderVO> processer) {
|
||||
/* 80 */ IRule<SaleOrderVO> rule = null;
|
||||
/* */
|
||||
/* */
|
||||
/* 83 */ rule = new InsertSoBalanceWhenAddNewRule();
|
||||
/* 84 */ processer.addAfterRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 87 */ rule = new RenovateARByHidsEndRule(M30EngrossAction.M30Insert);
|
||||
/* 88 */ processer.addAfterRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 91 */ rule = new ThisGatheringRule();
|
||||
/* 92 */ processer.addAfterRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 95 */ rule = new CheckUniqueBillCodeRule();
|
||||
/* 96 */ processer.addAfterRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 102 */ rule = new RewriteBillInsertRule();
|
||||
/* 103 */ processer.addAfterRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 106 */ rule = new SaveTransferMsgRule();
|
||||
/* 107 */ processer.addAfterRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 110 */ rule = new RewritePriceFormRule();
|
||||
/* 111 */ processer.addAfterRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 114 */ rule = new SourceToSaleOrderMsgRule();
|
||||
/* 115 */ processer.addAfterRule(rule);
|
||||
|
||||
rule = new WritebackMaterialPriceRule();
|
||||
processer.addAfterRule(rule);
|
||||
/* */
|
||||
/* 117 */ boolean icEnable = SysInitGroupQuery.isICEnabled();
|
||||
/* 118 */ if (icEnable) {
|
||||
/* */
|
||||
/* 120 */ rule = new SaleOrderVOATPAfterRule();
|
||||
/* 121 */ processer.addAfterRule(rule);
|
||||
/* */
|
||||
/* 123 */ rule = new AutoReserveRule();
|
||||
/* 124 */ processer.addAfterRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* */ }
|
||||
/* */
|
||||
/* 129 */ if (SysInitGroupQuery.isPRICEEnabled()) {
|
||||
/* 130 */ rule = new RewritePromotePriceInsertRule();
|
||||
/* 131 */ processer.addAfterRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* */ }
|
||||
/* */
|
||||
/* 136 */ processer.addAfterRule(new MobAfterSaveMessageRule());
|
||||
/* 137 */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private void addBeforeRule(AroundProcesser<SaleOrderVO> processer) {
|
||||
/* 142 */ IRule<SaleOrderVO> rule = new SaleOrgEnableCheckRule();
|
||||
/* 143 */ processer.addBeforeRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 146 */ rule = new FillupRedundanceDataRule();
|
||||
/* 147 */ processer.addBeforeRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 150 */ rule = new FillupFretexchangeRule();
|
||||
/* 151 */ processer.addBeforeRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 154 */ rule = new AddNewBillCodeRule();
|
||||
/* 155 */ processer.addBeforeRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 158 */ rule = new CheckNumPriceMnyRule();
|
||||
/* 159 */ processer.addBeforeRule(rule);
|
||||
/* */
|
||||
/* 161 */ rule = new CheckSettleOrgRepeat();
|
||||
/* 162 */ processer.addBeforeRule(rule);
|
||||
/* */
|
||||
/* 164 */ rule = new CheckDateRule();
|
||||
/* 165 */ processer.addBeforeRule(rule);
|
||||
/* */
|
||||
/* 167 */ rule = new CheckSaveBillRule();
|
||||
/* 168 */ processer.addBeforeRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 171 */ rule = new FillBillTailInfoRuleForIns();
|
||||
/* 172 */ processer.addBeforeRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 175 */ rule = new SetAddAuditInfoRule();
|
||||
/* 176 */ processer.addBeforeRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 179 */ rule = new RenovateARByHidsBeginRule(M30EngrossAction.M30Insert);
|
||||
/* 180 */ processer.addBeforeRule(rule);
|
||||
/* */
|
||||
/* 182 */ boolean icEnable = SysInitGroupQuery.isICEnabled();
|
||||
/* 183 */ if (icEnable) {
|
||||
/* */
|
||||
/* 185 */ rule = new SaleOrderVOATPBeforeRule();
|
||||
/* 186 */ processer.addBeforeRule(rule);
|
||||
/* */
|
||||
/* */ }
|
||||
/* */
|
||||
/* 190 */ rule = new LrgCashMarCheckRule();
|
||||
/* 191 */ processer.addBeforeRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 194 */ rule = new ArsubOffsetBeforeSaveRule();
|
||||
/* 195 */ processer.addBeforeRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 198 */ rule = new CheckLrgTotalMoney();
|
||||
/* 199 */ processer.addBeforeRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 202 */ rule = new FeatureSelectSaveRule();
|
||||
/* 203 */ processer.addBeforeRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 206 */ rule = new UserDefSaveRule(new Class[]{SaleOrderHVO.class, SaleOrderBVO.class});
|
||||
/* */
|
||||
/* */
|
||||
/* 209 */ processer.addBeforeRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 212 */ rule = new CrossRuleValidateRule();
|
||||
/* 213 */ processer.addBeforeRule(rule);
|
||||
|
||||
rule = new JudgeMaterialPriceInsertRule();
|
||||
processer.addBeforeRule(rule);
|
||||
/* 214 */ }
|
||||
/* */ }
|
|
@ -0,0 +1,229 @@
|
|||
/* */ 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.JudgeMaterialPriceInsertRule;
|
||||
/* */ 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.ClearMffileSRCRule;
|
||||
/* */ import nc.bs.so.m30.rule.feature.FeatureSelectSaveRule;
|
||||
/* */ import nc.bs.so.m30.rule.feature.RestMffileSRCRule;
|
||||
/* */ import nc.bs.so.m30.rule.m35.ArsubOffsetBeforeSaveRule;
|
||||
/* */ import nc.bs.so.m30.rule.m35.LrgCashMarCheckRule;
|
||||
/* */ import nc.bs.so.m30.rule.maintaincheck.CheckCanUpdateWhenAuditing;
|
||||
/* */ import nc.bs.so.m30.rule.maintaincheck.CheckDateRule;
|
||||
/* */ import nc.bs.so.m30.rule.maintaincheck.CheckLrgTotalMoney;
|
||||
/* */ import nc.bs.so.m30.rule.maintaincheck.CheckNumPriceMnyRule;
|
||||
/* */ import nc.bs.so.m30.rule.maintaincheck.CheckSaveBillRule;
|
||||
/* */ import nc.bs.so.m30.rule.maintaincheck.CheckSettleOrgRepeat;
|
||||
/* */ import nc.bs.so.m30.rule.maintainprocess.FillupFretexchangeRule;
|
||||
/* */ import nc.bs.so.m30.rule.maintainprocess.FillupRedundanceDataRule;
|
||||
/* */ import nc.bs.so.m30.rule.maintainprocess.ThisGatheringRule;
|
||||
/* */ import nc.bs.so.m30.rule.maintainprocess.UpdateSoBalanceWhenUpdateM30HeadRule;
|
||||
/* */ import nc.bs.so.m30.rule.maintainprocess.UpdateSoBalanceWhenUpdateRule;
|
||||
/* */ 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.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.pubapp.pattern.log.TimeLog;
|
||||
/* */ import nc.vo.pubapp.util.SetUpdateAuditInfoRule;
|
||||
/* */ import nc.vo.so.m30.entity.SaleOrderVO;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class UpdateSaleOrderBP {
|
||||
/* */ public SaleOrderVO[] update(SaleOrderVO[] bills, SaleOrderVO[] originBills) {
|
||||
/* 53 */ CompareAroundProcesser<SaleOrderVO> processer = new CompareAroundProcesser(BP30PlugInPoint.UpdateBP);
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 57 */ TimeLog.logStart();
|
||||
/* 58 */ this.addBeforeRule(processer);
|
||||
/* 59 */ processer.before(bills, originBills);
|
||||
/* */
|
||||
/* 61 */ TimeLog.info("???????????BP?????");
|
||||
/* */
|
||||
/* 63 */ TimeLog.logStart();
|
||||
/* 64 */ BillUpdate<SaleOrderVO> bo = new BillUpdate();
|
||||
/* 65 */ SaleOrderVO[] vos = (SaleOrderVO[])bo.update(bills, originBills);
|
||||
/* */
|
||||
/* 67 */ TimeLog.info("????????????????");
|
||||
/* */
|
||||
/* */
|
||||
/* 70 */ TimeLog.logStart();
|
||||
/* 71 */ this.addAfterRule(processer);
|
||||
/* 72 */ processer.after(vos, originBills);
|
||||
/* */
|
||||
/* 74 */ TimeLog.info("???????????BP?????");
|
||||
/* */
|
||||
/* 76 */ return vos;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ private void addAfterRule(CompareAroundProcesser<SaleOrderVO> processer) {
|
||||
/* 80 */ IRule<SaleOrderVO> rule = null;
|
||||
/* */
|
||||
/* */
|
||||
/* 83 */ rule = new UpdateSoBalanceWhenUpdateRule();
|
||||
/* 84 */ processer.addAfterRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 87 */ rule = new RenovateARByHidsEndRule(M30EngrossAction.M30Edit);
|
||||
/* 88 */ processer.addAfterRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 91 */ rule = new ThisGatheringRule();
|
||||
/* 92 */ processer.addAfterRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 95 */ rule = new CheckUniqueBillCodeRule();
|
||||
/* 96 */ processer.addAfterRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 99 */ ICompareRule<SaleOrderVO> compareRule = new RewriteBillUpdateRule();
|
||||
/* 100 */ processer.addAfterRule(compareRule);
|
||||
/* */
|
||||
/* */
|
||||
/* 103 */ rule = new SaveTransferMsgRule();
|
||||
/* 104 */ processer.addAfterRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 107 */ rule = new RewritePriceFormRule();
|
||||
/* 108 */ processer.addAfterRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 111 */ rule = new UpdateSoBalanceWhenUpdateM30HeadRule();
|
||||
/* 112 */ processer.addAfterRule(rule);
|
||||
|
||||
rule = new WritebackMaterialPriceRule();
|
||||
processer.addAfterRule(rule);
|
||||
/* */
|
||||
/* 114 */ boolean icEnable = SysInitGroupQuery.isICEnabled();
|
||||
/* 115 */ if (icEnable) {
|
||||
/* */
|
||||
/* 117 */ rule = new SaleOrderVOATPAfterRule();
|
||||
/* 118 */ processer.addAfterRule(rule);
|
||||
/* */
|
||||
/* 120 */ rule = new ReserveUpdateRule();
|
||||
/* 121 */ processer.addAfterRule(rule);
|
||||
/* */
|
||||
/* 123 */ rule = new AutoReserveRule();
|
||||
/* 124 */ processer.addAfterRule(rule);
|
||||
/* */
|
||||
/* */ }
|
||||
/* */
|
||||
/* 128 */ if (SysInitGroupQuery.isPRICEEnabled()) {
|
||||
/* 129 */ compareRule = new RewritePromotePriceUpdateRule();
|
||||
/* 130 */ processer.addAfterRule(compareRule);
|
||||
/* */
|
||||
/* */ }
|
||||
/* */
|
||||
/* 134 */ compareRule = new RestMffileSRCRule();
|
||||
/* 135 */ processer.addAfterRule(compareRule);
|
||||
/* 136 */ }
|
||||
/* */
|
||||
/* */ private void addBeforeRule(CompareAroundProcesser<SaleOrderVO> processer) {
|
||||
/* 139 */ IRule<SaleOrderVO> rule = null;
|
||||
/* */
|
||||
/* */
|
||||
/* 142 */ rule = new VOSagaFrozenValidateRule();
|
||||
/* 143 */ processer.addBeforeRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 146 */ rule = new CheckCanUpdateWhenAuditing();
|
||||
/* 147 */ processer.addBeforeRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 151 */ rule = new CheckApproverRule();
|
||||
/* 152 */ processer.addBeforeRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 157 */ rule = new FillupRedundanceDataRule();
|
||||
/* 158 */ processer.addBeforeRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 161 */ rule = new FillupFretexchangeRule();
|
||||
/* 162 */ processer.addBeforeRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 165 */ rule = new SetUpdateAuditInfoRule();
|
||||
/* 166 */ processer.addBeforeRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 169 */ ICompareRule<SaleOrderVO> compareRule = new UpdateBillCodeRule();
|
||||
/* 170 */ processer.addBeforeRule(compareRule);
|
||||
/* */
|
||||
/* */
|
||||
/* 173 */ rule = new CheckNumPriceMnyRule();
|
||||
/* 174 */ processer.addBeforeRule(rule);
|
||||
/* */
|
||||
/* 176 */ rule = new CheckSettleOrgRepeat();
|
||||
/* 177 */ processer.addBeforeRule(rule);
|
||||
/* */
|
||||
/* 179 */ rule = new CheckDateRule();
|
||||
/* 180 */ processer.addBeforeRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 183 */ rule = new CheckSaveBillRule();
|
||||
/* 184 */ processer.addBeforeRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 187 */ rule = new RenovateARByHidsBeginRule(M30EngrossAction.M30Edit);
|
||||
/* 188 */ processer.addBeforeRule(rule);
|
||||
/* */
|
||||
/* 190 */ boolean icEnable = SysInitGroupQuery.isICEnabled();
|
||||
/* 191 */ if (icEnable) {
|
||||
/* */
|
||||
/* 193 */ rule = new SaleOrderVOATPBeforeRule();
|
||||
/* 194 */ processer.addBeforeRule(rule);
|
||||
/* */
|
||||
/* */ }
|
||||
/* */
|
||||
/* 198 */ rule = new LrgCashMarCheckRule();
|
||||
/* 199 */ processer.addBeforeRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 202 */ rule = new ArsubOffsetBeforeSaveRule();
|
||||
/* 203 */ processer.addBeforeRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 206 */ rule = new CheckLrgTotalMoney();
|
||||
/* 207 */ processer.addBeforeRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 210 */ rule = new FeatureSelectSaveRule();
|
||||
/* 211 */ processer.addBeforeRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 214 */ rule = new CrossRuleValidateRule();
|
||||
/* 215 */ processer.addBeforeRule(rule);
|
||||
/* */
|
||||
/* */
|
||||
/* 218 */ compareRule = new ClearMffileSRCRule();
|
||||
/* 219 */ processer.addBeforeRule(compareRule);
|
||||
/* */
|
||||
rule = new JudgeMaterialPriceInsertRule();
|
||||
processer.addBeforeRule(rule);
|
||||
/* 221 */ }
|
||||
/* */ }
|
|
@ -0,0 +1,59 @@
|
|||
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;
|
||||
import java.util.List;
|
||||
|
||||
public class WritebackMaterialPriceRule implements IRule<SaleOrderVO>{
|
||||
|
||||
|
||||
@Override
|
||||
public void process(SaleOrderVO[] vos) {
|
||||
// TODO Auto-generated method stub
|
||||
List<SaleOrderBVO> list = new ArrayList<SaleOrderBVO>();
|
||||
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(); //无税单价
|
||||
String whereSql = "nvl(bd_material.dr,0) = 0 and bd_material.code = '" + cmaterialvid + "' and bd_material.pk_org = '" + pk_org + "'";
|
||||
// IMDPersistenceQueryService aggvoQueryService = ServiceLocator.find(IMDPersistenceQueryService.class);
|
||||
IMDPersistenceQueryService aggvoQueryService = NCLocator.getInstance().lookup(IMDPersistenceQueryService.class);
|
||||
// 条件查询得到物料MaterialSaleVO
|
||||
try {
|
||||
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,796 @@
|
|||
package nccloud.itf.sscivm.ivsale.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
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.framework.core.service.TimeService;
|
||||
import nc.bs.logging.Logger;
|
||||
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.ivaconst.IVAWebConst;
|
||||
import nc.bs.sscivm.ivsale.util.ActionUtils;
|
||||
import nc.bs.sscivm.ivsale.util.IVApplicationBillDefValue;
|
||||
import nc.bs.sscivm.ivsale.util.IVApplicationEventType;
|
||||
import nc.bs.sscivm.ivsale.util.IVApplicationSlsmUtil;
|
||||
import nc.bs.sscivm.ivsale.util.IVSaleUtil;
|
||||
import nc.bs.sscivm.util.IVMSagaValidationUtils;
|
||||
import nc.impl.pubapp.pattern.data.bill.tool.BillTransferTool;
|
||||
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.jdbc.framework.processor.MapListProcessor;
|
||||
import nc.pubitf.bbd.CurrtypeQuery;
|
||||
import nc.pubitf.para.SysInitQuery;
|
||||
import nc.pubitf.uapbd.CurrencyRateUtilHelper;
|
||||
import nc.uap.pf.metadata.PfMetadataTools;
|
||||
import nc.vo.bd.currtype.CurrtypeVO;
|
||||
import nc.vo.ic.pub.util.StringUtil;
|
||||
import nc.vo.ml.NCLangRes4VoTransl;
|
||||
import nc.vo.pf.change.PfUtilBaseTools;
|
||||
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.VOStatus;
|
||||
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.pf.workflow.IPFActionName;
|
||||
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.trade.pub.IBillStatus;
|
||||
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;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.internal.LinkedTreeMap;
|
||||
|
||||
public class IVApplicationServiceImpl implements IVApplicationService {
|
||||
|
||||
@Override
|
||||
public IVApplicationAggVO save(IVApplicationAggVO ivApplicationVO) throws BusinessException {
|
||||
IVApplicationAggVO[] ivApplicationVOs = null;
|
||||
try {
|
||||
ivApplicationVOs = saveBatch(new IVApplicationAggVO[] { ivApplicationVO });
|
||||
} catch (Exception e) {
|
||||
ExceptionUtils.marsh(e);
|
||||
}
|
||||
return ivApplicationVOs == null || ivApplicationVOs.length == 0 ? null : ivApplicationVOs[0];
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVApplicationAggVO[] saveBatch(IVApplicationAggVO[] clientFullVOs) throws BusinessException {
|
||||
IVApplicationAggVO[] retvos = null;
|
||||
HashSet<IVApplicationAggVO> retVOLits = new HashSet<IVApplicationAggVO>();
|
||||
try {
|
||||
//BillTransferTool<IVApplicationAggVO> transferTool = new BillTransferTool<IVApplicationAggVO>(clientFullVOs);
|
||||
IVApplicationInsertBP action = new IVApplicationInsertBP();
|
||||
retvos = action.insert(clientFullVOs);
|
||||
//retvos = (IVApplicationAggVO[]) transferTool.getBillForToClient(retvos);
|
||||
//处理自动提交
|
||||
HashSet<String> tradetypeids = new HashSet<String>();
|
||||
for (IVApplicationAggVO applicationAggVO : retvos) {
|
||||
tradetypeids.add(applicationAggVO.getParentVO().getTranstypecode());
|
||||
}
|
||||
IVBilltypeVO[] billtypeVOS =
|
||||
NCLocator
|
||||
.getInstance()
|
||||
.lookup(IVABilltypeExtService.class)
|
||||
.getBilltypeVOsByWhere(
|
||||
" "
|
||||
+ IVBilltypeVO.PK_GROUP
|
||||
+ " ='"
|
||||
+ InvocationInfoProxy.getInstance().getGroupId()
|
||||
+ "' and "
|
||||
+ SQLUtil.buildSqlForIn(IVBilltypeVO.BILLTYPECODE,
|
||||
tradetypeids.toArray(new String[tradetypeids.size()])));
|
||||
//提交时处理自动审批功能
|
||||
if (billtypeVOS != null && billtypeVOS.length > 0) {
|
||||
// 3、自动提交勾选时
|
||||
HashSet<IVApplicationAggVO> atuoVOs = new HashSet<IVApplicationAggVO>();
|
||||
HashSet<IVApplicationAggVO> noatuoVOs = new HashSet<IVApplicationAggVO>();
|
||||
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())) {
|
||||
if (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(atuoVOs.toArray(new IVApplicationAggVO[atuoVOs.size()]), null, null);
|
||||
if (submitObj instanceof Map) {
|
||||
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0","01058sal-0053")/*@res "开票申请单保存提交失败,下游环节含有指派信息"*/);
|
||||
}
|
||||
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 = retVOLits.toArray(new IVApplicationAggVO[retVOLits
|
||||
.size()]);
|
||||
} else {
|
||||
if (noatuoVOs != null && noatuoVOs.size() > 0) {
|
||||
retVOLits.addAll(noatuoVOs);
|
||||
retvos = retVOLits
|
||||
.toArray(new IVApplicationAggVO[retVOLits
|
||||
.size()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
ExceptionUtils.marsh(e);
|
||||
}
|
||||
return retvos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteById(String pk) throws BusinessException {
|
||||
deleteByIds(new String[] { pk });
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByIds(String[] pks) throws BusinessException {
|
||||
IVApplicationAggVO[] retvos = new IVApplicationQueryBP().queryAggIVApplicationVOByCondition(SQLUtil.buildSqlForIn(
|
||||
IVApplicationHeadVO.PK_IVAPPLICATION, pks));
|
||||
new IVApplicationDeleteBP().delete(retvos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(IVApplicationAggVO vo) throws BusinessException {
|
||||
try {
|
||||
new IVApplicationDeleteBP().delete(new IVApplicationAggVO[] { vo });
|
||||
} catch (Exception e) {
|
||||
ExceptionUtils.marsh(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteBatch(IVApplicationAggVO[] vos) throws BusinessException {
|
||||
try {
|
||||
new IVApplicationDeleteBP().delete(vos);
|
||||
} catch (Exception e) {
|
||||
ExceptionUtils.marsh(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
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.intValue() == IBillStatus.CHECKPASS) {
|
||||
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl
|
||||
.getNCLangRes()
|
||||
.getStrByID("1058sal_0", "01058sal-0024")/*
|
||||
* @res
|
||||
* "审批通过的单据不允许修改"
|
||||
*/);
|
||||
}
|
||||
// 审批进行中的单据只允许当前审批人修改
|
||||
if (approveStatus.intValue() == IBillStatus.COMMIT
|
||||
|| approveStatus.intValue() == IBillStatus.CHECKGOING) {
|
||||
String billId = ivApplicationVO.getParentVO()
|
||||
.getPk_ivapplication();
|
||||
String billType = ivApplicationVO.getParentVO()
|
||||
.getTranstypecode();
|
||||
String userId = InvocationInfoProxy.getInstance().getUserId();
|
||||
if (!isFlowCheckman(billId, billType, userId)) {
|
||||
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl
|
||||
.getNCLangRes().getStrByID("1058sal_0",
|
||||
"01058sal-0050")/*
|
||||
* @res
|
||||
* "审批流程中的单据,只有当前审批人可以修改!"
|
||||
*/);
|
||||
}
|
||||
}
|
||||
|
||||
//如果来源单据为销售发票,根据来源单据编号src_billno和来源单据类型(billtype = 32)查询销售发票价税合计(ntotalorigmny)与开票申请中价税合计(jshj)比较,须满足 jshj<ntotalorigmny
|
||||
String src_billtype = ivApplicationVO.getParentVO().getSrc_billtype(); //来源单据类型
|
||||
String src_billno = ivApplicationVO.getParentVO().getSrc_billno(); //来源单据号
|
||||
if("32".equals(src_billtype) && !StringUtil.isNullStringOrNull(src_billno)){
|
||||
BaseDAO dao = new BaseDAO();
|
||||
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 = updateBatch(new IVApplicationAggVO[] { ivApplicationVO }, 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) {
|
||||
ExceptionUtils.marsh(e);
|
||||
}
|
||||
return retvos == null || retvos.length == 0 ? null : retvos[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVApplicationAggVO[] updateBatch(IVApplicationAggVO[] clientFullVOs, IVApplicationAggVO[] originBills) throws BusinessException {
|
||||
IVApplicationAggVO[] retvos = null;
|
||||
try {
|
||||
BillTransferTool<IVApplicationAggVO> transferTool = new BillTransferTool<IVApplicationAggVO>(clientFullVOs);
|
||||
IVApplicationUpdateBP action = new IVApplicationUpdateBP();
|
||||
originBills = transferTool.getOriginBills();
|
||||
retvos = action.update(clientFullVOs, originBills);
|
||||
//retvos = (IVApplicationAggVO[]) transferTool.getBillForToClient(retvos);
|
||||
} catch (Exception e) {
|
||||
ExceptionUtils.marsh(e);
|
||||
}
|
||||
return retvos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object submit(IVApplicationAggVO[] clientBills, IVApplicationAggVO[] originBills, Object assingUsers) throws BusinessException {
|
||||
//判断saga状态
|
||||
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(), IVApplicationHeadVO.PK_IVAPPLICATION);
|
||||
}
|
||||
List<IVApplicationAggVO> retvos = new ArrayList<IVApplicationAggVO>();
|
||||
try {
|
||||
|
||||
for (int i = 0; i < clientBills.length; i++) {
|
||||
AggregatedValueObject billVO = clientBills[i];
|
||||
if (clientBills[i].getParentVO().getBillstatus() != IBillStatus.FREE) {
|
||||
// 存在非自由态的单据
|
||||
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0","01058sal-0025")/*@res "第:"*/ + (i + 1) + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0","01058sal-0026")/*@res "行,非自由态的单据不允许提交!"*/);
|
||||
}
|
||||
Object retObj = doNccCommit(billVO, assingUsers);
|
||||
if(retObj instanceof Map){
|
||||
return retObj;
|
||||
}
|
||||
if (retObj != null) {
|
||||
retvos.add((IVApplicationAggVO)((MessageVO)retObj).getSuccessVO());
|
||||
}
|
||||
}
|
||||
} catch (Exception 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 =
|
||||
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) {
|
||||
if (null == ((IVApplicationHeadVO)billVO.getParentVO()).getTs()
|
||||
|| ((IVApplicationHeadVO)billVO.getParentVO()).getTs().compareTo(
|
||||
submitVos[0].getParentVO().getTs()) != 0) {
|
||||
throw new Exception(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0", "01058sal-0057")/*@res "单据已经被他人修改,请刷新页面!"*/);
|
||||
}
|
||||
}
|
||||
|
||||
String tradetypePk = ((IVApplicationHeadVO)billVO.getParentVO()).getPk_tradetype();
|
||||
djlxbm = NCLocator.getInstance().lookup(IBilltypeService.class).getBilltypeCode(tradetypePk);
|
||||
}
|
||||
Object retObj = null;
|
||||
HashMap<String, String> paramMap = new HashMap<String, String>();
|
||||
paramMap.put(PfUtilBaseTools.PARAM_SILENTLY, PfUtilBaseTools.PARAM_SILENTLY);
|
||||
// String actionCode = IVSaleUtil.getActionCode((String)
|
||||
// billVO.getParentVO().getAttributeValue(IVApplicationHeadVO.PK_ORG));
|
||||
String cuserid = InvocationInfoProxy.getInstance().getUserId();
|
||||
UFDateTime currTime = TimeService.getInstance().getUFDateTime();
|
||||
WorkflownoteVO noteVO = null;
|
||||
try {
|
||||
noteVO =
|
||||
((IWorkflowMachine)NCLocator.getInstance().lookup(IWorkflowMachine.class)).checkWorkFlow(
|
||||
IPFActionName.SAVE, djlxbm, billVO, null);
|
||||
} catch (BusinessException e) {
|
||||
}
|
||||
boolean hasWorkfFlow = false;
|
||||
if (noteVO == null) {
|
||||
try{
|
||||
IFlowBizItf fbi = PfMetadataTools.getBizItfImpl(billVO, IFlowBizItf.class);
|
||||
|
||||
IWorkflowDefine wfDefine = 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 e){
|
||||
String err = NCLangRes4VoTransl.getNCLangRes().getStrByID("pfworkflow", "UPPpfworkflow-000058");/** 找不到工作流定义 无法启动工作流*/
|
||||
if (e.getMessage()!=null && e.getMessage().contains(err)) {
|
||||
//throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0","01058sal-0027")/*@res "找不到流程定义,无法启动流程!"*/);
|
||||
}else{
|
||||
throw new PFBusinessException(e);
|
||||
}
|
||||
}
|
||||
if (!hasWorkfFlow) {
|
||||
((IVApplicationHeadVO)billVO.getParentVO()).setApprover(cuserid);
|
||||
((IVApplicationHeadVO)billVO.getParentVO()).setApprovedate(currTime);
|
||||
((IVApplicationHeadVO)billVO.getParentVO()).setBillstatus(IBillStatus.CHECKPASS);
|
||||
// ((IVApplicationHeadVO)billVO.getParentVO()).setStatus(VOStatus.UPDATED);
|
||||
// retObj = this.updateBatch(new IVApplicationAggVO[] { (IVApplicationAggVO) billVO }, null)[0];
|
||||
retObj = approveVOs(new IVApplicationAggVO[] { (IVApplicationAggVO) billVO });
|
||||
|
||||
} else {
|
||||
retObj = commitScriptPFlow(IPFActionName.START, djlxbm, billVO, assingUsers);
|
||||
}
|
||||
} else {
|
||||
// 有审批流走审批流
|
||||
retObj = commitScriptPFlow(IPFActionName.SAVE, djlxbm, billVO, assingUsers);
|
||||
}
|
||||
|
||||
if (retObj == null) {
|
||||
result = new MessageVO(billVO, ActionUtils.COMMIT);
|
||||
result.setSuccess(false);
|
||||
result
|
||||
.setErrorMessage(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("2011", "UPP2011-000339")/*
|
||||
* @
|
||||
* res
|
||||
* "用户取消操作"*/);
|
||||
} else {
|
||||
if(retObj instanceof Map){
|
||||
return retObj;
|
||||
}
|
||||
if (retObj instanceof AggregatedValueObject) {// 仅提交
|
||||
result = new MessageVO((AggregatedValueObject)retObj, ActionUtils.COMMIT);
|
||||
} 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(null, ActionUtils.COMMIT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
ExceptionUtils.marsh(e);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private Object commitScriptPFlow(String actionName, String djlxbm, AggregatedValueObject aggVo, Object assingUsers) throws BusinessException {
|
||||
JSONObject assignContent = new JSONObject();
|
||||
HashMap<Object, Object> eParam = new HashMap<Object, Object>();
|
||||
if ((assingUsers instanceof LinkedTreeMap)) {
|
||||
assignContent = JSON.parseObject(new Gson().toJson(assingUsers));
|
||||
eParam.put("content", assignContent);
|
||||
}
|
||||
// 调用平台接口
|
||||
eParam.put(PfUtilBaseTools.PARAM_SILENTLY, PfUtilBaseTools.PARAM_SILENTLY);
|
||||
// eParam.put("isSkipAssign", true);
|
||||
CloudPFlowContext context = new CloudPFlowContext();
|
||||
context.setActionName(actionName);
|
||||
context.setBillType(djlxbm);
|
||||
context.setBillVos(new AggregatedValueObject[] { aggVo });
|
||||
context.seteParam(eParam);
|
||||
|
||||
Object[] ss = null;
|
||||
if(IPFActionName.START.equals(actionName)){
|
||||
WorkflowTypeEnum flowtype = nc.bs.pub.pf.PfUtilTools.runningFlowStatus(nccloud.commons.lang.StringUtils.isNotEmpty(context.getTrantype()) ? context.getTrantype() : context.getBillType(), aggVo.getParentVO().getPrimaryKey());
|
||||
if(flowtype==null){
|
||||
ss =NCLocator.getInstance().lookup(ICloudScriptPFlowService.class).exeScriptPFlow_CommitNoFlowBatch(context);
|
||||
}
|
||||
}
|
||||
if(ss==null){
|
||||
ss =NCLocator.getInstance().lookup(ICloudScriptPFlowService.class).exeScriptPFlow(context);
|
||||
}
|
||||
|
||||
Object obj = ss[0];
|
||||
if (((obj instanceof Map))
|
||||
&& (((Map<?, ?>)obj).get("workflow") != null)
|
||||
&& (("approveflow".equals(String.valueOf(((Map<?, ?>)obj).get("workflow")))) || ("workflow".equals(String
|
||||
.valueOf(((Map<?, ?>)obj).get("workflow")))))) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Object> map = (Map<String, Object>)obj;
|
||||
if (map.get("workflow") != null) {
|
||||
return map;
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVApplicationAggVO[] recall(IVApplicationAggVO[] clientBills, IVApplicationAggVO[] originBills) throws BusinessException {
|
||||
//判断saga状态
|
||||
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(), IVApplicationHeadVO.PK_IVAPPLICATION);
|
||||
}
|
||||
List<IVApplicationAggVO> retvos = new ArrayList<IVApplicationAggVO>();
|
||||
try {
|
||||
for (int i = 0; i < clientBills.length; i++) {
|
||||
AggregatedValueObject billVO = clientBills[i];
|
||||
if(clientBills[i].getParentVO().getBillstatus()!=IBillStatus.COMMIT && clientBills[i].getParentVO().getBillstatus()!=IBillStatus.CHECKPASS){
|
||||
//存在非自由态的单据
|
||||
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0","01058sal-0025")/*@res "第:"*/+(i+1)+nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0","01058sal-0028")/*@res "行,非提交态的单据不允许收回!"*/);
|
||||
}
|
||||
List<IVApplogVO> applogVOList =
|
||||
NCLocator.getInstance().lookup(ApplicationLogService.class)
|
||||
.queryApplicationLogByLyid(new String[] {clientBills[i].getParentVO().getPk_ivapplication()});
|
||||
|
||||
if(applogVOList != null && applogVOList.size() > 0){
|
||||
throw new nc.vo.pub.BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0","01058sal-0029")/*@res "单据"*/ + clientBills[i].getParentVO().getBillno()
|
||||
+ nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0","01058sal-0030")/*@res "已经开票,不允许取消审批!"*/);
|
||||
}
|
||||
Object retObj = doNccRecall(billVO);
|
||||
|
||||
retvos.add( (IVApplicationAggVO) ((MessageVO) retObj).getSuccessVO());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionUtils.marsh(e);
|
||||
}
|
||||
return retvos.toArray(new IVApplicationAggVO[retvos.size()]);
|
||||
}
|
||||
|
||||
private Object doNccRecall(AggregatedValueObject billVO) throws Exception {
|
||||
MessageVO result = null;
|
||||
|
||||
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) {
|
||||
if (null == ((IVApplicationHeadVO) billVO.getParentVO()).getTs()
|
||||
|| ((IVApplicationHeadVO) billVO.getParentVO()).getTs().compareTo(submitVos[0].getParentVO().getTs()) != 0) {
|
||||
throw new Exception(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0", "01058sal-0057")/*@res "单据已经被他人修改,请刷新页面!"*/);
|
||||
}
|
||||
}
|
||||
|
||||
String tradetypePk = ((IVApplicationHeadVO) billVO.getParentVO()).getPk_tradetype();
|
||||
djlxbm = NCLocator.getInstance().lookup(IBilltypeService.class).getBilltypeCode(tradetypePk);
|
||||
}
|
||||
|
||||
String actionName = IPFActionName.RECALL;
|
||||
|
||||
boolean isApproveflowFlag = IVSaleUtil.isApproveFlowStartup(billVO.getParentVO().getPrimaryKey(), djlxbm);
|
||||
if (isApproveflowFlag) {
|
||||
actionName = IPFActionName.UNSAVE;
|
||||
}
|
||||
|
||||
// 收回流程信息
|
||||
Object[] exeScriptPFlow = null;
|
||||
CloudPFlowContext context = new CloudPFlowContext();
|
||||
context.setActionName(actionName);
|
||||
context.setBillType(djlxbm);// 开票申请单
|
||||
context.setBillVos(new AggregatedValueObject[] { billVO });
|
||||
context.seteParam(new HashMap<Object, Object>());
|
||||
|
||||
WorkflowTypeEnum flowtype = nc.bs.pub.pf.PfUtilTools.runningFlowStatus(nccloud.commons.lang.StringUtils.isNotEmpty(context.getTrantype()) ? context.getTrantype() : context.getBillType(), billVO.getParentVO().getPrimaryKey());
|
||||
|
||||
ICloudScriptPFlowService service = 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], ActionUtils.RECALL);
|
||||
} else {
|
||||
result = new MessageVO(null, ActionUtils.RECALL);
|
||||
}
|
||||
} else if (exeScriptPFlow[0] instanceof AggregatedValueObject) {
|
||||
result = new MessageVO((AggregatedValueObject) (exeScriptPFlow[0]), ActionUtils.RECALL);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.error(e.getMessage(), e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 开票申请-初始化默认数据
|
||||
* @param ivapplicationaggvo
|
||||
* @return
|
||||
* @throws BusinessException
|
||||
*/
|
||||
public IVApplicationAggVO dealDefValue(String uistate, String pk_group, String pk_user, String pk_tradetype) throws Exception {
|
||||
IVApplicationAggVO retvos = new IVApplicationAggVO();
|
||||
IVApplicationBillDefValue billDefValue = new IVApplicationBillDefValue();
|
||||
// 自定义默认值
|
||||
if (IVAWebConst.INIT_LOADDEF.equals(uistate) || IVAWebConst.UISTATUS_ADD.equals(uistate)) {
|
||||
retvos = billDefValue.getNewVO(pk_group, pk_user, pk_tradetype);
|
||||
} else if (IVAWebConst.CHANGE_LOADDEF.equals(uistate) || IVAWebConst.UISTATUS_EDIT.equals(uistate)) {
|
||||
//retvos = billDefValue.getDefaultVO(pk_org);
|
||||
}
|
||||
return retvos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 开票申请-查询组织本币对应币种
|
||||
* @param String
|
||||
* @return
|
||||
* @throws BusinessException
|
||||
*/
|
||||
public String getOrgLocalCurrPK(String pk_org) throws BusinessException {
|
||||
String orgLocalCurrPK = CurrencyRateUtilHelper.getInstance().getLocalCurrtypeByOrgID(pk_org);
|
||||
return orgLocalCurrPK;
|
||||
}
|
||||
|
||||
/**
|
||||
* 开票申请-币种对应精度
|
||||
* @param String
|
||||
* @return
|
||||
* @throws BusinessException
|
||||
*/
|
||||
public Integer getCurrDigit(String pk_currtype) throws BusinessException {
|
||||
if (StringUtils.isEmpty(pk_currtype)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
CurrtypeVO currtypeVO = null;
|
||||
if (RuntimeEnv.getInstance().isRunningInServer()) {
|
||||
currtypeVO = CurrtypeQuery.getInstance().getCurrtypeVO(pk_currtype);
|
||||
}
|
||||
return currtypeVO == null ? 0 : currtypeVO.getCurrdigit();
|
||||
}
|
||||
|
||||
/**
|
||||
* 开票申请-获取组织对应版本
|
||||
* @param String
|
||||
* @return
|
||||
* @throws BusinessException
|
||||
*/
|
||||
public String getOrgVersion(String voclassname, String name, String pk_org) throws Exception {
|
||||
String className = new IVApplicationBillDefValue().getClassname(voclassname);
|
||||
String pk_org_v = (String) new IVApplicationBillDefValue().getRelationItemValue(className, name, "pk_org", pk_org);
|
||||
return pk_org_v;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageVO[] approveVOs(IVApplicationAggVO[] applicationAggVOs) throws Exception {
|
||||
if (applicationAggVOs == null || applicationAggVOs.length == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 1、更新单据
|
||||
for (int i = 0; i < applicationAggVOs.length; i++) {
|
||||
applicationAggVOs[i].getParentVO().setStatus(VOStatus.UPDATED);
|
||||
}
|
||||
IVApplicationAggVO[] aggVOs = updateBatch(applicationAggVOs, null);
|
||||
|
||||
MessageVO[] msgs = new MessageVO[aggVOs.length];
|
||||
for (int i = 0; i < aggVOs.length; i++) {
|
||||
msgs[i] = new MessageVO(aggVOs[i], ActionUtils.AUDIT);
|
||||
}
|
||||
|
||||
// 2、审批通过时自动开票
|
||||
IVApplicationInvoiceService applicationInvoiceService = NCLocator.getInstance().lookup(IVApplicationInvoiceService.class);
|
||||
for (int i = 0; i < aggVOs.length; i++) {
|
||||
String billTypePk = aggVOs[i].getParentVO().getPk_tradetype();
|
||||
String billtypeCode = NCLocator.getInstance().lookup(IBilltypeService.class).getBilltypeCode(billTypePk);
|
||||
IVBilltypeVO billtypeVO = NCLocator.getInstance().lookup(IVABilltypeExtService.class).getBilltypeVOByCode(billtypeCode,
|
||||
InvocationInfoProxy.getInstance().getGroupId());
|
||||
if(null != billtypeVO){
|
||||
if(billtypeVO.getIsatuo_invoice() == UFBoolean.TRUE && IVApplicationSlsmUtil.slsmCheck(aggVOs[i])){//@全电发票@@特殊票种电子凭证@
|
||||
JSONObject jsonObj = new JSONObject();
|
||||
IVApplicationAggVO[] voAfterMakeInvoice = applicationInvoiceService.makeInvoice(new IVApplicationAggVO[] {aggVOs[i]}, jsonObj, null, false);
|
||||
msgs[i] = new MessageVO(voAfterMakeInvoice[0], ActionUtils.AUDIT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return msgs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object unApproveVOs(IVApplicationAggVO[] applicationAggVOs) throws BusinessException {
|
||||
if (applicationAggVOs == null || applicationAggVOs.length == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 1、判断开票申请单是否已经开票,如果已经开票,则不允许取消审批
|
||||
for (int i = 0; i < applicationAggVOs.length; i++) {
|
||||
List<IVApplogVO> applogVOList =
|
||||
NCLocator.getInstance().lookup(ApplicationLogService.class)
|
||||
.queryApplicationLogByLyid(new String[] {applicationAggVOs[i].getParentVO().getPk_ivapplication()});
|
||||
|
||||
if(applogVOList != null && applogVOList.size() > 0){
|
||||
throw new nc.vo.pub.BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0","01058sal-0029")/*@res "单据"*/ + applicationAggVOs[i].getParentVO().getBillno()
|
||||
+ nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0","01058sal-0030")/*@res "已经开票,不允许取消审批!"*/);
|
||||
}
|
||||
applicationAggVOs[i].getParentVO().setStatus(VOStatus.UPDATED);
|
||||
}
|
||||
|
||||
// 2、更新单据状态
|
||||
IVApplicationAggVO[] aggVOs = updateBatch(applicationAggVOs, null);
|
||||
|
||||
MessageVO[] msgs = new MessageVO[aggVOs.length];
|
||||
for (int i = 0; i < aggVOs.length; i++) {
|
||||
msgs[i] = new MessageVO(aggVOs[i], ActionUtils.UNAUDIT);
|
||||
}
|
||||
|
||||
return msgs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVApplicationAggVO copyApplication(String pk) throws Exception {
|
||||
// 1、校验单据是否存在
|
||||
IVApplicationAggVO aggVO = NCLocator.getInstance().lookup(IVApplicationQueryService.class).queryByPK(pk);
|
||||
if (aggVO == null) {
|
||||
throw new nc.vo.pub.BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0", "01058sal-0057")/*@res "单据已经被他人修改,请刷新页面!"*/);
|
||||
}
|
||||
if(aggVO.getParentVO().getHzfp() == UFBoolean.TRUE || aggVO.getParentVO().getZffp() == UFBoolean.TRUE){
|
||||
throw new nc.vo.pub.BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0","01058sal-0031")/*@res "单据关联的发票是红字发票或作废发票,不允许复制单据!"*/);
|
||||
}
|
||||
if(aggVO.getParentVO().getSrc_pkbusibill() != null){
|
||||
throw new nc.vo.pub.BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0","01058sal-0032")/*@res "单据已关联上游单据,不允许复制单据!"*/);
|
||||
}
|
||||
|
||||
// 2、复制单据
|
||||
IVApplicationAggVO copyVo = aggVO.clone();
|
||||
IVApplicationHeadVO headvo = copyVo.getParentVO();
|
||||
|
||||
// 3、清除表头不该复制的字段
|
||||
//清除saga相关的三个字段,否则复制时出现主键被加锁的情况
|
||||
String[] headFieldNotCopy =
|
||||
{IVApplicationHeadVO.PK_IVAPPLICATION, IVApplicationHeadVO.APPROVEDATE, IVApplicationHeadVO.APPROVER,
|
||||
IVApplicationHeadVO.BILLNO, IVApplicationHeadVO.BILLSTATUS, IVApplicationHeadVO.CREATIONTIME,
|
||||
IVApplicationHeadVO.CREATOR, IVApplicationHeadVO.KPR, IVApplicationHeadVO.KPZT,
|
||||
IVApplicationHeadVO.LYID, IVApplicationHeadVO.MODIFIEDTIME, IVApplicationHeadVO.MODIFIER,
|
||||
IVApplicationHeadVO.PREPAREDATE, IVApplicationHeadVO.SRC_BILLNO, IVApplicationHeadVO.SRC_BILLTYPE,
|
||||
IVApplicationHeadVO.SRC_PKBUSIBILL, IVApplicationHeadVO.SRC_TRADETYPE,IVApplicationHeadVO.SAGA_FROZEN,
|
||||
IVApplicationHeadVO.SAGA_GTXID,IVApplicationHeadVO.SAGA_BTXID,IVApplicationHeadVO.SAGA_STATUS};
|
||||
|
||||
for (int i = 0; i < headFieldNotCopy.length; i++) {
|
||||
headvo.setAttributeValue(headFieldNotCopy[i], null);
|
||||
}
|
||||
|
||||
// 4、清除表体字段
|
||||
for (int i = 0; i < copyVo.getChildrenVO().length; i++) {
|
||||
IVApplicationBodyVO bodyVO = (IVApplicationBodyVO) copyVo.getChildrenVO()[i];
|
||||
bodyVO.setPk_ivappdetail(null);
|
||||
bodyVO.setPk_ivapplication(null);
|
||||
}
|
||||
|
||||
//@特殊票种电子凭证@begin
|
||||
// 5、清除特殊票种相关字段
|
||||
if (copyVo.getIvTspzsBodyVO() != null) {
|
||||
for (int i = 0; i < copyVo.getIvTspzsBodyVO().length; i++) {
|
||||
IVTspzsBodyVO ivTspzsBodyVO = copyVo.getIvTspzsBodyVO()[i];
|
||||
ivTspzsBodyVO.setPk_ivtspzsdetail(null);
|
||||
ivTspzsBodyVO.setPk_ivapplication(null);
|
||||
ivTspzsBodyVO.setPk_ivappdetail(null);
|
||||
}
|
||||
}
|
||||
//@特殊票种电子凭证@end
|
||||
|
||||
// 5、重新制单人、修改人、时间等信息
|
||||
String cuserid = InvocationInfoProxy.getInstance().getUserId();
|
||||
UFDateTime currTime = TimeService.getInstance().getUFDateTime();
|
||||
UFDate currDate = currTime.getDate();
|
||||
|
||||
headvo.setBillstatus(IBillStatus.FREE);
|
||||
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("");
|
||||
//表头设置开票方式默认值,默认为1 直联开票
|
||||
Integer paramValue = SysInitQuery.getParaInt(headvo.getPk_org(), IVAWebConst.IVA_KP_SSCIVA01);
|
||||
headvo.setKpfs(paramValue == null ? IVAplocationKPFS.ZLKP.toIntValue() : paramValue);
|
||||
|
||||
for (int i = 0; i < copyVo.getChildrenVO().length; i++) {
|
||||
IVApplicationBodyVO bodyvo = (IVApplicationBodyVO) copyVo.getChildrenVO()[i];
|
||||
bodyvo.setStatus(VOStatus.NEW);
|
||||
}
|
||||
|
||||
return copyVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFlowCheckman(String billId, String billType, String userId)
|
||||
throws BusinessException {
|
||||
return IVSaleUtil.isCheckman(billId, billType, userId);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,255 @@
|
|||
package nc.bs.uapbd.task;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.TrustManager;
|
||||
|
||||
import org.apache.http.client.config.CookieSpecs;
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.Gson;
|
||||
import com.yonyou.cloud.utils.StringUtils;
|
||||
|
||||
import nc.bs.dao.BaseDAO;
|
||||
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.bs.uapbd.util.IgnoreSslUtil;
|
||||
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.iweb.log.Logger;
|
||||
import uap.mw.trans.TransactionFactory;
|
||||
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
|
||||
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 sirSql = "UPDATE sscivm_invoice_relation set billno = '" + billno +"' 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 = '" + billno +"' 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 = '"+ billno +"' \n" +
|
||||
"WHERE\n" +
|
||||
"csourcetype = '32' \n" +
|
||||
"AND csourcebillhid = '" + csaleinvoiceid +"'";
|
||||
dao.executeUpdate(saleOutSql);
|
||||
Logger.error("---saleOutSqlExecute------"+saleOutSql);
|
||||
//正常结束
|
||||
TransactionFactory.getTMProxy().end(null);
|
||||
// String updateRecbillAndItemSql = "BEGIN\n" +
|
||||
// "UPDATE sscivm_invoice_relation set billno = '" + billno +"' where pk_invoice = '"+ pk_invoice +"' and billid = '"+ csaleinvoiceid +"';\n" +
|
||||
// "UPDATE so_saleinvoice set vdef20 = 'Y' , vdef13 = '" + fphm + "', vbillcode = '" + billno +"' where csaleinvoiceid = '" + csaleinvoiceid + "';\n" +
|
||||
// "MERGE INTO ar_recbill a USING 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 + "';\n" +
|
||||
// "UPDATE ar_recitem \n" +
|
||||
// "SET invoiceno = '" + fphm + "' \n" +
|
||||
// "WHERE\n" +
|
||||
// "top_billid = '" + csaleinvoiceid + "' \n" +
|
||||
// "AND top_billtype = '32';\n" +
|
||||
// "UPDATE ic_saleout_b \n" +
|
||||
// "SET vsourcebillcode = '"+ billno +"' \n" +
|
||||
// "WHERE\n" +
|
||||
// "csourcetype = '32' \n" +
|
||||
// "AND csourcebillhid = '" + csaleinvoiceid +"';\n" +
|
||||
// "COMMIT;\n" +
|
||||
// "EXCEPTION \n" +
|
||||
// "WHEN OTHERS THEN\n" +
|
||||
// "ROLLBACK;\n" +
|
||||
// "RAISE;\n" +
|
||||
// "END;";
|
||||
// dao.executeUpdate(updateRecbillAndItemSql);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
//异常回滚
|
||||
TransactionFactory.getTMProxy().end(e);
|
||||
Logger.error("writeBack Error: ",e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private String doPost(String requestUrl, JSONObject json) throws IOException {
|
||||
URL u = new URL(requestUrl);
|
||||
try {
|
||||
if("https".equalsIgnoreCase(u.getProtocol())){//判定网址是否信任,不信任则调用忽略信任工具类SslUtil
|
||||
IgnoreSslUtil.ignoreSsl();
|
||||
}
|
||||
HttpsURLConnection connection = (HttpsURLConnection)u.openConnection();
|
||||
// 设置请求方法
|
||||
connection.setRequestMethod("POST");
|
||||
// 设置请求属性
|
||||
connection.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
|
||||
// 发送POST请求必须设置如下两行
|
||||
connection.setDoOutput(true);
|
||||
connection.setDoInput(true);
|
||||
byte[] outputInBytes = json.toJSONString().getBytes(StandardCharsets.UTF_8);
|
||||
// 写入数据到请求体
|
||||
OutputStream os = connection.getOutputStream();
|
||||
os.write(outputInBytes);
|
||||
// 获取响应码
|
||||
int responseCode = connection.getResponseCode();
|
||||
System.out.println("Response Code: " + responseCode);
|
||||
// 读取响应
|
||||
try(BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream()))) {
|
||||
String response = br.readLine();
|
||||
System.out.println("Response: " + response);
|
||||
}
|
||||
// 关闭连接
|
||||
connection.disconnect();
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private String doGet(String requestUrl, Map<String, String> paramMap) throws IOException {
|
||||
|
||||
StringBuilder param = new StringBuilder("?");
|
||||
if (paramMap != null) {
|
||||
for (Map.Entry<String, String> entry : paramMap.entrySet()) {
|
||||
param.append(entry.getKey());
|
||||
param.append("=");
|
||||
param.append(entry.getValue());
|
||||
param.append("&");
|
||||
}
|
||||
param.deleteCharAt(param.length() - 1);
|
||||
}
|
||||
String url = requestUrl + param;
|
||||
URL u = new URL(url);
|
||||
try {
|
||||
if("https".equalsIgnoreCase(u.getProtocol())){//判定网址是否信任,不信任则调用忽略信任工具类SslUtil
|
||||
IgnoreSslUtil.ignoreSsl();
|
||||
}
|
||||
HttpsURLConnection connection = (HttpsURLConnection)u.openConnection();
|
||||
connection.setRequestMethod("GET");
|
||||
connection.setConnectTimeout(5000);
|
||||
connection.setReadTimeout(5000);
|
||||
connection.connect();
|
||||
StringBuilder response =new StringBuilder();
|
||||
int responsecode = connection.getResponseCode();
|
||||
if(responsecode == HttpsURLConnection.HTTP_OK) {
|
||||
InputStream inputstream =connection.getInputStream();
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(inputstream));
|
||||
String line;
|
||||
|
||||
while((line =reader.readLine()) != null) {
|
||||
response.append(line);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
connection.disconnect();
|
||||
return response.toString();
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,257 @@
|
|||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package nc.ui.bd.ref.model;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
import nc.bs.framework.common.NCLocator;
|
||||
import nc.bs.logging.Logger;
|
||||
import nc.bs.sec.esapi.NCESAPI;
|
||||
import nc.itf.bd.material.assign.IMaterialAssignService;
|
||||
import nc.itf.uap.bd.ref.IAssignDataShowRefModel;
|
||||
import nc.ui.bd.ref.AbstractRefGridTreeBigDataModel;
|
||||
import nc.ui.bd.ref.IRefDocEdit;
|
||||
import nc.ui.bd.ref.IRefMaintenanceHandler;
|
||||
import nc.ui.bd.ref.RefSearchFieldSetting;
|
||||
import nc.ui.pub.beans.ValueChangedEvent;
|
||||
import nc.vo.bd.material.MaterialVersionVO;
|
||||
import nc.vo.bd.material.marbasclass.MarBasClassSysParaUtil;
|
||||
import nc.vo.bd.material.marbasclass.MarBasClassVO;
|
||||
import nc.vo.bd.material.measdoc.MeasdocVO;
|
||||
import nc.vo.ml.NCLangRes4VoTransl;
|
||||
import nc.vo.org.OrgVO;
|
||||
import nc.vo.pfxx.util.ArrayUtils;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nc.vo.util.BDVisibleUtil;
|
||||
import nc.vo.util.SqlWhereUtil;
|
||||
import nc.vo.util.VisibleUtil;
|
||||
|
||||
public class MaterialDefaultRefModel extends AbstractRefGridTreeBigDataModel implements IAssignDataShowRefModel {
|
||||
private boolean isShowAssginDataChk = false;
|
||||
private boolean isShowDisableData = false;
|
||||
private boolean isAssginShowData = false;
|
||||
private IMaterialAssignService assignService = null;
|
||||
private Map<String, String> assginSqlMap = new HashMap();
|
||||
private UserDefRefShow userDefRefShow = UserDefRefShowUtil.getInstance().getUserDefRefShow("c7dc0ccd-8872-4eee-8882-160e8f49dfad");
|
||||
|
||||
public MaterialDefaultRefModel() {
|
||||
this.reset();
|
||||
}
|
||||
|
||||
public void filterValueChanged(ValueChangedEvent changedValue) {
|
||||
super.filterValueChanged(changedValue);
|
||||
String[] pk_orgs = (String[])changedValue.getNewValue();
|
||||
if (ArrayUtils.isNotEmpty(pk_orgs)) {
|
||||
this.setPk_org(pk_orgs[0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String getClassWherePart() {
|
||||
SqlWhereUtil sw = new SqlWhereUtil(super.getClassWherePart());
|
||||
|
||||
try {
|
||||
sw.and(VisibleUtil.getRefVisibleCondition(this.getPk_group(), this.getPk_org(), "c099f7d7-52a9-4b98-bee7-2e3a6c3ea263"));
|
||||
if (this.isDisabledDataShow()) {
|
||||
sw.and("enablestate in (2,3) ");
|
||||
} else {
|
||||
sw.and("enablestate = 2");
|
||||
}
|
||||
|
||||
return sw.getSQLWhere();
|
||||
} catch (BusinessException e) {
|
||||
Logger.error(e.getMessage());
|
||||
return " 1=2 ";
|
||||
}
|
||||
}
|
||||
|
||||
public String getCodingRule() {
|
||||
String codeRule = null;
|
||||
|
||||
try {
|
||||
codeRule = MarBasClassSysParaUtil.getCodeRuleSysPara(this.getPk_group(), this.getPk_org());
|
||||
} catch (BusinessException e) {
|
||||
Logger.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
return codeRule;
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
this.setRefNodeName("物料");
|
||||
this.setRootName(NCLangRes4VoTransl.getNCLangRes().getStrByID("10140mclg", "110140mclg0002"));
|
||||
this.setClassFieldCode(new String[]{"code", "name", "pk_marbasclass", "pk_org"});
|
||||
this.setClassJoinField("pk_marbasclass");
|
||||
this.setClassTableName(MarBasClassVO.getDefaultTableName());
|
||||
this.setClassDefaultFieldCount(2);
|
||||
this.setClassDataPower(true);
|
||||
this.setClassWherePart("1 = 1");
|
||||
this.setFieldCode(new String[]{"pk_org", "code", "name", "materialspec", "materialtype", "materialshortname", "materialmnecode", "graphid", "pk_measdoc"});
|
||||
String[] fieldNames = new String[]{NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "2UC000-000360"), NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "UC000-0002911"), NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "UC000-0002908"), NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "UC000-0003448"), NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "UC000-0001240"), NCLangRes4VoTransl.getNCLangRes().getStrByID("10140mag", "2materia-000017"), NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "UC000-0000703"), NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "UC000-0001223"), NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "2UC000-000031")};
|
||||
this.setFieldName(fieldNames);
|
||||
String orgFomula = "getMLCValue(\"" + OrgVO.getDefaultTableName() + "\",\"" + "name" + "\",\"" + "pk_org" + "\"," + "pk_org" + ")";
|
||||
String mesFomula = "getMLCValue(\"" + MeasdocVO.getDefaultTableName() + "\",\"" + "name" + "\",\"" + "pk_measdoc" + "\"," + "pk_measdoc" + ")";
|
||||
this.setFormulas(new String[][]{{"pk_org", orgFomula}, {"pk_measdoc", mesFomula}});
|
||||
this.setDefaultFieldCount(7);
|
||||
this.setHiddenFieldCode(new String[]{"pk_material", "pk_source", "pk_marbasclass"});
|
||||
this.setTableName(MaterialVersionVO.getDefaultTableName());
|
||||
this.setPkFieldCode("pk_source");
|
||||
this.setDocJoinField("pk_marbasclass");
|
||||
this.setRefCodeField("code");
|
||||
this.setRefNameField("name");
|
||||
this.setMnecode(new String[]{"materialmnecode"});
|
||||
this.setAddEnableStateWherePart(true);
|
||||
this.setOrderPart("code");
|
||||
this.setResourceID("material_v");
|
||||
this.setClassResouceID("materialbasclass");
|
||||
this.setRefMaintenanceHandler(new IRefMaintenanceHandler() {
|
||||
public String[] getFucCodes() {
|
||||
return new String[]{"10140MAG", "10140MAO"};
|
||||
}
|
||||
|
||||
public IRefDocEdit getRefDocEdit() {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
this.setCommonDataTableName(MaterialVersionVO.getDefaultTableName());
|
||||
this.setFilterRefNodeName(new String[]{"业务单元"});
|
||||
this.userDefRefShow.addUserDefItemFields(this);
|
||||
this.resetFieldName();
|
||||
this.assginSqlMap.clear();
|
||||
Map<String, String> allFields = new LinkedHashMap();
|
||||
allFields.put("pk_org", fieldNames[0]);
|
||||
allFields.put("code", fieldNames[1]);
|
||||
allFields.put("name", fieldNames[2]);
|
||||
allFields.put("materialspec", fieldNames[3]);
|
||||
allFields.put("materialtype", fieldNames[4]);
|
||||
allFields.put("materialshortname", fieldNames[5]);
|
||||
allFields.put("materialmnecode", fieldNames[6]);
|
||||
allFields.put("graphid", fieldNames[7]);
|
||||
String[] defaultSearchFields = new String[]{"code", "name"};
|
||||
RefSearchFieldSetting setting = new RefSearchFieldSetting(this.getRefNodeName(), allFields, defaultSearchFields);
|
||||
this.setSearchFieldSetting(setting);
|
||||
}
|
||||
|
||||
// public void reset() {
|
||||
// this.setRefNodeName("物料");
|
||||
// this.setRootName(NCLangRes4VoTransl.getNCLangRes().getStrByID("10140mclg", "110140mclg0002"));
|
||||
// this.setClassFieldCode(new String[]{"code", "name", "pk_marbasclass", "pk_org"});
|
||||
// this.setClassJoinField("pk_marbasclass");
|
||||
// this.setClassTableName(MarBasClassVO.getDefaultTableName());
|
||||
// this.setClassDefaultFieldCount(2);
|
||||
// this.setClassDataPower(true);
|
||||
// this.setClassWherePart("1 = 1");
|
||||
// this.setFieldCode(new String[]{"pk_org", "code", "name", "materialspec", "materialtype", "materialshortname", "materialmnecode", "graphid", "pk_measdoc"
|
||||
//// , "memo"
|
||||
// });
|
||||
// String[] fieldNames = new String[]{NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "2UC000-000360"),
|
||||
// NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "UC000-0002911"),
|
||||
// NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "UC000-0002908"),
|
||||
// NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "UC000-0003448"),
|
||||
// NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "UC000-0001240"),
|
||||
// NCLangRes4VoTransl.getNCLangRes().getStrByID("10140mag", "2materia-000017"),
|
||||
// NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "UC000-0000703"),
|
||||
// NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "UC000-0001223"),
|
||||
// NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "2UC000-000031")
|
||||
//// ,NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "2UC000-000258")
|
||||
// };
|
||||
// this.setFieldName(fieldNames);
|
||||
// String orgFomula = "getMLCValue(\"" + OrgVO.getDefaultTableName() + "\",\"" + "name" + "\",\"" + "pk_org" + "\"," + "pk_org" + ")";
|
||||
// String mesFomula = "getMLCValue(\"" + MeasdocVO.getDefaultTableName() + "\",\"" + "name" + "\",\"" + "pk_measdoc" + "\"," + "pk_measdoc" + ")";
|
||||
// this.setFormulas(new String[][]{{"pk_org", orgFomula}, {"pk_measdoc", mesFomula}});
|
||||
// this.setDefaultFieldCount(7);
|
||||
// this.setHiddenFieldCode(new String[]{"pk_material", "pk_source", "pk_marbasclass"});
|
||||
// this.setTableName(MaterialVersionVO.getDefaultTableName());
|
||||
// this.setPkFieldCode("pk_source");
|
||||
// this.setDocJoinField("pk_marbasclass");
|
||||
// this.setRefCodeField("code");
|
||||
// this.setRefNameField("name");
|
||||
// this.setMnecode(new String[]{"materialmnecode"});
|
||||
// this.setAddEnableStateWherePart(true);
|
||||
// this.setOrderPart("code");
|
||||
// this.setResourceID("material_v");
|
||||
// this.setClassResouceID("materialbasclass");
|
||||
// this.setRefMaintenanceHandler(new IRefMaintenanceHandler() {
|
||||
// public String[] getFucCodes() {
|
||||
// return new String[]{"10140MAG", "10140MAO"};
|
||||
// }
|
||||
//
|
||||
// public IRefDocEdit getRefDocEdit() {
|
||||
// return null;
|
||||
// }
|
||||
// });
|
||||
// this.setCommonDataTableName(MaterialVersionVO.getDefaultTableName());
|
||||
// this.setFilterRefNodeName(new String[]{"业务单元"});
|
||||
// this.userDefRefShow.addUserDefItemFields(this);
|
||||
// this.resetFieldName();
|
||||
// this.assginSqlMap.clear();
|
||||
// Map<String, String> allFields = new LinkedHashMap();
|
||||
// allFields.put("pk_org", fieldNames[0]);
|
||||
// allFields.put("code", fieldNames[1]);
|
||||
// allFields.put("name", fieldNames[2]);
|
||||
// allFields.put("materialspec", fieldNames[3]);
|
||||
// allFields.put("materialtype", fieldNames[4]);
|
||||
// allFields.put("materialshortname", fieldNames[5]);
|
||||
// allFields.put("materialmnecode", fieldNames[6]);
|
||||
// allFields.put("graphid", fieldNames[7]);
|
||||
//// allFields.put("memo", fieldNames[8]);
|
||||
// String[] defaultSearchFields = new String[]{"code", "name"};
|
||||
// RefSearchFieldSetting setting = new RefSearchFieldSetting(this.getRefNodeName(), allFields, defaultSearchFields);
|
||||
// this.setSearchFieldSetting(setting);
|
||||
// }
|
||||
|
||||
public Vector getData() {
|
||||
Vector<Vector> v = super.getData();
|
||||
this.userDefRefShow.proessorData(v);
|
||||
return v;
|
||||
}
|
||||
|
||||
protected String getEnvWherePart() {
|
||||
SqlWhereUtil sw = new SqlWhereUtil();
|
||||
|
||||
try {
|
||||
sw.and(BDVisibleUtil.getRefVisibleCondition(NCESAPI.clientSqlEncode(this.getPk_group()), NCESAPI.clientSqlEncode(this.getPk_org()), "c7dc0ccd-8872-4eee-8882-160e8f49dfad", this.isShowDisableData()));
|
||||
} catch (BusinessException e) {
|
||||
Logger.error(e.getMessage());
|
||||
}
|
||||
|
||||
return sw.getSQLWhere();
|
||||
}
|
||||
|
||||
public boolean isAssginShowData() {
|
||||
return this.isAssginShowData;
|
||||
}
|
||||
|
||||
public void setAssginShowData(boolean isAssginShowData) {
|
||||
this.isAssginShowData = isAssginShowData;
|
||||
}
|
||||
|
||||
private IMaterialAssignService getAssignService() {
|
||||
if (this.assignService == null) {
|
||||
this.assignService = (IMaterialAssignService)NCLocator.getInstance().lookup(IMaterialAssignService.class);
|
||||
}
|
||||
|
||||
return this.assignService;
|
||||
}
|
||||
|
||||
public boolean isShowAssginDataChk() {
|
||||
return this.isShowAssginDataChk;
|
||||
}
|
||||
|
||||
public void setShowAssginDataChk(boolean isShowAssginDataChk) {
|
||||
this.isShowAssginDataChk = isShowAssginDataChk;
|
||||
}
|
||||
|
||||
public void setShowDisableData(boolean isShowDisableData) {
|
||||
this.isShowDisableData = isShowDisableData;
|
||||
}
|
||||
|
||||
public boolean isShowDisableData() {
|
||||
return this.isShowDisableData;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue