销售订单代码同步
This commit is contained in:
parent
9d7a73d84e
commit
ba3239fd59
|
|
@ -45,6 +45,7 @@ import nc.vo.scmpub.util.StringUtil;
|
|||
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.pub.SaleOrderVOCalculator;
|
||||
import nc.vo.so.m32.entity.SaleInvoiceBVO;
|
||||
import nc.vo.so.m32.entity.SaleInvoiceHVO;
|
||||
import nc.vo.so.pub.SOConstant;
|
||||
|
|
@ -420,40 +421,37 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain {
|
|||
addBvo(combinBillVOs, paramList);
|
||||
}
|
||||
}
|
||||
Map<Integer, UFDouble> map = new HashMap<>();
|
||||
Map<Integer, String> map2 = new HashMap<>();
|
||||
for (SaleOrderVO vo : combinBillVOs) {
|
||||
int i = 0;
|
||||
SaleOrderBVO[] bvos = vo.getChildrenVO();
|
||||
for (SaleOrderBVO bvo : bvos) {
|
||||
map.put(i, bvo.getNtaxrate());
|
||||
map2.put(i, bvo.getCtaxcodeid());
|
||||
i++;
|
||||
}
|
||||
}
|
||||
// 联动计算
|
||||
INumPriceMnyCalculator cal = new SaleOrderNPriceMnyCal<SaleOrderVO>(combinBillVOs);
|
||||
cal.calculate();
|
||||
for (SaleOrderVO vo : combinBillVOs) {
|
||||
SaleOrderHVO hvo = vo.getParentVO();
|
||||
SaleOrderHVO originHvo = null;
|
||||
for (SaleOrderVO originVo : originVos) {
|
||||
if (hvo.getCsaleorderid().equals(originVo.getParentVO().getCsaleorderid())) {
|
||||
originHvo = originVo.getParentVO();
|
||||
}
|
||||
}
|
||||
String new_ctrantypeid = hvo.getCtrantypeid();
|
||||
boolean isChangedTranType = false;// 订单类型不修改
|
||||
if (originHvo != null && new_ctrantypeid != null && !new_ctrantypeid.equals(originHvo.getCtrantypeid())) {
|
||||
isChangedTranType = true;
|
||||
}
|
||||
SaleOrderBVO[] bvos = vo.getChildrenVO();
|
||||
// 判断是否存在新增的子表
|
||||
boolean hasNewStatus = Arrays.stream(bvos).anyMatch(bvo -> bvo.getStatus() == VOStatus.NEW);
|
||||
// 新增子表或改订单类型的情况下不校验是否存在下游
|
||||
/*if (!hasNewStatus && !isChangedTranType) {
|
||||
String countSql = "SELECT count(1) FROM so_saleinvoice_b a"
|
||||
+ " LEFT JOIN so_saleinvoice b ON a.csaleinvoiceid = b.csaleinvoiceid"
|
||||
+ " WHERE b.fopposeflag = 0 AND nvl(b.dr, 0) = 0 and csrcid = '[csrcid]' ";
|
||||
countSql = countSql.replace("[csrcid]", hvo.getCsaleorderid());
|
||||
Integer num = (Integer) getDao().executeQuery(countSql, new ColumnProcessor());
|
||||
if (num > 0) {
|
||||
// fopposeflag 对冲标记 0=正常 1=已被对冲 2=对冲生成
|
||||
ExceptionUtils.wrappBusinessException("下游存在未红冲完成的销售发票");
|
||||
return null;
|
||||
}
|
||||
}*/
|
||||
int i = 0;
|
||||
for (SaleOrderBVO bvo : bvos) {
|
||||
bvo.setNtaxrate(map.get(i));
|
||||
bvo.setCtaxcodeid(map2.get(i));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
// 根据税率重新联动计算--专项问题
|
||||
for (SaleOrderVO vo : combinBillVOs) {
|
||||
SaleOrderVOCalculator cal1 = new SaleOrderVOCalculator(vo);
|
||||
for (int i = 0; i < vo.getChildrenVO().length; i++) {
|
||||
cal1.calculate(i, SaleOrderBVO.NTAXRATE);
|
||||
}
|
||||
}
|
||||
// 根据客户oid补充vid
|
||||
fillcustomervidbyoid(combinBillVOs);
|
||||
checkSaleOrderChange(combinBillVOs[0], originVos[0]);
|
||||
// 保存
|
||||
|
|
@ -640,6 +638,11 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain {
|
|||
// 折本汇率
|
||||
UFDouble nexchangerate = getUFDouble_NullAsOne(sourceBVO.getNexchangerate());
|
||||
targetBVO.setNexchangerate(nexchangerate);
|
||||
// 税率
|
||||
if (sourceBVO.getNtaxrate() != null) {
|
||||
UFDouble ntaxrate = sourceBVO.getNtaxrate();
|
||||
targetBVO.setNtaxrate(ntaxrate);
|
||||
}
|
||||
// 物料编码
|
||||
targetBVO.setCmaterialvid(sourceBVO.getCmaterialvid());
|
||||
String cmaterialvid = sourceBVO.getCmaterialvid();
|
||||
|
|
@ -747,6 +750,7 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain {
|
|||
// 主数量
|
||||
// UFDouble nnum = sourceBVO.getNnum().setScale(2, UFDouble.ROUND_HALF_UP);
|
||||
UFDouble nnum = sourceBVO.getNnum();
|
||||
targetBVO.setNnum(nnum);// 主数量
|
||||
// UFDouble nastnum = nnum.multiply(measrateNum).setScale(2,
|
||||
// UFDouble.ROUND_HALF_UP);
|
||||
UFDouble nastnum = nnum.multiply(measrateNum);
|
||||
|
|
@ -777,6 +781,14 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain {
|
|||
targetBVO.setVbdef20(sourceBVO.getVbdef20()); // 计划完工日期
|
||||
}
|
||||
targetBVO.setVbdef24(sourceBVO.getVbdef24()); // 计划评审日期
|
||||
targetBVO.setVrownote(sourceBVO.getVrownote()); // 备注
|
||||
|
||||
if(sourceBVO.getDsenddate()!=null) {
|
||||
targetBVO.setDsenddate(sourceBVO.getDsenddate()); // 发货日期
|
||||
}
|
||||
if(sourceBVO.getDreceivedate()!=null) {
|
||||
targetBVO.setDreceivedate(sourceBVO.getDreceivedate());//到货日期
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1254,6 +1266,15 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain {
|
|||
newBvo.setVbdef10(bodydata.getOrDefault("vbdef10", "~") + "");// 项目名称
|
||||
newBvo.setVbdef13(bodydata.getOrDefault("vbdef13", "~") + "");// 国网行项目号
|
||||
newBvo.setVbdef22(bodydata.getOrDefault("vbdef22", "~") + "");// 国内采购订单号
|
||||
if (bodydata.get("vbdef18") != null && !"".equals(bodydata.get("vbdef18")) && !"~".equals(bodydata.get("vbdef18"))) {
|
||||
newBvo.setVbdef18(bodydata.get("vbdef18") + "");// 是否定制
|
||||
}
|
||||
if (bodydata.get("vbdef19") != null && !"".equals(bodydata.get("vbdef19")) && !"~".equals(bodydata.get("vbdef19"))) {
|
||||
newBvo.setVbdef19(bodydata.get("vbdef19") + "");// 计划开工日期
|
||||
}
|
||||
if (bodydata.get("vbdef20") != null && !"".equals(bodydata.get("vbdef20")) && !"~".equals(bodydata.get("vbdef20"))) {
|
||||
newBvo.setVbdef20(bodydata.get("vbdef20") + "");// 计划完工日期
|
||||
}
|
||||
if (bodydata.get("vbdef24") != null && !"".equals(bodydata.get("vbdef24")) && !"~".equals(bodydata.get("vbdef24"))) {
|
||||
newBvo.setVbdef24(bodydata.get("vbdef24") + "");// 计划评审日期
|
||||
}
|
||||
|
|
@ -1808,6 +1829,7 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新关联的下游单据
|
||||
*
|
||||
|
|
@ -1821,7 +1843,7 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain {
|
|||
String ccustomerid = hvo.getCcustomerid();
|
||||
String ccustomervid = hvo.getCcustomervid();
|
||||
String cemployeeid = hvo.getCemployeeid();
|
||||
//zhangxinah 订单客户和开票客户同步核销明细表
|
||||
// zhangxinah 订单客户和开票客户同步核销明细表
|
||||
dealWithBalance(hvo);
|
||||
String cdeptid = hvo.getCdeptid();
|
||||
String cdeptvid = hvo.getCdeptvid();
|
||||
|
|
@ -1989,22 +2011,23 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain {
|
|||
|
||||
/**
|
||||
* zhangxinah 订单客户和开票客户同步核销明细表
|
||||
*
|
||||
* @param hvo
|
||||
*/
|
||||
private void dealWithBalance(SaleOrderHVO hvo) {
|
||||
String csaleorderid=hvo.getCsaleorderid();
|
||||
String ccustomerid = hvo.getCcustomerid();
|
||||
private void dealWithBalance(SaleOrderHVO hvo) {
|
||||
String csaleorderid = hvo.getCsaleorderid();
|
||||
String ccustomerid = hvo.getCcustomerid();
|
||||
String ccustomervid = hvo.getCcustomervid();
|
||||
String cinvoicecustid = hvo.getCinvoicecustid();
|
||||
String cinvoicecustvid = hvo.getCinvoicecustvid();
|
||||
//zhangxinah 订单客户和开票客户同步核销明细表
|
||||
// zhangxinah 订单客户和开票客户同步核销明细表
|
||||
// 构建并执行更新SQL
|
||||
String updateSql = "UPDATE so_balance SET "
|
||||
+ " ccustomerid = '[ccustomerid]', "
|
||||
+ " ccustomervid = '[ccustomervid]',"
|
||||
+ " cinvoicecustid = '[cinvoicecustid]',"
|
||||
+ " cinvoicecustvid = '[cinvoicecustvid]'"
|
||||
+ " WHERE csaleorderid = '[csaleorderid]'";
|
||||
+ " ccustomerid = '[ccustomerid]', "
|
||||
+ " ccustomervid = '[ccustomervid]',"
|
||||
+ " cinvoicecustid = '[cinvoicecustid]',"
|
||||
+ " cinvoicecustvid = '[cinvoicecustvid]'"
|
||||
+ " WHERE csaleorderid = '[csaleorderid]'";
|
||||
updateSql = updateSql.replace("[ccustomerid]", ccustomerid);
|
||||
updateSql = updateSql.replace("[ccustomervid]", ccustomervid);
|
||||
updateSql = updateSql.replace("[cinvoicecustid]", cinvoicecustid);
|
||||
|
|
@ -2016,6 +2039,6 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain {
|
|||
ExceptionUtils.wrappBusinessException("so-updateRelatedBill-exp: " + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue