销售订单修改接口新增删除物料行的逻辑调整
This commit is contained in:
parent
161e38087b
commit
392b00a900
|
@ -320,26 +320,16 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain {
|
|||
if (null == originVos || originVos.length == 0) {
|
||||
ExceptionUtils.wrappBusinessException("根据传入数据未匹配到相关数据");
|
||||
}
|
||||
|
||||
Map<String, String> delMap = new HashMap<>();
|
||||
for (Map<String, Object> objectMap : paramList) {
|
||||
Map<String, Object> headdata = (Map<String, Object>) objectMap.get(HEADTABLE);
|
||||
delMap.put(headdata.get("csaleorderid") + "", headdata.getOrDefault("delId", "") + "");
|
||||
List<Object> bodyArr = (List<Object>) objectMap.get(BODYTABLE);
|
||||
for (Object body : bodyArr) {
|
||||
Map<String, Object> bodydata = (Map<String, Object>) body;
|
||||
if (!(bodydata.getOrDefault("vbdef11", "") + "").isEmpty()) {
|
||||
String vbdef11 = bodydata.get("vbdef11") + "";
|
||||
String dr = bodydata.getOrDefault("dr", "0") + "";
|
||||
String csaleorderid = bodydata.get("csaleorderid") + "";
|
||||
String countSql = "SELECT count(1) FROM so_saleorder_b"
|
||||
+ " WHERE nvl(dr,0) = 0 and csaleorderid = '[csaleorderid]' and vbdef11 = '[vbdef11]' ";
|
||||
countSql = countSql.replace("[csaleorderid]", csaleorderid);
|
||||
countSql = countSql.replace("[vbdef11]", vbdef11);
|
||||
Integer num = (Integer) new BaseDAO().executeQuery(countSql, new ColumnProcessor());
|
||||
if ("0".equals(dr) && num <= 0) {
|
||||
bodydata.put("status", "add");
|
||||
}
|
||||
} else {
|
||||
ExceptionUtils.wrappBusinessException("存在未传合同平台的明细行主键的子表行,请检查传参!");
|
||||
if ((bodydata.getOrDefault("vbdef11", "") + "").isEmpty()) {
|
||||
// 如果vbdef11为空则标记为新增行
|
||||
bodydata.put("status", "add");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -366,20 +356,21 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain {
|
|||
SaleOrderVO bipVo = vosMap.get(primaryKey);
|
||||
// 设置单据状态
|
||||
hvo.setStatus(VOStatus.UPDATED);
|
||||
|
||||
Map<String, SaleOrderBVO> bvoMap = new HashMap<>();
|
||||
for (SaleOrderBVO saleOrderBVO : bipVo.getChildrenVO()) {
|
||||
bvoMap.put(saleOrderBVO.getCsaleorderbid(), saleOrderBVO);
|
||||
}
|
||||
String delId = delMap.get(primaryKey);
|
||||
|
||||
// 比较combinBillVOs中的BVO和vos中的BVO
|
||||
for (SaleOrderBVO bvo : vo.getChildrenVO()) {
|
||||
bvo.setStatus(VOStatus.UPDATED);
|
||||
// 设置删除的物料行的状态,在bip传的数据中找不到
|
||||
String csaleorderbid = bvo.getCsaleorderbid();
|
||||
if (bvoMap.get(csaleorderbid) == null) {
|
||||
bvo.setStatus(VOStatus.DELETED);
|
||||
NCCForUAPLogger.debug("findDeletedBids:" + VOStatus.DELETED + ",csaleorderbid = " + csaleorderbid);
|
||||
// 设置删除的物料行的状态,在bip传的数据中找不到
|
||||
if (StringUtils.isNotEmpty(delId)) {
|
||||
String[] delIds = delId.split(",", -1);
|
||||
String vbdef11 = bvo.getVbdef11();
|
||||
// 如果BIP合同销售订单的主键在删除的数组中,则设置为删除状态
|
||||
if (Arrays.asList(delIds).contains(vbdef11)) {
|
||||
bvo.setStatus(VOStatus.DELETED);
|
||||
NCCForUAPLogger.debug("findDeletedBids:" + VOStatus.DELETED + ",csaleorderbid = " + csaleorderbid);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 更新 combinBillVO 中的字段为 vos 中的值
|
||||
|
@ -726,6 +717,7 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain {
|
|||
targetBVO.setVbdef18(sourceBVO.getVbdef18()); // 是否定制
|
||||
targetBVO.setVbdef19(sourceBVO.getVbdef19()); // 计划开工日期
|
||||
targetBVO.setVbdef20(sourceBVO.getVbdef20()); // 计划完工日期
|
||||
targetBVO.setVbdef14(sourceBVO.getVbdef14()); // 合同销售订单变更明细id
|
||||
|
||||
}
|
||||
|
||||
|
@ -1262,6 +1254,10 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain {
|
|||
*/
|
||||
@Override
|
||||
public void updateBipFlagSo(Map<String, Object> paramMap) throws Exception {
|
||||
// 如果不包含BOM配置完成时间、工艺配置完成时间,则不同步
|
||||
if (!paramMap.containsKey("vbdef16") && !paramMap.containsKey("vbdef17")) {
|
||||
return;
|
||||
}
|
||||
String csaleorderbid = (String) paramMap.get("csaleorderbid");
|
||||
Map<String, Object> soMap = getSaleOrderInfo(csaleorderbid);
|
||||
// 如果没有存合同销售订单信息则不回写
|
||||
|
|
Loading…
Reference in New Issue