diff --git a/so/src/private/nccloud/api/impl/so/m30/APISaleOrderMaitainImpl.java b/so/src/private/nccloud/api/impl/so/m30/APISaleOrderMaitainImpl.java index ac275d6..a5bf14b 100644 --- a/so/src/private/nccloud/api/impl/so/m30/APISaleOrderMaitainImpl.java +++ b/so/src/private/nccloud/api/impl/so/m30/APISaleOrderMaitainImpl.java @@ -320,17 +320,24 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain { if (null == originVos || originVos.length == 0) { ExceptionUtils.wrappBusinessException("根据传入数据未匹配到相关数据"); } - Map delMap = new HashMap<>(); + Map> delBipMap = new HashMap<>(); for (Map objectMap : paramList) { Map headdata = (Map) objectMap.get(HEADTABLE); - delMap.put(headdata.get("csaleorderid") + "", headdata.getOrDefault("delId", "") + ""); + String csaleorderid = headdata.get("csaleorderid") + ""; List bodyArr = (List) objectMap.get(BODYTABLE); + List delIds = new ArrayList<>(); for (Object body : bodyArr) { Map bodydata = (Map) body; if ((bodydata.getOrDefault("vbdef11", "") + "").isEmpty()) { // 如果vbdef11为空则标记为新增行 bodydata.put("status", "add"); } + if (!(bodydata.getOrDefault("csaleorderbid", "") + "").isEmpty()) { + delIds.add(bodydata.get("csaleorderbid") + ""); + } + } + if (!delIds.isEmpty()) { + delBipMap.put(csaleorderid, delIds); } } @@ -356,20 +363,17 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain { SaleOrderVO bipVo = vosMap.get(primaryKey); // 设置单据状态 hvo.setStatus(VOStatus.UPDATED); - String delId = delMap.get(primaryKey); + List bipIds = delBipMap.get(primaryKey); // 比较combinBillVOs中的BVO和vos中的BVO for (SaleOrderBVO bvo : vo.getChildrenVO()) { - bvo.setStatus(VOStatus.UPDATED); + bvo.setStatus(VOStatus.DELETED); String csaleorderbid = bvo.getCsaleorderbid(); - // 设置删除的物料行的状态,在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); + // 设置物料行的状态,在bip传的数据中找到则修改 + if (bipIds != null && !bipIds.isEmpty()) { + // 明细行设置为修改状态 + if (bipIds.contains(csaleorderbid)) { + bvo.setStatus(VOStatus.UPDATED); } } }