Compare commits
10 Commits
88ff390b74
...
544db685db
Author | SHA1 | Date |
---|---|---|
|
544db685db | |
|
d3f53545f7 | |
|
2e2f06a2b4 | |
|
97fbd9759c | |
|
9fb6686e5b | |
|
64b83e3f7e | |
|
9086a9d93b | |
|
c3b061861f | |
|
1d06e025da | |
|
375b4f5245 |
|
@ -13,6 +13,7 @@ import nc.bs.arap.validator.CrossRuleCheckValidator;
|
|||
import nc.bs.dao.BaseDAO;
|
||||
import nc.bs.dao.DAOException;
|
||||
import nc.bs.trade.business.HYSuperDMO;
|
||||
import nc.jdbc.framework.processor.MapListProcessor;
|
||||
import nc.jdbc.framework.processor.MapProcessor;
|
||||
import nc.vo.arap.basebill.BaseBillVO;
|
||||
import nc.vo.arap.gathering.GatheringBillItemVO;
|
||||
|
@ -23,9 +24,11 @@ import nc.vo.pub.BusinessException;
|
|||
import nc.vo.pub.CircularlyAccessibleValueObject;
|
||||
import nc.vo.pub.lang.UFDouble;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -69,45 +72,80 @@ public class GatheringbillEditSaveBatchBSAction extends BillUpdateBatchBSAction
|
|||
if(!"30".equals(srcBilltype)){
|
||||
continue;
|
||||
}
|
||||
|
||||
String def3 = ((GatheringBillItemVO)bill.getChildrenVO()[0]).getSrc_billid(); // 收款单对应的销售订单id
|
||||
if (StringUtil.isEmpty(def3) || "N".equals(def3) || "~".equals(def3)) {
|
||||
// 无绑定的销售订单则下一次循环
|
||||
continue;
|
||||
}
|
||||
List<String> def3List = new ArrayList<>();
|
||||
for (int j=0;j<bill.getChildrenVO().length;i++){
|
||||
def3List.add(((GatheringBillItemVO)bill.getChildrenVO()[j]).getSrc_billid());
|
||||
}
|
||||
String result = "";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (def3List.size() > 1) {
|
||||
for (int j = 0; j < def3List.size(); j++) {
|
||||
sb.append("'").append(def3List.get(j)).append("'");
|
||||
if (j < def3List.size() - 1) {
|
||||
sb.append(",");
|
||||
}
|
||||
}
|
||||
|
||||
result = sb.toString();
|
||||
} else {
|
||||
result = "'" + (String) def3List.get(0) + "'";
|
||||
}
|
||||
// 计算收款单金额差值
|
||||
UFDouble changeMoney = money.sub(oriMoney);
|
||||
// 根据销售订单id去查询销售订单
|
||||
BaseDAO dao = new BaseDAO();
|
||||
List<String> defMap = checkOrgCtrl();
|
||||
if (defMap.isEmpty() ) {
|
||||
return ;
|
||||
}
|
||||
String sql1="SELECT org_salesorg.CODE ,so_saleorder.dbilldate, so_saleorder.pk_org, so_saleorder.vbillcode,so_saleorder.nreceivedmny,so_saleorder.ntotalorigmny FROM so_saleorder LEFT JOIN org_salesorg ON org_salesorg.PK_SALESORG = so_saleorder.PK_ORG where so_saleorder.dr = 0 and so_saleorder.csaleorderid = '" +def3+"'";
|
||||
Map saleMap = (Map)dao.executeQuery(sql1, new MapProcessor());
|
||||
String code = saleMap.get("code").toString();
|
||||
LocalDateTime dbilldate = LocalDateTime.parse(saleMap.get("dbilldate").toString(),
|
||||
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
LocalDateTime targetDate = LocalDateTime.parse("2025-06-27 00:00:00",
|
||||
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
// List<String> defMap = checkOrgCtrl();
|
||||
// if (defMap.isEmpty() ) {
|
||||
// return ;
|
||||
// }
|
||||
String sql1="SELECT org_salesorg.CODE ,so_saleorder.dbilldate, so_saleorder.pk_org, so_saleorder.vbillcode,so_saleorder.nreceivedmny,so_saleorder.ntotalorigmny FROM so_saleorder LEFT JOIN org_salesorg ON org_salesorg.PK_SALESORG = so_saleorder.PK_ORG where so_saleorder.dr = 0 and so_saleorder.csaleorderid in (" + result + ") ";
|
||||
ArrayList<HashMap<String, Object>> saleMap = (ArrayList<HashMap<String, Object>>)dao.executeQuery(sql1, new MapListProcessor());
|
||||
|
||||
if (defMap.contains(code) && dbilldate.isBefore(targetDate)) {
|
||||
return;
|
||||
}
|
||||
// 销售订单价税合计
|
||||
// List<Map> saleMap = (List<Map>)dao.executeQuery(sql1, new MapProcessor());
|
||||
// String code = saleMap.get("code").toString();
|
||||
// LocalDateTime dbilldate = LocalDateTime.parse(saleMap.get("dbilldate").toString(),
|
||||
// DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
// LocalDateTime targetDate = LocalDateTime.parse("2025-06-27 00:00:00",
|
||||
// DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
//
|
||||
// if (!defMap.isEmpty()&& defMap.contains(code) && dbilldate.isBefore(targetDate)) {
|
||||
// return;
|
||||
// }
|
||||
// Map saleMap = (Map)dao.executeQuery(sql, new MapProcessor());
|
||||
//销售订单价税合计
|
||||
UFDouble ntotalorigmny = UFDouble.ZERO_DBL;
|
||||
// 销售订单实际收款金额
|
||||
//销售订单实际收款金额
|
||||
UFDouble nreceivedmny = UFDouble.ZERO_DBL;
|
||||
String vbillcode = "";
|
||||
StringBuilder vbillcodeBuilder = new StringBuilder();
|
||||
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());
|
||||
vbillcode = saleMap.get("vbillcode") == null ? "" : saleMap.get("vbillcode").toString();
|
||||
for (Map<String, Object> map : saleMap) {
|
||||
// 累加 nreceivedmny
|
||||
String nreceivedmnyStr = map.get("nreceivedmny") == null ? "0" : map.get("nreceivedmny").toString();
|
||||
nreceivedmny.add(new UFDouble(nreceivedmnyStr)) ;
|
||||
|
||||
// 累加 ntotalorigmny
|
||||
BigDecimal ntotalorigmnyStr = map.get("ntotalorigmny") == null ? BigDecimal.ZERO : (BigDecimal) map.get("ntotalorigmny");
|
||||
UFDouble ufd= new UFDouble(ntotalorigmnyStr);
|
||||
ntotalorigmny= ntotalorigmny.add(ufd);
|
||||
// 拼接 vbillcode
|
||||
String vbillcodeStr = map.get("vbillcode") == null ? "" : map.get("vbillcode").toString();
|
||||
if (!vbillcodeStr.isEmpty()) {
|
||||
if (vbillcodeBuilder.length() > 0) {
|
||||
vbillcodeBuilder.append(", ");
|
||||
}
|
||||
vbillcodeBuilder.append(vbillcodeStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (money.compareTo(ntotalorigmny) > 0) {
|
||||
UFDouble moreMoney = money.sub(ntotalorigmny);
|
||||
throw new BusinessException("【该笔收款税收合计" + money + "已超销售订单 [" + vbillcode + "] " + moreMoney + "元,无法传输!请检查订单累计收款金额!】");
|
||||
throw new BusinessException("【该笔收款税收合计" + money + "已超销售订单 [" + vbillcodeBuilder + "] " + moreMoney + "元,无法传输!请检查订单累计收款金额!】");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import nc.bs.arap.validator.CrossRuleCheckValidator;
|
|||
import nc.bs.dao.BaseDAO;
|
||||
import nc.bs.dao.DAOException;
|
||||
import nc.bs.trade.business.HYSuperDMO;
|
||||
import nc.jdbc.framework.processor.MapListProcessor;
|
||||
import nc.jdbc.framework.processor.MapProcessor;
|
||||
import nc.vo.arap.basebill.BaseBillVO;
|
||||
import nc.vo.arap.gathering.GatheringBillItemVO;
|
||||
|
@ -23,6 +24,7 @@ import nc.vo.pub.AggregatedValueObject;
|
|||
import nc.vo.pub.BusinessException;
|
||||
import nc.vo.pub.lang.UFDouble;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
|
@ -82,6 +84,24 @@ public class GatheringbillSaveBatchBSAction extends BillInsertBatchBSAction {
|
|||
if(!"30".equals(srcBilltype)){
|
||||
continue;
|
||||
}
|
||||
List<String> def3List = new ArrayList<>();
|
||||
for (int i=0;i<bill.getChildrenVO().length;i++){
|
||||
def3List.add(((GatheringBillItemVO)bill.getChildrenVO()[i]).getSrc_billid());
|
||||
}
|
||||
String result = "";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (def3List.size() > 1) {
|
||||
for (int i = 0; i < def3List.size(); i++) {
|
||||
sb.append("'").append(def3List.get(i)).append("'");
|
||||
if (i < def3List.size() - 1) {
|
||||
sb.append(",");
|
||||
}
|
||||
}
|
||||
|
||||
result = sb.toString();
|
||||
} else {
|
||||
result = "'" + (String) def3List.get(0) + "'";
|
||||
}
|
||||
String def3 = ((GatheringBillItemVO)bill.getChildrenVO()[0]).getSrc_billid(); // 收款单对应的销售订单id
|
||||
if(StringUtil.isEmpty(def3) || "N".equals(def3) || "~".equals(def3)){
|
||||
//无绑定的销售订单则下一次循环
|
||||
|
@ -94,35 +114,53 @@ public class GatheringbillSaveBatchBSAction extends BillInsertBatchBSAction {
|
|||
|
||||
|
||||
|
||||
List<String> defMap = checkOrgCtrl();
|
||||
if (defMap.isEmpty() ) {
|
||||
return ;
|
||||
}
|
||||
String sql1="SELECT org_salesorg.CODE ,so_saleorder.dbilldate, so_saleorder.pk_org, so_saleorder.vbillcode,so_saleorder.nreceivedmny,so_saleorder.ntotalorigmny FROM so_saleorder LEFT JOIN org_salesorg ON org_salesorg.PK_SALESORG = so_saleorder.PK_ORG where so_saleorder.dr = 0 and so_saleorder.csaleorderid = '" +def3+"'";
|
||||
Map saleMap = (Map)dao.executeQuery(sql1, new MapProcessor());
|
||||
String code = saleMap.get("code").toString();
|
||||
LocalDateTime dbilldate = LocalDateTime.parse(saleMap.get("dbilldate").toString(),
|
||||
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
LocalDateTime targetDate = LocalDateTime.parse("2025-06-27 00:00:00",
|
||||
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
// List<String> defMap = checkOrgCtrl();
|
||||
// if (defMap.isEmpty() ) {
|
||||
// return ;
|
||||
// }
|
||||
// String sql1="SELECT org_salesorg.CODE ,so_saleorder.dbilldate, so_saleorder.pk_org, so_saleorder.vbillcode,so_saleorder.nreceivedmny,so_saleorder.ntotalorigmny FROM so_saleorder LEFT JOIN org_salesorg ON org_salesorg.PK_SALESORG = so_saleorder.PK_ORG where so_saleorder.dr = 0 and so_saleorder.csaleorderid = '" +def3+"'";
|
||||
String sql1="SELECT org_salesorg.CODE ,so_saleorder.dbilldate, so_saleorder.pk_org, so_saleorder.vbillcode,so_saleorder.nreceivedmny,so_saleorder.ntotalorigmny FROM so_saleorder LEFT JOIN org_salesorg ON org_salesorg.PK_SALESORG = so_saleorder.PK_ORG where so_saleorder.dr = 0 and so_saleorder.csaleorderid in (" + result + ") ";
|
||||
ArrayList<HashMap<String, Object>> saleMap = (ArrayList<HashMap<String, Object>>)dao.executeQuery(sql1, new MapListProcessor());
|
||||
|
||||
if (defMap.contains(code) && dbilldate.isBefore(targetDate)) {
|
||||
return;
|
||||
}
|
||||
// List<Map> saleMap = (List<Map>)dao.executeQuery(sql1, new MapProcessor());
|
||||
// String code = saleMap.get("code").toString();
|
||||
// LocalDateTime dbilldate = LocalDateTime.parse(saleMap.get("dbilldate").toString(),
|
||||
// DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
// LocalDateTime targetDate = LocalDateTime.parse("2025-06-27 00:00:00",
|
||||
// DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
//
|
||||
// if (!defMap.isEmpty()&& defMap.contains(code) && dbilldate.isBefore(targetDate)) {
|
||||
// return;
|
||||
// }
|
||||
// Map saleMap = (Map)dao.executeQuery(sql, new MapProcessor());
|
||||
//销售订单价税合计
|
||||
UFDouble ntotalorigmny = UFDouble.ZERO_DBL;
|
||||
//销售订单实际收款金额
|
||||
UFDouble nreceivedmny = UFDouble.ZERO_DBL;
|
||||
String vbillcode = "";
|
||||
StringBuilder vbillcodeBuilder = new StringBuilder();
|
||||
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());
|
||||
vbillcode = saleMap.get("vbillcode") == null ? "" : saleMap.get("vbillcode").toString();
|
||||
for (Map<String, Object> map : saleMap) {
|
||||
// 累加 nreceivedmny
|
||||
String nreceivedmnyStr = map.get("nreceivedmny") == null ? "0" : map.get("nreceivedmny").toString();
|
||||
nreceivedmny.add(new UFDouble(nreceivedmnyStr)) ;
|
||||
|
||||
// 累加 ntotalorigmny
|
||||
BigDecimal ntotalorigmnyStr = map.get("ntotalorigmny") == null ? BigDecimal.ZERO : (BigDecimal) map.get("ntotalorigmny");
|
||||
UFDouble ufd= new UFDouble(ntotalorigmnyStr);
|
||||
ntotalorigmny= ntotalorigmny.add(ufd);
|
||||
// 拼接 vbillcode
|
||||
String vbillcodeStr = map.get("vbillcode") == null ? "" : map.get("vbillcode").toString();
|
||||
if (!vbillcodeStr.isEmpty()) {
|
||||
if (vbillcodeBuilder.length() > 0) {
|
||||
vbillcodeBuilder.append(", ");
|
||||
}
|
||||
vbillcodeBuilder.append(vbillcodeStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (money.compareTo(ntotalorigmny) > 0) {
|
||||
UFDouble moreMoney = money.sub(ntotalorigmny);
|
||||
throw new BusinessException("【该笔收款税收合计" + money + "已超销售订单 [" + vbillcode + "] " + moreMoney + "元,无法传输!请检查订单累计收款金额!】");
|
||||
throw new BusinessException("【该笔收款税收合计" + money + "已超销售订单 [" + vbillcodeBuilder + "] " + moreMoney + "元,无法传输!请检查订单累计收款金额!】");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
package nc.bs.arap.busireg;
|
||||
|
||||
import nc.bs.arap.util.SqlUtils;
|
||||
import nc.bs.businessevent.BusinessEvent;
|
||||
import nc.bs.businessevent.IBusinessEvent;
|
||||
import nc.bs.businessevent.IBusinessListener;
|
||||
import nc.bs.dao.BaseDAO;
|
||||
import nc.bs.logging.Logger;
|
||||
import nc.jdbc.framework.SQLParameter;
|
||||
import nc.vo.pub.AggregatedValueObject;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nc.vo.pub.CircularlyAccessibleValueObject;
|
||||
import nccloud.commons.lang.StringUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 收款单保存后更新到账通知的收款生成状态
|
||||
*/
|
||||
public class GatheringBillAfterUpdateInformer implements IBusinessListener {
|
||||
@Override
|
||||
public void doAction(IBusinessEvent event) throws BusinessException {
|
||||
String eventType = event.getEventType();
|
||||
BusinessEvent e = (BusinessEvent) event;
|
||||
AggregatedValueObject[] aggVOs = this.dealUserObj(e.getUserObject());
|
||||
// EventType是事件编码
|
||||
if ("1002".equals(eventType)) {
|
||||
// 新增后
|
||||
updateInformerGenerateFlag(aggVOs, "hasgenerate");
|
||||
} else if ("1006".equals(eventType)) {
|
||||
// 删除后
|
||||
updateInformerGenerateFlag(aggVOs, "hasnogenerate");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新收款单对应的到账通知 cmp_informer 的 generateflag 生成状态
|
||||
*
|
||||
* @param aggVos 收款单vo数组
|
||||
* @param generateFlag 目标状态(例如 "hasgenerate" 或 "hasnogenerate")
|
||||
*/
|
||||
private void updateInformerGenerateFlag(AggregatedValueObject[] aggVos, String generateFlag) {
|
||||
if (aggVos == null || aggVos.length == 0) {
|
||||
return; // 参数为空时直接返回
|
||||
}
|
||||
try {
|
||||
Set<String> codeSet = new LinkedHashSet<>();
|
||||
for (AggregatedValueObject aggVo : aggVos) {
|
||||
CircularlyAccessibleValueObject[] bvos = aggVo.getChildrenVO();
|
||||
for (CircularlyAccessibleValueObject bvo : bvos) {
|
||||
String bankrelatedCode = (String) bvo.getAttributeValue("bankrelated_code");
|
||||
if (StringUtils.isNotEmpty(bankrelatedCode) && !"~".equals(bankrelatedCode)) {
|
||||
codeSet.add(bankrelatedCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
String[] codes = codeSet.toArray(new String[0]);
|
||||
Logger.error("updateInformerGenerateFlag-codes = " + Arrays.toString(codes));
|
||||
if (codes.length == 0) {
|
||||
return;
|
||||
}
|
||||
BaseDAO baseDAO = new BaseDAO();
|
||||
String inStr = SqlUtils.getInStr("bankrelated_code", codes, true);
|
||||
String sql = "UPDATE cmp_informer SET generateflag = ? WHERE " + inStr;
|
||||
Logger.error("updateInformerGenerateFlag-sql = " + sql);
|
||||
SQLParameter params = new SQLParameter();
|
||||
params.addParam(generateFlag);
|
||||
baseDAO.executeUpdate(sql, params);
|
||||
} catch (Exception e) {
|
||||
Logger.error("updateInformerGenerateFlag-exp:", e);
|
||||
}
|
||||
}
|
||||
|
||||
private AggregatedValueObject[] dealUserObj(Object obj) {
|
||||
if (obj instanceof BusinessEvent.BusinessUserObj) {
|
||||
obj = ((BusinessEvent.BusinessUserObj) obj).getUserObj();
|
||||
}
|
||||
|
||||
AggregatedValueObject[] retvos = null;
|
||||
if (obj.getClass().isArray()) {
|
||||
retvos = (AggregatedValueObject[]) obj;
|
||||
} else {
|
||||
retvos = new AggregatedValueObject[]{(AggregatedValueObject) obj};
|
||||
}
|
||||
|
||||
return retvos;
|
||||
}
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package nc.bs.pub.action;
|
||||
|
||||
import nc.bs.arap.actions.N_BASE_ACTION;
|
||||
import nc.bs.arap.util.GatheringBillAfter;
|
||||
import nc.bs.framework.common.NCLocator;
|
||||
import nc.vo.arap.gathering.AggGatheringBillVO;
|
||||
import nc.vo.arap.pub.ArapConstant;
|
||||
import nc.vo.fipub.exception.ExceptionHandler;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nc.vo.pub.compiler.PfParameterVO;
|
||||
import nccloud.pubitf.arap.arappub.IArapBillPubUtilService;
|
||||
|
||||
import java.util.Hashtable;
|
||||
|
||||
public class N_F2_DELETE extends N_BASE_ACTION {
|
||||
private Hashtable<String, Object> m_keyHas = null;
|
||||
|
||||
public N_F2_DELETE() {
|
||||
}
|
||||
|
||||
public Object runComClass(PfParameterVO paraVo) throws BusinessException {
|
||||
try {
|
||||
if (paraVo.m_preValueVos == null) {
|
||||
return null;
|
||||
} else {
|
||||
Object obj = null;
|
||||
super.m_tmpVo = paraVo;
|
||||
String actionCode = ArapConstant.DELETE;
|
||||
((IArapBillPubUtilService) NCLocator.getInstance().lookup(IArapBillPubUtilService.class)).interceptorVaildator(paraVo.m_preValueVos, actionCode);
|
||||
this.setParameter("context", paraVo.m_preValueVos);
|
||||
obj = this.runClass("nc.bs.arap.actions.GatheringbillDeleteBatchBSAction", "deleteVOs", "&context:nc.vo.pub.AggregatedValueObject[]", paraVo, this.m_keyHas);
|
||||
this.afterCheck();
|
||||
// 收款单删除后将对应的到账通知cmp_informer的生成状态generateflag修改为已生成hasnogenerate
|
||||
AggGatheringBillVO[] aggVos = (AggGatheringBillVO[]) paraVo.m_preValueVos;
|
||||
GatheringBillAfter.updateInformerGenerateFlag(aggVos, "hasnogenerate");
|
||||
return obj;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
throw ExceptionHandler.handleException(this.getClass(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
public String getCodeRemark() {
|
||||
return " arap action script not allowed to modify ,all rights reserved!";
|
||||
}
|
||||
|
||||
protected void setParameter(String key, Object val) {
|
||||
if (this.m_keyHas == null) {
|
||||
this.m_keyHas = new Hashtable();
|
||||
}
|
||||
|
||||
if (val != null) {
|
||||
this.m_keyHas.put(key, val);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,186 +0,0 @@
|
|||
package nc.bs.pub.action;
|
||||
|
||||
import nc.bs.arap.actions.N_BASE_ACTION;
|
||||
import nc.bs.arap.gatheringbp.GatherBillBO;
|
||||
import nc.bs.arap.util.GatheringBillAfter;
|
||||
import nc.bs.dao.BaseDAO;
|
||||
import nc.bs.framework.common.InvocationInfoProxy;
|
||||
import nc.bs.framework.common.NCLocator;
|
||||
import nc.bs.logging.Logger;
|
||||
import nc.impl.pubapp.env.BSContext;
|
||||
import nc.pubitf.so.m30.sobalance.ISoBalance4VerifyQryBill;
|
||||
import nc.vo.arap.gathering.AggGatheringBillVO;
|
||||
import nc.vo.arap.pub.ArapConstant;
|
||||
import nc.vo.arap.pub.BillEnumCollection;
|
||||
import nc.vo.arap.receivable.ReceivableBillItemVO;
|
||||
import nc.vo.arap.utils.StringUtil;
|
||||
import nc.vo.fi.pub.SqlUtils;
|
||||
import nc.vo.fipub.exception.ExceptionHandler;
|
||||
import nc.vo.ml.NCLangRes4VoTransl;
|
||||
import nc.vo.pub.AggregatedValueObject;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nc.vo.pub.compiler.PfParameterVO;
|
||||
import nc.vo.pub.lang.UFBoolean;
|
||||
import nc.vo.pub.lang.UFDouble;
|
||||
import nccloud.bs.arap.util.commit.ArapCommitUtil;
|
||||
import nccloud.impl.platform.common.util.StringUtils;
|
||||
import nccloud.pubitf.arap.arappub.IArapBillPubUtilService;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
public class N_F2_SAVE extends N_BASE_ACTION {
|
||||
private Hashtable<String, Object> m_keyHas = null;
|
||||
|
||||
|
||||
public String getCodeRemark() {
|
||||
return " arap action script not allowed to modify ,all rights reserved!";
|
||||
}
|
||||
|
||||
|
||||
public Object runComClass(PfParameterVO paraVo) throws BusinessException {
|
||||
try {
|
||||
super.m_tmpVo = paraVo;
|
||||
Object obj = null;
|
||||
setParameter("context", paraVo.m_preValueVos);
|
||||
|
||||
if (paraVo.isCloudEntry) {
|
||||
|
||||
String actionCode = ArapConstant.SAVE;
|
||||
((IArapBillPubUtilService) NCLocator.getInstance().lookup(IArapBillPubUtilService.class)).interceptorVaildator(paraVo.m_preValueVos, actionCode);
|
||||
}
|
||||
|
||||
|
||||
String code = InvocationInfoProxy.getInstance().getProperty(ArapConstant.NCCFlOW_PARAMTER);
|
||||
if (!StringUtils.isEmpty(code)) {
|
||||
String[] codes = code.split(",");
|
||||
for (int i = 0; i < codes.length; i++) {
|
||||
BSContext.getInstance().setSession(codes[i], UFBoolean.FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
this.beforeCheck();
|
||||
|
||||
AggregatedValueObject bill = (paraVo.m_preValueVo == null) ? paraVo.m_preValueVos[0] : paraVo.m_preValueVo;
|
||||
if (bill != null && bill.getChildrenVO() != null && bill.getChildrenVO().length > 0 && bill.getChildrenVO()[0] != null) {
|
||||
String pk_billtype = (String) bill.getChildrenVO()[0].getAttributeValue("pk_billtype");
|
||||
String top_billtype = (String) bill.getChildrenVO()[0].getAttributeValue("top_billtype");
|
||||
String src_billtype = (String) bill.getChildrenVO()[0].getAttributeValue("src_billtype");
|
||||
|
||||
if ("F2".equals(pk_billtype) && "30".equals(src_billtype) && "F0".equals(top_billtype)) {
|
||||
|
||||
Map<String, UFDouble> f2mnyMap = new HashMap<>();
|
||||
Map<String, UFDouble> f0mnyMap = new HashMap<>();
|
||||
|
||||
List<String> orderIds = new ArrayList<>();
|
||||
List<String> f0pks = new ArrayList<>();
|
||||
for (int i = 0; i < bill.getChildrenVO().length; i++) {
|
||||
String src_billid = (String) bill.getChildrenVO()[i].getAttributeValue("src_billid");
|
||||
UFDouble money_bal = (UFDouble) bill.getChildrenVO()[i].getAttributeValue("money_bal");
|
||||
if (!StringUtil.isEmpty(src_billid)) {
|
||||
orderIds.add((String) bill.getChildrenVO()[i].getAttributeValue("src_billid"));
|
||||
}
|
||||
if (f2mnyMap.get(src_billid) == null) {
|
||||
f2mnyMap.put(src_billid, money_bal);
|
||||
} else {
|
||||
f2mnyMap.put(src_billid, ((UFDouble) f2mnyMap.get(src_billid)).add(money_bal));
|
||||
}
|
||||
f0pks.add((String) bill.getChildrenVO()[i].getAttributeValue("top_billid"));
|
||||
}
|
||||
|
||||
String f0sql = SqlUtils.getInStr("pk_recbill", (String[]) f0pks.toArray(new String[0]), true);
|
||||
|
||||
Collection<ReceivableBillItemVO> foItemvos = (new BaseDAO()).retrieveByClause(ReceivableBillItemVO.class, f0sql);
|
||||
for (ReceivableBillItemVO vo : foItemvos) {
|
||||
String src_billid = (String) vo.getAttributeValue("src_billid");
|
||||
UFDouble money_bal = (UFDouble) vo.getAttributeValue("money_bal");
|
||||
if (f0mnyMap.get(src_billid) == null) {
|
||||
f0mnyMap.put(src_billid, money_bal);
|
||||
continue;
|
||||
}
|
||||
f0mnyMap.put(src_billid, ((UFDouble) f0mnyMap.get(src_billid)).add(money_bal));
|
||||
}
|
||||
|
||||
|
||||
Map<String, Map<String, UFDouble>> soOrderIdTOF2ItemMnyMap = ((ISoBalance4VerifyQryBill) NCLocator.getInstance().lookup(ISoBalance4VerifyQryBill.class)).querySobalanceAccVerifyMnyMap((String[]) orderIds.toArray(new String[0]));
|
||||
if (soOrderIdTOF2ItemMnyMap != null && soOrderIdTOF2ItemMnyMap.size() > 0) {
|
||||
for (String order : orderIds) {
|
||||
Map<String, UFDouble> mnys = (Map) soOrderIdTOF2ItemMnyMap.get(order);
|
||||
UFDouble summny = UFDouble.ZERO_DBL;
|
||||
if (mnys == null || mnys.size() == 0) {
|
||||
continue;
|
||||
}
|
||||
for (String key : mnys.keySet()) {
|
||||
UFDouble mny = (mnys.get(key) == null) ? UFDouble.ZERO_DBL : (UFDouble) mnys.get(key);
|
||||
summny = summny.add(mny);
|
||||
}
|
||||
if (f2mnyMap.get(order) == null) {
|
||||
f2mnyMap.put(order, summny);
|
||||
continue;
|
||||
}
|
||||
f2mnyMap.put(order, ((UFDouble) f2mnyMap.get(order)).add(summny));
|
||||
}
|
||||
|
||||
|
||||
for (String order : orderIds) {
|
||||
if (f0mnyMap.get(order) != null && f2mnyMap.get(order) != null && ((UFDouble) f2mnyMap.get(order)).abs().compareTo(((UFDouble) f0mnyMap.get(order)).abs()) > 0) {
|
||||
throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("2006pub_0", "02006pub-1678"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String primaryKey = paraVo.m_preValueVos[0].getParentVO().getPrimaryKey();
|
||||
|
||||
if (hasBill(primaryKey)) {
|
||||
obj = runClass("nc.bs.arap.actions.GatheringbillEditSaveBatchBSAction", "updateVOs", "&context:nc.vo.pub.AggregatedValueObject[]", paraVo, this.m_keyHas);
|
||||
} else {
|
||||
|
||||
paraVo = approveStatusChange(paraVo);
|
||||
obj = runClass("nc.bs.arap.actions.GatheringbillSaveBatchBSAction", "insertVOs", "&context:nc.vo.pub.AggregatedValueObject[]", paraVo, this.m_keyHas);
|
||||
}
|
||||
// 生成收款单后将对应的到账通知cmp_informer的生成状态generateflag修改为已生成hasgenerate
|
||||
AggGatheringBillVO[] aggVos = (AggGatheringBillVO[]) paraVo.m_preValueVos;
|
||||
GatheringBillAfter.updateInformerGenerateFlag(aggVos, "hasgenerate");
|
||||
|
||||
return (new ArapCommitUtil()).autoCommit(obj);
|
||||
|
||||
} catch (Exception exception) {
|
||||
throw ExceptionHandler.handleException(getClass(), exception);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasBill(String primaryKey) throws BusinessException {
|
||||
boolean hasBill = false;
|
||||
if (primaryKey != null) {
|
||||
AggGatheringBillVO[] bvos = null;
|
||||
try {
|
||||
GatherBillBO payableBO = new GatherBillBO();
|
||||
bvos = payableBO.findBillByPrimaryKey(new String[]{primaryKey});
|
||||
} catch (Exception e) {
|
||||
Logger.error(e.getMessage(), e);
|
||||
}
|
||||
if (bvos != null && bvos.length != 0 && bvos[0] != null) {
|
||||
hasBill = true;
|
||||
}
|
||||
}
|
||||
return hasBill;
|
||||
}
|
||||
|
||||
protected void setParameter(String key, Object val) {
|
||||
if (this.m_keyHas == null) {
|
||||
this.m_keyHas = new Hashtable();
|
||||
}
|
||||
if (val != null)
|
||||
this.m_keyHas.put(key, val);
|
||||
}
|
||||
|
||||
private PfParameterVO approveStatusChange(PfParameterVO paraVo) {
|
||||
for (AggregatedValueObject vo : paraVo.m_preValueVos) {
|
||||
vo.getParentVO().setAttributeValue("approvestatus", BillEnumCollection.ApproveStatus.NOSTATE.VALUE);
|
||||
}
|
||||
return paraVo;
|
||||
}
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
package nc.bs.arap.util;
|
||||
|
||||
import nc.bs.dao.BaseDAO;
|
||||
import nc.bs.logging.Logger;
|
||||
import nc.jdbc.framework.SQLParameter;
|
||||
import nc.vo.arap.gathering.AggGatheringBillVO;
|
||||
import nc.vo.arap.gathering.GatheringBillItemVO;
|
||||
import nccloud.commons.lang.StringUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 更新到账通知的收款生成状态
|
||||
*
|
||||
* @author mzr
|
||||
* @date 2025/6/13
|
||||
*/
|
||||
public class GatheringBillAfter {
|
||||
|
||||
/**
|
||||
* 更新收款单对应的到账通知 cmp_informer 的 generateflag 生成状态
|
||||
*
|
||||
* @param aggVos 收款单vo数组
|
||||
* @param generateFlag 目标状态(例如 "hasgenerate" 或 "hasnogenerate")
|
||||
*/
|
||||
public static void updateInformerGenerateFlag(AggGatheringBillVO[] aggVos, String generateFlag) {
|
||||
if (aggVos == null || aggVos.length == 0) {
|
||||
return; // 参数为空时直接返回
|
||||
}
|
||||
try {
|
||||
Set<String> codeSet = new LinkedHashSet<>();
|
||||
for (AggGatheringBillVO aggVo : aggVos) {
|
||||
GatheringBillItemVO[] bvos = aggVo.getBodyVOs();
|
||||
for (GatheringBillItemVO bvo : bvos) {
|
||||
String bankrelatedCode = bvo.getBankrelated_code();
|
||||
if (StringUtils.isNotEmpty(bankrelatedCode) && !"~".equals(bankrelatedCode)) {
|
||||
codeSet.add(bankrelatedCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
String[] codes = codeSet.toArray(new String[0]);
|
||||
Logger.error("updateInformerGenerateFlag-codes = " + Arrays.toString(codes));
|
||||
if (codes.length == 0) {
|
||||
return;
|
||||
}
|
||||
BaseDAO baseDAO = new BaseDAO();
|
||||
String inStr = SqlUtils.getInStr("bankrelated_code", codes, true);
|
||||
String sql = "UPDATE cmp_informer SET generateflag = ? WHERE " + inStr;
|
||||
SQLParameter params = new SQLParameter();
|
||||
params.addParam(generateFlag);
|
||||
baseDAO.executeUpdate(sql, params);
|
||||
} catch (Exception e) {
|
||||
Logger.error("updateInformerGenerateFlag-exp:", e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -248,11 +248,6 @@ public class PInvoice extends SuperVO implements Serializable ,IEncode{
|
|||
private PInvoiceCepz[] cepzs;
|
||||
|
||||
private PInvoiceTspz[] tspzs;
|
||||
// 数电发票是否显示购销方地址电话
|
||||
private String einvoiceShowGxfDzDh;
|
||||
|
||||
// 数电发票是否显示购销方银行、账号
|
||||
private String einvoiceShowGxfYhZh;
|
||||
|
||||
public String getApplyNumber() {
|
||||
|
||||
|
@ -950,22 +945,6 @@ public class PInvoice extends SuperVO implements Serializable ,IEncode{
|
|||
this.kqysssxbgglbm = kqysssxbgglbm;
|
||||
}
|
||||
|
||||
public String getEinvoiceShowGxfDzDh() {
|
||||
return einvoiceShowGxfDzDh;
|
||||
}
|
||||
|
||||
public void setEinvoiceShowGxfDzDh(String einvoiceShowGxfDzDh) {
|
||||
this.einvoiceShowGxfDzDh = einvoiceShowGxfDzDh;
|
||||
}
|
||||
|
||||
public String getEinvoiceShowGxfYhZh() {
|
||||
return einvoiceShowGxfYhZh;
|
||||
}
|
||||
|
||||
public void setEinvoiceShowGxfYhZh(String einvoiceShowGxfYhZh) {
|
||||
this.einvoiceShowGxfYhZh = einvoiceShowGxfYhZh;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
|
|
|
@ -0,0 +1,694 @@
|
|||
package nccloud.openapi.imag.invoice.tax;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
|
||||
import nc.bs.framework.common.NCLocator;
|
||||
import nc.dto.imag.boot.RequestInfo;
|
||||
import nc.dto.imag.boot.ResponseInfo;
|
||||
import nc.dto.imag.invoice.accountentry.AccountEntryCommonRequest;
|
||||
import nc.dto.imag.invoice.accountentry.AccountEntryCommonResponse;
|
||||
import nc.dto.imag.invoice.reimbursed.ReimbursedCommonRequest;
|
||||
import nc.dto.imag.invoice.reimbursed.ReimbursedCommonResponse;
|
||||
import nc.dto.imag.invoice.tax.AllInvoiceDeleteCommonRequest;
|
||||
import nc.dto.imag.invoice.tax.EInvoiceCommonRequest;
|
||||
import nc.dto.imag.invoice.tax.EInvoiceCommonResponse;
|
||||
import nc.dto.imag.invoice.tax.InvalidCommonRequest;
|
||||
import nc.dto.imag.invoice.tax.InvalidCommonResponse;
|
||||
import nc.dto.imag.invoice.tax.TaxAllInvoiceRequest;
|
||||
import nc.dto.imag.invoice.tax.TaxCommonRequest;
|
||||
import nc.dto.imag.invoice.tax.TaxCommonResponse;
|
||||
import nc.dto.imag.invoice.view.PreviewCommonRequest;
|
||||
import nc.dto.imag.invoice.view.PreviewCommonResponse;
|
||||
import nc.itf.openapi.invoice.tax.IEInvoiceService;
|
||||
import nc.itf.openapi.invoice.tax.ITaxInvoiceService;
|
||||
import nc.itf.uap.IUAPQueryBS;
|
||||
import nc.vo.image.log.ImageLogBusiTypeEnum;
|
||||
import nc.vo.image.log.ImageLogUtil;
|
||||
import nccloud.api.rest.utils.NCCRestUtils;
|
||||
import nccloud.openapi.imag.ImageOpenApiResources;
|
||||
import nccloud.openapi.imag.service.ImagOpenApiServiceLocator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import nc.dto.imag.invoice.tax.InvoiceDeleteCommonRequest;
|
||||
import nc.itf.sscivm.service.IInvoiceUploadService;
|
||||
import nc.itf.sscivm.service.IVMInvoiceQueryService;
|
||||
import nc.jdbc.framework.processor.ColumnProcessor;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nc.vo.sscivm.invoice.IVMInvoiceAggVO;
|
||||
import nccloud.api.rest.utils.ResultMessageUtil;
|
||||
import nccloud.commons.lang.StringUtils;
|
||||
import nccloud.itf.sscivm.ivrec.service.IVRecService;
|
||||
import org.json.JSONString;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.json.JSONString;
|
||||
|
||||
/**
|
||||
* openapi 影像税务服务
|
||||
*
|
||||
* @author gaozhf@yonyou.com
|
||||
*
|
||||
*/
|
||||
@Path("imag/invoice/tax")
|
||||
public class InvoiceTaxResources extends ImageOpenApiResources {
|
||||
@SuppressWarnings("unchecked")
|
||||
@POST
|
||||
@Path("uploadeinvoice")
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
public JSONString uploadEInvoice(RequestInfo<EInvoiceCommonRequest> request) {
|
||||
ResponseInfo<EInvoiceCommonResponse> response = new ResponseInfo<EInvoiceCommonResponse>();
|
||||
try {
|
||||
response = ImagOpenApiServiceLocator.find(IEInvoiceService.class).uploadEInvoice(request);
|
||||
|
||||
} catch (Exception e) {
|
||||
// 日志落库
|
||||
ImageLogUtil.insertErrorLog(e);
|
||||
|
||||
response = (ResponseInfo<EInvoiceCommonResponse>) parseErrorMessage(e);
|
||||
} finally{
|
||||
// 日志落库
|
||||
ImageLogUtil.insertMainLog(ImageLogBusiTypeEnum.UPLOAD_EINVOICE, request, response);
|
||||
}
|
||||
|
||||
return NCCRestUtils.toJSONString(response);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@POST
|
||||
@Path("deleteeinvoice")
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
public JSONString deleteEInvoice(RequestInfo<EInvoiceCommonRequest> request) {
|
||||
ResponseInfo<EInvoiceCommonResponse> response = new ResponseInfo<EInvoiceCommonResponse>();
|
||||
try {
|
||||
response = ImagOpenApiServiceLocator.find(IEInvoiceService.class).deleteEInvoice(request);
|
||||
|
||||
} catch (Exception e) {
|
||||
// 日志落库
|
||||
ImageLogUtil.insertErrorLog(e);
|
||||
|
||||
response = (ResponseInfo<EInvoiceCommonResponse>) parseErrorMessage(e);
|
||||
|
||||
} finally{
|
||||
// 日志落库
|
||||
ImageLogUtil.insertMainLog(ImageLogBusiTypeEnum.DELETE_EINVOICE, request, response);
|
||||
}
|
||||
|
||||
return NCCRestUtils.toJSONString(response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发票全票面上传入口(新)
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("upload_allinvoice")
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
public JSONString doUploadForAllInvoice(RequestInfo<TaxAllInvoiceRequest[]> request) {
|
||||
|
||||
ResponseInfo<TaxCommonResponse[]> response = null;
|
||||
Object result = null;
|
||||
|
||||
try {
|
||||
|
||||
response = ImagOpenApiServiceLocator.find(ITaxInvoiceService.class).doUploadForAllInvoice(request, true);
|
||||
|
||||
result = buildSucessResponseInfo(response);
|
||||
|
||||
} catch (Exception e) {
|
||||
// 日志落库
|
||||
ImageLogUtil.insertErrorLog(e);
|
||||
|
||||
result = parseErrorMessage(e);
|
||||
}finally{
|
||||
// 日志落库
|
||||
ImageLogUtil.insertMainLog(ImageLogBusiTypeEnum.SAVE_ALLINVOICE, request, result);
|
||||
}
|
||||
|
||||
return NCCRestUtils.toJSONString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 增值税发票上传入口(旧)
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("upload")
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
public JSONString doUpload(RequestInfo<TaxCommonRequest[]> request) {
|
||||
|
||||
ResponseInfo<TaxCommonResponse[]> response = null;
|
||||
Object result = null;
|
||||
|
||||
try {
|
||||
|
||||
response = ImagOpenApiServiceLocator.find(ITaxInvoiceService.class).doUploadForVATInvoice(request, true);
|
||||
|
||||
result = buildSucessResponseInfo(response);
|
||||
|
||||
} catch (Exception e) {
|
||||
// 日志落库
|
||||
ImageLogUtil.insertErrorLog(e);
|
||||
|
||||
result = parseErrorMessage(e);
|
||||
}finally{
|
||||
// 日志落库
|
||||
ImageLogUtil.insertMainLog(ImageLogBusiTypeEnum.SAVE, request, result);
|
||||
}
|
||||
|
||||
return NCCRestUtils.toJSONString(result);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("uploadtotax")
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
public JSONString doUploadToTax(RequestInfo<TaxCommonRequest[]> request) {
|
||||
|
||||
ResponseInfo<TaxCommonResponse[]> response = null;
|
||||
|
||||
try {
|
||||
response = ImagOpenApiServiceLocator.find(ITaxInvoiceService.class).doUploadToTax(request);
|
||||
} catch (Exception e) {
|
||||
return NCCRestUtils.toJSONString(parseErrorMessage(e));
|
||||
}
|
||||
|
||||
return NCCRestUtils.toJSONString(buildSucessResponseInfo(response));
|
||||
}
|
||||
|
||||
/**
|
||||
* 全票面发票删除入口
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("delete_allinvoice")
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
public JSONString doDeleteForAllInvoice(RequestInfo<TaxAllInvoiceRequest[]> request) {
|
||||
|
||||
ResponseInfo<TaxCommonResponse[]> response = null;
|
||||
Object result = null;
|
||||
|
||||
try {
|
||||
response = ImagOpenApiServiceLocator.find(ITaxInvoiceService.class).doDeleteForAllInvoice(request);
|
||||
|
||||
result = buildSucessResponseInfo(response);
|
||||
|
||||
} catch (Exception e) {
|
||||
// 日志落库
|
||||
ImageLogUtil.insertErrorLog(e);
|
||||
|
||||
result = parseErrorMessage(e);
|
||||
}finally{
|
||||
// 日志落库
|
||||
ImageLogUtil.insertMainLog(ImageLogBusiTypeEnum.FACTORY_DELETE_IMAGE_ALLINVOICE, request, result);
|
||||
}
|
||||
|
||||
return NCCRestUtils.toJSONString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 全票面发票删除入口(旧)
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("delete")
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
public JSONString doDelete(RequestInfo<TaxCommonRequest[]> request) {
|
||||
|
||||
ResponseInfo<TaxCommonResponse[]> response = null;
|
||||
Object result = null;
|
||||
|
||||
try {
|
||||
response = ImagOpenApiServiceLocator.find(ITaxInvoiceService.class).doDeleteForVATInvoice(request);
|
||||
|
||||
result = buildSucessResponseInfo(response);
|
||||
|
||||
} catch (Exception e) {
|
||||
// 日志落库
|
||||
ImageLogUtil.insertErrorLog(e);
|
||||
|
||||
result = parseErrorMessage(e);
|
||||
}finally{
|
||||
// 日志落库
|
||||
ImageLogUtil.insertMainLog(ImageLogBusiTypeEnum.FACTORY_DELETE_IMAGE, request, result);
|
||||
}
|
||||
|
||||
return NCCRestUtils.toJSONString(result);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("deletetotax")
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
public JSONString doDeleteToTax(RequestInfo<AllInvoiceDeleteCommonRequest[]> request) {
|
||||
|
||||
ResponseInfo<TaxCommonResponse[]> response = null;
|
||||
|
||||
try {
|
||||
response = ImagOpenApiServiceLocator.find(ITaxInvoiceService.class).doDeleteToTax(request);
|
||||
} catch (Exception e) {
|
||||
return NCCRestUtils.toJSONString(parseErrorMessage(e));
|
||||
}
|
||||
|
||||
return NCCRestUtils.toJSONString(buildSucessResponseInfo(response));
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("reimbursed")
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
public JSONString doReimbursed(RequestInfo<ReimbursedCommonRequest[]> request) {
|
||||
|
||||
ResponseInfo<ReimbursedCommonResponse> response = null;
|
||||
|
||||
try {
|
||||
response = ImagOpenApiServiceLocator.find(ITaxInvoiceService.class).doReimbursed(request);
|
||||
} catch (Exception e) {
|
||||
return NCCRestUtils.toJSONString(parseErrorMessage(e));
|
||||
}
|
||||
|
||||
return NCCRestUtils.toJSONString(buildSucessResponseInfo(response));
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("unreimbursed")
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
public JSONString doUnReimbursed(RequestInfo<ReimbursedCommonRequest[]> request) {
|
||||
|
||||
ResponseInfo<ReimbursedCommonResponse> response = null;
|
||||
|
||||
try {
|
||||
response = ImagOpenApiServiceLocator.find(ITaxInvoiceService.class).doUnReimbursed(request);
|
||||
} catch (Exception e) {
|
||||
return NCCRestUtils.toJSONString(parseErrorMessage(e));
|
||||
}
|
||||
|
||||
return NCCRestUtils.toJSONString(buildSucessResponseInfo(response));
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("accountentry")
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
public JSONString doAccountEntry(RequestInfo<AccountEntryCommonRequest[]> request) {
|
||||
|
||||
ResponseInfo<AccountEntryCommonResponse> response = null;
|
||||
|
||||
try {
|
||||
response = ImagOpenApiServiceLocator.find(ITaxInvoiceService.class).doAccountEntry(request);
|
||||
} catch (Exception e) {
|
||||
return NCCRestUtils.toJSONString(parseErrorMessage(e));
|
||||
}
|
||||
|
||||
return NCCRestUtils.toJSONString(buildSucessResponseInfo(response));
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("cancelaccountentry")
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
public JSONString doCancelAccountEntry(RequestInfo<AccountEntryCommonRequest[]> request) {
|
||||
|
||||
ResponseInfo<AccountEntryCommonResponse> response = null;
|
||||
|
||||
try {
|
||||
response = ImagOpenApiServiceLocator.find(ITaxInvoiceService.class).doCancelAccountEntry(request);
|
||||
} catch (Exception e) {
|
||||
return NCCRestUtils.toJSONString(parseErrorMessage(e));
|
||||
}
|
||||
|
||||
return NCCRestUtils.toJSONString(buildSucessResponseInfo(response));
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("preview")
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
public JSONString doPreview(RequestInfo<PreviewCommonRequest[]> request) {
|
||||
|
||||
ResponseInfo<PreviewCommonResponse> response = null;
|
||||
|
||||
try {
|
||||
response = ImagOpenApiServiceLocator.find(ITaxInvoiceService.class).doPreview(request);
|
||||
} catch (Exception e) {
|
||||
return NCCRestUtils.toJSONString(parseErrorMessage(e));
|
||||
}
|
||||
|
||||
return NCCRestUtils.toJSONString(buildSucessResponseInfo(response));
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("invalid")
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
public JSONString doInvalid(RequestInfo<InvalidCommonRequest> request) {
|
||||
|
||||
ResponseInfo<InvalidCommonResponse> response = null;
|
||||
|
||||
try {
|
||||
response = ImagOpenApiServiceLocator.find(ITaxInvoiceService.class).invoiceInvalid(request);
|
||||
} catch (Exception e) {
|
||||
return NCCRestUtils.toJSONString(parseErrorMessage(e));
|
||||
}
|
||||
|
||||
return NCCRestUtils.toJSONString(buildSucessResponseInfo(response));
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("dzfpupload")
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
public JSONString doDzfpUpload(JSONString json) {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
Map<String, Object> res = new HashMap<String, Object>();
|
||||
|
||||
res.put("code", "0000");
|
||||
try {
|
||||
JSONObject jObject = JSON.parseObject(json.toJSONString());
|
||||
if (jObject == null) {
|
||||
res.put("success", false);
|
||||
res.put("message", "JSONString is null ");
|
||||
|
||||
return NCCRestUtils.toJSONString(res);
|
||||
}
|
||||
String pk_org = jObject.getString("pk_org");// 财务组织主键
|
||||
if (StringUtils.isBlank(pk_org)) {
|
||||
res.put("success", false);
|
||||
res.put("message", "财务组织主键(pk_org)不能为空 ");
|
||||
|
||||
return NCCRestUtils.toJSONString(res);
|
||||
}
|
||||
|
||||
String pk_bill = jObject.getString("billid");// 单据主键
|
||||
if (StringUtils.isBlank(pk_bill)) {
|
||||
res.put("success", false);
|
||||
res.put("message", "单据主键(billid)不能为空 ");
|
||||
|
||||
|
||||
return NCCRestUtils.toJSONString(res);
|
||||
}
|
||||
|
||||
String billtype = jObject.getString("billtype");// 单据类型编码
|
||||
if (StringUtils.isBlank(billtype)) {
|
||||
res.put("success", false);
|
||||
res.put("message", "单据类型编码(billtype)不能为空 ");
|
||||
|
||||
return NCCRestUtils.toJSONString(res);
|
||||
}
|
||||
|
||||
|
||||
String transitype = jObject.getString("transitype");// 交易类型编码
|
||||
|
||||
if (StringUtils.isBlank(transitype)) {
|
||||
transitype=getTradeTypeCode(billtype,pk_bill);
|
||||
}
|
||||
// String tradetype=getTradeTypeCode(billtype,pk_bill);
|
||||
|
||||
|
||||
|
||||
JSONArray jsrr= jObject.getJSONArray("data");
|
||||
if(jsrr.isEmpty()) {
|
||||
res.put("success", false);
|
||||
res.put("message", "电子发票源文件(file)不能为空");
|
||||
|
||||
return NCCRestUtils.toJSONString(res);
|
||||
}
|
||||
|
||||
int i_true=0;
|
||||
|
||||
ArrayList<Map<String, Object>> l_true=new ArrayList<>();
|
||||
ArrayList<Map<String, Object>> l_false=new ArrayList<>();
|
||||
for (int i = 0; i < jsrr.size(); i++) {
|
||||
|
||||
JSONObject nodeinsTodo = jsrr.getJSONObject(i);
|
||||
|
||||
String fileContent = nodeinsTodo.getString("file");// 电子发票源文件
|
||||
if (StringUtils.isBlank(fileContent)) {
|
||||
res.put("success", false);
|
||||
res.put("message", "电子发票源文件(file)不能为空");
|
||||
|
||||
|
||||
|
||||
return NCCRestUtils.toJSONString(res);
|
||||
}
|
||||
|
||||
String filename = nodeinsTodo.getString("filename");// 文件名称
|
||||
if (filename == null) {
|
||||
filename = pk_bill+String.valueOf(i+1);
|
||||
}
|
||||
|
||||
|
||||
Map<String, Object> result = NCLocator.getInstance().lookup(IInvoiceUploadService.class).upload(pk_org, pk_bill, billtype,transitype, filename, fileContent);
|
||||
|
||||
|
||||
if (result.get("success") == null||(boolean) result.get("success")) {
|
||||
res.put("success", true);
|
||||
i_true++;
|
||||
l_true.add((Map<String, Object>) result.get("data"));
|
||||
}else {
|
||||
|
||||
Map<String, Object> f_map =( Map<String, Object>) result.get("data");
|
||||
f_map.put("message", result.get("message"));
|
||||
|
||||
|
||||
l_false.add(f_map);
|
||||
}
|
||||
|
||||
|
||||
// String add_json = objectMapper.writeValueAsString(result);
|
||||
|
||||
}
|
||||
|
||||
if(i_true== jsrr.size()) {
|
||||
res.put("code", "0000");
|
||||
res.put("message", "请求成功");
|
||||
res.put("success", true);
|
||||
if(!l_true.isEmpty()) {
|
||||
res.put("tdata", l_true);
|
||||
}
|
||||
|
||||
}else {
|
||||
res.put("success", false);
|
||||
if(i_true==0) {
|
||||
res.put("message", "上传失败");
|
||||
}else {
|
||||
res.put("message", "部分成功");
|
||||
}
|
||||
// result.put("message", "部分成功");
|
||||
if(!l_true.isEmpty()) {
|
||||
res.put("tdata", l_true);
|
||||
}
|
||||
if(!l_false.isEmpty()) {
|
||||
res.put("fdata", l_false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// String fileContent = jObject.getString("file");// 电子发票源文件
|
||||
// if (StringUtils.isBlank(fileContent)) {
|
||||
// result.put("success", false);
|
||||
// result.put("message", "电子发票源文件(file)不能为空");
|
||||
// return NCCRestUtils.toJSONString(result);
|
||||
// }
|
||||
//
|
||||
// String filename = jObject.getString("filename");// 文件名称
|
||||
// if (filename == null) {
|
||||
// filename = pk_bill;
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// result = NCLocator.getInstance().lookup(IInvoiceUploadService.class).upload(pk_org, pk_bill, billtype,tradetype, filename, fileContent);
|
||||
//
|
||||
//
|
||||
// if (result.get("success") == null) {
|
||||
// result.put("success", true);
|
||||
// }
|
||||
//
|
||||
String add_json = objectMapper.writeValueAsString(res);
|
||||
|
||||
|
||||
return NCCRestUtils.toJSONString(add_json);
|
||||
|
||||
} catch (JsonProcessingException e) {
|
||||
// TODO Auto-generated catch block
|
||||
// e.printStackTrace();
|
||||
// return NCCRestUtils.toJSONString(e.getMessage());
|
||||
return NCCRestUtils.toJSONString(parseErrorMessage(e));
|
||||
} catch (BusinessException e) {
|
||||
// TODO Auto-generated catch block
|
||||
// e.printStackTrace();
|
||||
return NCCRestUtils.toJSONString(parseErrorMessage(e));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("dzfpdelete")
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
public JSONString doDzfpDelete(JSONString json) {
|
||||
JSONObject jObject = JSON.parseObject(json.toJSONString());
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
result.put("code", "0000");
|
||||
try {
|
||||
if (jObject == null) {
|
||||
result.put("success", false);
|
||||
result.put("message", "JSONString is null ");
|
||||
|
||||
|
||||
return NCCRestUtils.toJSONString(result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
JSONArray jsrr= jObject.getJSONArray("data");
|
||||
if(jsrr.isEmpty()) {
|
||||
result.put("success", false);
|
||||
result.put("message", "参数错误");
|
||||
|
||||
|
||||
return NCCRestUtils.toJSONString(result);
|
||||
}
|
||||
|
||||
ArrayList<Map<String, Object>> l_false=new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < jsrr.size(); i++) {
|
||||
JSONObject nodeinsTodo = jsrr.getJSONObject(i);
|
||||
|
||||
|
||||
|
||||
String fphm = nodeinsTodo.getString("fpHm");// 发票号码
|
||||
if (StringUtils.isBlank(fphm)) {
|
||||
result.put("success", false);
|
||||
result.put("message", "发票号码(fpHm)不能为空");
|
||||
|
||||
|
||||
|
||||
return NCCRestUtils.toJSONString(result);
|
||||
}
|
||||
|
||||
String fpdm = nodeinsTodo.getString("fpDm");// 发票代码
|
||||
String condition = "";
|
||||
if (StringUtils.isBlank(fpdm)) {
|
||||
condition = "fphm = '" + fphm + "' and dr = 0 ";
|
||||
} else {
|
||||
condition = "fphm = '" + fphm + "' and fpdm = '" + fpdm + "' and dr = 0 ";
|
||||
}
|
||||
|
||||
|
||||
IVMInvoiceAggVO[] invoices = NCLocator.getInstance().lookup(IVMInvoiceQueryService.class).queryAggVOsByCondition(condition);
|
||||
if (invoices != null && invoices.length > 0) {
|
||||
String pk_invoice = invoices[0].getHeadVO().getPk_invoice();
|
||||
ArrayList<String> l = new ArrayList<>();
|
||||
l.add(pk_invoice);
|
||||
boolean bool = NCLocator.getInstance().lookup(IVRecService.class).deleteIVMInvoices(l.toArray(new String[0]));
|
||||
// result.put("success", bool);
|
||||
// result.put("code", "0000");
|
||||
// String add_json = objectMapper.writeValueAsString(result);
|
||||
// return NCCRestUtils.toJSONString(add_json);
|
||||
|
||||
if(!bool) {
|
||||
Map<String, Object> map_f = new HashMap<>();
|
||||
map_f.put("fphm", fphm);
|
||||
if (StringUtils.isBlank(fpdm)) {
|
||||
map_f.put("fpdm", "");
|
||||
}else {
|
||||
map_f.put("fpdm", fpdm);
|
||||
}
|
||||
l_false.add(map_f);
|
||||
}
|
||||
|
||||
} else {
|
||||
Map<String, Object> map_f = new HashMap<>();
|
||||
map_f.put("fphm", fphm);
|
||||
if (StringUtils.isBlank(fpdm)) {
|
||||
map_f.put("fpdm", "");
|
||||
}else {
|
||||
map_f.put("fpdm", fpdm);
|
||||
}
|
||||
l_false.add(map_f);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!l_false.isEmpty()) {
|
||||
result.put("success", false);
|
||||
result.put("code", "0000");
|
||||
result.put("fdata", l_false);
|
||||
}else {
|
||||
result.put("success", true);
|
||||
result.put("code", "0000");
|
||||
}
|
||||
|
||||
|
||||
String add_json = objectMapper.writeValueAsString(result);
|
||||
|
||||
return NCCRestUtils.toJSONString(add_json);
|
||||
// return NCCRestUtils.toJSONString(add_json);
|
||||
|
||||
|
||||
} catch (BusinessException e) {
|
||||
// TODO Auto-generated catch block
|
||||
// e.printStackTrace();
|
||||
return NCCRestUtils.toJSONString(parseErrorMessage(e));
|
||||
}catch (JsonProcessingException e) {
|
||||
// TODO Auto-generated catch block
|
||||
// e.printStackTrace();
|
||||
return NCCRestUtils.toJSONString(parseErrorMessage(e));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private String getTradeTypeCode(String billtype,String billid) throws BusinessException {
|
||||
|
||||
String sql="";
|
||||
|
||||
if(billtype.startsWith("264")) {//报销
|
||||
sql="select djlxbm from er_bxzb where dr=0 and pk_jkbx='"+billid+"'";
|
||||
}else if(billtype.equals("F1")) {//应付单
|
||||
sql="select pk_tradetype From ap_payablebill where isnull(dr, 0)=0 and pk_payablebill='"+billid+"'";
|
||||
}
|
||||
|
||||
|
||||
String tradetypecode = (String)getQueryService().executeQuery(sql, new ColumnProcessor());
|
||||
return tradetypecode;
|
||||
}
|
||||
|
||||
|
||||
public IUAPQueryBS getQueryService() {
|
||||
return NCLocator.getInstance().lookup(IUAPQueryBS.class);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getModule() {
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -3,14 +3,20 @@ package nc.bs.mmpac.pmo.pac0002.bp.rule;
|
|||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import nc.bs.dao.DAOException;
|
||||
import nc.bs.framework.common.NCLocator;
|
||||
import nc.bs.trade.business.HYSuperDMO;
|
||||
import nc.impl.pubapp.pattern.rule.IRule;
|
||||
import nc.itf.uap.IUAPQueryBS;
|
||||
import nc.itf.uif.pub.IUifService;
|
||||
import nc.jdbc.framework.processor.ColumnProcessor;
|
||||
import nc.jdbc.framework.processor.MapProcessor;
|
||||
import nc.vo.bd.defdoc.DefdocVO;
|
||||
import nc.vo.ic.m4c.entity.SaleOutHeadVO;
|
||||
import nc.vo.mmpac.pmo.pac0002.entity.PMOAggVO;
|
||||
import nc.vo.mmpac.pmo.pac0002.entity.PMOHeadVO;
|
||||
|
@ -58,6 +64,16 @@ public class putBeforeCheckRule implements IRule<PMOAggVO> {
|
|||
|| valMap.get("pk_billtypecode").equals("30-Cxx-16")) {
|
||||
return;
|
||||
}
|
||||
|
||||
String code = valMap.get("code").toString();
|
||||
LocalDateTime dbilldate = LocalDateTime.parse(valMap.get("dbilldate").toString(),
|
||||
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
LocalDateTime targetDate1 = LocalDateTime.parse("2025-06-27 00:00:00",
|
||||
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
List<String> defMap = checkOrgCtrl1();
|
||||
if (!valMap.isEmpty()&& defMap.contains(code) && dbilldate.isBefore(targetDate1)) {
|
||||
return;
|
||||
}
|
||||
// ÀúÊ·Êý¾Ý²»¿¼ÂÇ
|
||||
String storedDateStr = (String) valMap.get("creationtime");
|
||||
String targetDateStr = "2024-12-31 00:00:00";
|
||||
|
@ -86,8 +102,9 @@ public class putBeforeCheckRule implements IRule<PMOAggVO> {
|
|||
|
||||
private Map<String, Object> getVbdef6(String vsrcbidStr) throws BusinessException {
|
||||
IUAPQueryBS queryBS = NCLocator.getInstance().lookup(IUAPQueryBS.class);
|
||||
String sql = " SELECT bt.pk_billtypecode,s.creationtime,b.vbdef12,d.nastnum FROM so_saleorder_b b\n"
|
||||
String sql = " SELECT org_salesorg.CODE ,s.dbilldate, bt.pk_billtypecode,s.creationtime,b.vbdef12,d.nastnum FROM so_saleorder_b b\n"
|
||||
+ "INNER JOIN so_saleorder s ON s.csaleorderid = b.csaleorderid\n"
|
||||
+ " LEFT JOIN org_salesorg ON org_salesorg.PK_SALESORG = s.PK_ORG "
|
||||
+ "left join (select mm_mo.Vsrcbid,sum(nastnum) as nastnum \n" + "from mm_mo\n" + "where mm_mo.dr=0\n"
|
||||
+ "group by mm_mo.Vsrcbid) d on b.csaleorderbid=d.Vsrcbid\n"
|
||||
+ "INNER JOIN bd_billtype bt on bt.pk_billtypeid=s.ctrantypeid\n" + "where b.csaleorderbid='"
|
||||
|
@ -106,4 +123,21 @@ public class putBeforeCheckRule implements IRule<PMOAggVO> {
|
|||
public IUAPQueryBS getQueryService() {
|
||||
return NCLocator.getInstance().lookup(IUAPQueryBS.class);
|
||||
}
|
||||
private List<String> checkOrgCtrl1() {
|
||||
List<String> list = new ArrayList<>();
|
||||
String strWhere = " pk_defdoclist in (select pk_defdoclist from bd_defdoclist where code='org-ctrl' and dr=0 ) and dr=0";
|
||||
try {
|
||||
DefdocVO[] defdocVOs = (DefdocVO[]) new HYSuperDMO().queryByWhereClause(DefdocVO.class, strWhere);
|
||||
if (defdocVOs != null && defdocVOs.length > 0) {
|
||||
for (DefdocVO defdocVO : defdocVOs) {
|
||||
if(defdocVO.getCode().equals("pmol")){
|
||||
list= Arrays.stream(defdocVO.getMemo().split(",")).map(String::trim).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (DAOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,10 +17,8 @@ import nccloud.baseapp.core.log.NCCForUAPLogger;
|
|||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 流程生成订单保存时验证销售订单累计排产状态,并验收首付款比例 zhangxinah 适配2312
|
||||
|
@ -51,6 +49,15 @@ public class saveBeforeCheckRule implements IRule<PMOAggVO> {
|
|||
if (valMap == null || valMap.isEmpty()) {
|
||||
throw new BusinessException("无法关联到销售订单,无法保存!");
|
||||
}
|
||||
String code = valMap.get("code").toString();
|
||||
LocalDateTime dbilldate = LocalDateTime.parse(valMap.get("dbilldate").toString(),
|
||||
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
LocalDateTime targetDate1 = LocalDateTime.parse("2025-06-27 00:00:00",
|
||||
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
List<String> defMap = checkOrgCtrl1();
|
||||
if (!valMap.isEmpty()&& defMap.contains(code) && dbilldate.isBefore(targetDate1)) {
|
||||
return;
|
||||
}
|
||||
// 销售发票表头pk_billtypecode=30-Cxx-12
|
||||
if (valMap.get("pk_billtypecode").equals("30-Cxx-12")
|
||||
|| valMap.get("pk_billtypecode").equals("30-Cxx-02")
|
||||
|
@ -94,8 +101,9 @@ public class saveBeforeCheckRule implements IRule<PMOAggVO> {
|
|||
|
||||
private Map<String, Object> getVbdef6(String vsrcbidStr,String cmoid) throws BusinessException {
|
||||
IUAPQueryBS queryBS = NCLocator.getInstance().lookup(IUAPQueryBS.class);
|
||||
String sql = " SELECT bt.pk_billtypecode,s.creationtime,b.vbdef12,d.nastnum FROM so_saleorder_b b\n"
|
||||
String sql = " SELECT org_salesorg.CODE ,s.dbilldate, bt.pk_billtypecode,s.creationtime,b.vbdef12,d.nastnum FROM so_saleorder_b b\n"
|
||||
+ "INNER JOIN so_saleorder s ON s.csaleorderid = b.csaleorderid\n"
|
||||
+ " LEFT JOIN org_salesorg ON org_salesorg.PK_SALESORG = s.PK_ORG "
|
||||
+ "left join (select mm_mo.Vsrcbid,sum(nastnum) as nastnum \n" + "from mm_mo\n" + "where mm_mo.dr=0\n"+" and cmoid !='"+cmoid+ "' "
|
||||
+ "group by mm_mo.Vsrcbid) d on b.csaleorderbid=d.Vsrcbid\n"
|
||||
+ "INNER JOIN bd_billtype bt on bt.pk_billtypeid=s.ctrantypeid\n" + "where b.csaleorderbid='"
|
||||
|
@ -138,5 +146,21 @@ public class saveBeforeCheckRule implements IRule<PMOAggVO> {
|
|||
public IUAPQueryBS getQueryService() {
|
||||
return NCLocator.getInstance().lookup(IUAPQueryBS.class);
|
||||
}
|
||||
|
||||
private List<String> checkOrgCtrl1() {
|
||||
List<String> list = new ArrayList<>();
|
||||
String strWhere = " pk_defdoclist in (select pk_defdoclist from bd_defdoclist where code='org-ctrl' and dr=0 ) and dr=0";
|
||||
try {
|
||||
DefdocVO[] defdocVOs = (DefdocVO[]) new HYSuperDMO().queryByWhereClause(DefdocVO.class, strWhere);
|
||||
if (defdocVOs != null && defdocVOs.length > 0) {
|
||||
for (DefdocVO defdocVO : defdocVOs) {
|
||||
if(defdocVO.getCode().equals("pmol")){
|
||||
list= Arrays.stream(defdocVO.getMemo().split(",")).map(String::trim).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (DAOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,19 +7,31 @@ import nc.bs.framework.common.NCLocator;
|
|||
import nc.itf.so.m30.closemanage.ISaleOrderCloseManageMaintain;
|
||||
import nc.pubitf.so.m30.api.ISaleOrderQueryAPI;
|
||||
import nc.pubitf.uapbd.IRateTypePubService;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nc.vo.pub.lang.UFDateTime;
|
||||
import nc.vo.scmpub.util.CombineViewToAggUtil;
|
||||
import nc.vo.so.m30.entity.SaleOrderBVO;
|
||||
import nc.vo.so.m30.entity.SaleOrderHVO;
|
||||
import nc.vo.so.m30.entity.SaleOrderVO;
|
||||
import nc.vo.so.m30.entity.SaleOrderViewVO;
|
||||
import nccloud.api.rest.utils.IJsonForAPI;
|
||||
import nccloud.api.rest.utils.JsonFactoryForAPI;
|
||||
import nccloud.api.rest.utils.ResultMessageUtil;
|
||||
import nccloud.framework.core.json.IJson;
|
||||
import nccloud.framework.service.ServiceLocator;
|
||||
import nccloud.framework.web.json.JsonFactory;
|
||||
import nccloud.pubitf.arap.arappub.IArapBillPubUtilService;
|
||||
import nccloud.pubitf.scmpub.pub.batchopr.dto.ISCMBatchOprContext;
|
||||
import nccloud.pubitf.scmpub.pub.batchopr.dto.SCMBatchOprContext;
|
||||
import nccloud.pubitf.scmpub.pub.batchopr.dto.SCMBatchResultDTO;
|
||||
import nccloud.pubitf.so.saleorderclose.service.IQuerySaleOrderCloseService;
|
||||
import nccloud.pubitf.so.saleorderclose.service.ISaleOrderCloseMaintainService;
|
||||
import nccloud.pubitf.so.saleorderclose.utils.SaleOrderCloseUtils;
|
||||
import nccloud.util.so.TransBillUtil;
|
||||
import nccloud.web.scmpub.pub.resexp.PfResumeExceptionNccUtils;
|
||||
import nccloud.web.scmpub.pub.utils.SCMBatchOperatorResult;
|
||||
import nccloud.web.scmpub.pub.utils.batchopr.SCMBatchOperator;
|
||||
import nccloud.web.scmpub.vocheck.VOSagaFrozenCheck;
|
||||
import nccloud.web.so.saleorderclose.entity.SaleOrderCloseInfo;
|
||||
import nccloud.api.so.so.UpCloses.SaleOrderCloseUtil;
|
||||
import nccloud.ws.rest.resource.AbstractNCCRestResource;
|
||||
|
@ -29,6 +41,7 @@ import javax.ws.rs.Consumes;
|
|||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Path("so/so/Close")
|
||||
|
@ -111,10 +124,13 @@ public class CloseSoResource extends AbstractNCCRestResource {
|
|||
if (array.isEmpty()) {
|
||||
return ResultMessageUtil.exceptionToJSON(new NullPointerException("헝朞嶝饋簡땐데"));
|
||||
}
|
||||
String[] stringArray = new String[array.size()];
|
||||
|
||||
IJson json1 = JsonFactory.create();
|
||||
SaleOrderCloseInfo combineinfo = (SaleOrderCloseInfo)json1.fromJson(json.toJSONString(), SaleOrderCloseInfo.class);
|
||||
SaleOrderViewVO[] result = SaleOrderCloseUtil.buttonClick(combineinfo, "billOpen");
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
// 直接获取每个元素的字符串形式
|
||||
stringArray[i] = array.getString(i);
|
||||
}
|
||||
SaleOrderViewVO[] result = this.buttonClick(stringArray, "billOpen");
|
||||
if (result.length == 0 ){
|
||||
errojson.put("status", "0");
|
||||
errojson.put("message", "댔역呵겨");
|
||||
|
@ -151,4 +167,34 @@ public class CloseSoResource extends AbstractNCCRestResource {
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static SaleOrderViewVO[] buttonClick(String [] bids, String buttonType) throws BusinessException {
|
||||
SaleOrderViewVO[] vos = queryViewByBIDs(bids, "");
|
||||
CombineViewToAggUtil<SaleOrderVO> combineViewToAggUtil = new CombineViewToAggUtil(SaleOrderVO.class, SaleOrderHVO.class, SaleOrderBVO.class);
|
||||
SaleOrderVO[] bills = (SaleOrderVO[])combineViewToAggUtil.combineViewToAgg(vos, "csaleorderid");
|
||||
ISaleOrderCloseMaintainService service=NCLocator.getInstance()
|
||||
.lookup(ISaleOrderCloseMaintainService.class);
|
||||
SaleOrderViewVO[] saleOrderViewVOS= service.billOpen(bills,false);
|
||||
return saleOrderViewVOS;
|
||||
}
|
||||
|
||||
public static SaleOrderViewVO[] queryViewByBIDs(String[] bidts, String vclosereason) throws BusinessException {
|
||||
Map<String, UFDateTime> bid_ts = new HashMap();
|
||||
String[] bids = TransBillUtil.splitBidts(bidts, bid_ts);
|
||||
IQuerySaleOrderCloseService service = NCLocator.getInstance()
|
||||
.lookup(IQuerySaleOrderCloseService.class);
|
||||
SaleOrderViewVO[] vos = service.queryByIds(bids);
|
||||
TransBillUtil.fillBodyTs(vos, "csaleorderbid", bid_ts);
|
||||
SaleOrderCloseUtils.setCloseOpenReason(vos, vclosereason);
|
||||
return vos;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1333,49 +1333,9 @@ public class InvoiceTransferUtil {
|
|||
pinvoice.setCjh(headvo.getCjh());
|
||||
// pinvoice.setKqysssxbgglbm(headvo.getKqysssxbgglbm());
|
||||
|
||||
setOtherField(headvo, pinvoice);
|
||||
return pinvoice;
|
||||
}
|
||||
|
||||
private static void setOtherField(IVApplicationHeadVO headvo, PInvoice pinvoice) {
|
||||
// 是否展示销售方开户银行及账号 Y-是/N-否
|
||||
String def3 = headvo.getDef3();
|
||||
// 是否展示销售方地址电话
|
||||
String def4 = headvo.getDef4();
|
||||
// 是否填写收款人及复核人
|
||||
String def16 = headvo.getDef16();
|
||||
// 是否展示购买方单位、地址电话
|
||||
String def17 = headvo.getDef17();
|
||||
// 是否展示购买方开户行、银行账号
|
||||
String def18 = headvo.getDef18();
|
||||
|
||||
// einvoiceShowGxfDzDh 表示是否显示购方和销方的地址电话
|
||||
// 根据需求:0: 不显示 1: 显示购方地址电话 2: 显示销方地址电话 3: 显示购方和销方地址电话
|
||||
int einvoiceShowGxfDzDh = 0;
|
||||
|
||||
if ("Y".equals(def3)) {
|
||||
einvoiceShowGxfDzDh += 1; // 购方地址电话显示
|
||||
}
|
||||
if ("Y".equals(def17)) {
|
||||
einvoiceShowGxfDzDh += 2; // 销方地址电话显示
|
||||
}
|
||||
|
||||
// einvoiceShowGxfYhZh 表示是否显示购方和销方的小银行账户
|
||||
// 根据需求:0: 不显示 1: 显示购方银行账户 2: 显示销方银行账户 3: 显示购方和销方银行账户
|
||||
int einvoiceShowGxfYhZh = 0;
|
||||
|
||||
if ("Y".equals(def4)) {
|
||||
einvoiceShowGxfYhZh += 1; // 购方银行账户显示
|
||||
}
|
||||
if ("Y".equals(def18)) {
|
||||
einvoiceShowGxfYhZh += 2; // 销方银行账户显示
|
||||
}
|
||||
// 数电发票是否显示购销方地址电话 0:不显示 1:仅显示销地址、电话 2:仅显示购买方地址、电话 3:购销方地址、电话都显示
|
||||
pinvoice.setEinvoiceShowGxfDzDh(String.valueOf(einvoiceShowGxfDzDh));
|
||||
// 数电发票是否显示购销方银行、账号: 0:不显示 1:仅显示销售方银行、账号 2:仅显示购买方银行、账号 3:购销方银行、账号都显示
|
||||
pinvoice.setEinvoiceShowGxfYhZh(String.valueOf(einvoiceShowGxfYhZh));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据红冲申请转换成发票平台VO
|
||||
*
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package nc.itf.sscivm.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nc.vo.sscivm.invoice.IVMInvoiceFileVO;
|
||||
|
||||
public interface IInvoiceUploadService {
|
||||
Map<String, Object> upload(String paramString1, String paramString2, String paramString3, String paramString4, String paramString5, String paramString6, boolean paramBoolean, String paramString7);
|
||||
|
||||
List<Map<String, Object>> uploadInvoice(String paramString1, String paramString2, String paramString3, String paramString4, String paramString5, String paramString6, IVMInvoiceFileVO paramIVMInvoiceFileVO);
|
||||
|
||||
IVMInvoiceFileVO uploadFile(String paramString1, String paramString2, String paramString3, String paramString4) throws BusinessException;
|
||||
|
||||
Map<String, Object> reVerifyAnduploadInvoice(String paramString1, String paramString2, String paramString3, String paramString4, String paramString5, JSONObject paramJSONObject);
|
||||
|
||||
Map<String, Object> reUploadInvoice(String paramString1, String paramString2, String paramString3, String paramString4, String paramString5, String paramString6, int paramInt, JSONObject paramJSONObject);
|
||||
|
||||
List<Map<String, Object>> queryInvoices(String paramString);
|
||||
|
||||
Map<String, Object> upload(String pk_org, String pk_bill, String billtype, String transitype, String filename,
|
||||
String fileContent);
|
||||
}
|
||||
|
|
@ -83,11 +83,25 @@ public class BillDateCheckListener implements IBusinessListener {
|
|||
Calendar maxDateCal = Calendar.getInstance();
|
||||
maxDateCal.set(currentYear, currentMonth, 24); // 本月24号
|
||||
maxDateCal.add(Calendar.DATE, 10); // 24号+10天
|
||||
maxDateCal.set(Calendar.HOUR_OF_DAY, 0); // 清除时间部分
|
||||
maxDateCal.set(Calendar.MINUTE, 0); // 确保时间为00:00:00.000
|
||||
maxDateCal.set(Calendar.SECOND, 0);
|
||||
maxDateCal.set(Calendar.MILLISECOND, 0);
|
||||
|
||||
// 2. 计算下个月1号的最小允许日期
|
||||
Calendar minDateCal = Calendar.getInstance();
|
||||
minDateCal.set(currentYear, currentMonth, 1); // 本月1号
|
||||
minDateCal.add(Calendar.MONTH, 1); // 下个月1号
|
||||
minDateCal.set(Calendar.HOUR_OF_DAY, 0); // 清除时间部分
|
||||
minDateCal.set(Calendar.MINUTE, 0); // 确保时间为00:00:00.000
|
||||
minDateCal.set(Calendar.SECOND, 0);
|
||||
minDateCal.set(Calendar.MILLISECOND, 0);
|
||||
|
||||
// 3. 清除billCal的时间部分
|
||||
billCal.set(Calendar.HOUR_OF_DAY, 0);
|
||||
billCal.set(Calendar.MINUTE, 0);
|
||||
billCal.set(Calendar.SECOND, 0);
|
||||
billCal.set(Calendar.MILLISECOND, 0);
|
||||
|
||||
// 3. 检查单据日期是否在下个月范围内
|
||||
boolean isNextMonth = billCal.get(Calendar.MONTH) == minDateCal.get(Calendar.MONTH) &&
|
||||
|
|
|
@ -36,6 +36,12 @@ public class MaterialStockAsstsChangedListener implements IBusinessListener {
|
|||
return;
|
||||
}
|
||||
//如果库存信息生产厂商和项目被选中则 更新计划信息,生产信息和成本信息
|
||||
// if(newVO.getFixasst2() == null ){
|
||||
// newVO.setFixasst2(UFBoolean.valueOf("N"));
|
||||
// }
|
||||
// if(newVO.getFixasst4() == null ){
|
||||
// newVO.setFixasst4(UFBoolean.valueOf("N"));
|
||||
// }
|
||||
UFBoolean fixasst2 = newVO.getFixasst2();
|
||||
UFBoolean fixasst4 = newVO.getFixasst4();
|
||||
|
||||
|
@ -88,27 +94,51 @@ public class MaterialStockAsstsChangedListener implements IBusinessListener {
|
|||
"FROM " +
|
||||
" bd_materialcost " +
|
||||
"WHERE " +
|
||||
" pk_org = (SELECT PK_COSTREGION FROM org_cr_stockorg WHERE pk_stockorg= ?) or pk_org in (SELECT PK_COSTREGION FROM org_cr_stockstore WHERE pk_stockorg= ?) " +
|
||||
" (pk_org = (SELECT PK_COSTREGION FROM org_cr_stockorg WHERE pk_stockorg= ?) or pk_org in (SELECT PK_COSTREGION FROM org_cr_stockstore WHERE pk_stockorg= ? ) ) " +
|
||||
" AND " +
|
||||
" pk_material = ? ";
|
||||
SQLParameter param = new SQLParameter();
|
||||
param.addParam(pk_org);
|
||||
param.addParam(pk_org);
|
||||
param.addParam(pk_material);
|
||||
List list =( (List) this.getBaseDAO().executeQuery(sql, param, new ColumnListProcessor()));
|
||||
List list = ((List) this.getBaseDAO().executeQuery(sql, param, new ColumnListProcessor()));
|
||||
if(list.isEmpty()){
|
||||
return;
|
||||
}
|
||||
String pk_materialcost = list.get(0).toString();
|
||||
if(pk_materialcost == null){
|
||||
return;
|
||||
|
||||
// 构建用于 IN 子句的参数列表
|
||||
StringBuilder inClause = new StringBuilder();
|
||||
List<String> paramValues = new ArrayList<>();
|
||||
|
||||
for (Object obj : list) {
|
||||
String pk_materialcost = obj.toString();
|
||||
if (pk_materialcost == null) {
|
||||
continue; // 如果 pk_materialcost 为空,则跳过当前循环
|
||||
}
|
||||
inClause.append("?, ");
|
||||
paramValues.add(pk_materialcost);
|
||||
}
|
||||
//更新计价方式
|
||||
String update24 = "update bd_materialcostmod set marasst2 = ?,marasst4 = ? where pk_materialcost = ? ";
|
||||
|
||||
if (paramValues.isEmpty()) {
|
||||
return; // 如果没有有效的 pk_materialcost,则直接返回
|
||||
}
|
||||
|
||||
// 去掉最后一个多余的逗号
|
||||
inClause = new StringBuilder(inClause.substring(0, inClause.length() - 2));
|
||||
|
||||
// 更新计价方式
|
||||
String update24 = "UPDATE bd_materialcostmod SET marasst2 = ?, marasst4 = ? WHERE pk_materialcost IN (" + inClause + ")";
|
||||
SQLParameter param1 = new SQLParameter();
|
||||
param1.addParam(fixlist.get(0));
|
||||
|
||||
// 添加更新参数
|
||||
param1.addParam(fixlist.get(0)); // 假设 fixlist 已经正确初始化且包含至少两个元素
|
||||
param1.addParam(fixlist.get(1));
|
||||
param1.addParam(pk_materialcost);
|
||||
|
||||
// 添加 IN 子句的参数
|
||||
for (String value : paramValues) {
|
||||
param1.addParam(value);
|
||||
}
|
||||
|
||||
this.getBaseDAO().executeUpdate(update24, param1);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue