|
@@ -124,22 +124,22 @@ public class ContractUpdateFlow extends FlowDelegate {
|
|
|
newCp.setExpendQuantity(newCp.getQuantity());
|
|
|
if (ObjectUtil.isNotEmpty(newCp.getId())) {//如果新合同产品ID不为空
|
|
|
//取出旧合同
|
|
|
- ContractProduct oldContractProduct = oldContractProductMap.getOrDefault(newCp.getId(), null).get(0);
|
|
|
- //取出旧合同包装方式
|
|
|
- JSONObject oldJson = JSONObject.parseObject(oldContractProduct.getEhsdJson());
|
|
|
- String oldPackMethod = oldJson.getOrDefault("packMethod", null) == null ? null : oldJson.getOrDefault("packMethod", null).toString();
|
|
|
- //取出新合同包装方式
|
|
|
- JSONObject newJson = JSONObject.parseObject(newCp.getEhsdJson());
|
|
|
- String newPackMethod = newJson.getOrDefault("packMethod", null) == null ? null : oldJson.getOrDefault("packMethod", null).toString();
|
|
|
+ ContractProduct oldContractProduct = oldContractProductMap.getOrDefault(newCp.getId(),null).get(0);
|
|
|
+// //取出旧合同包装方式
|
|
|
+// JSONObject oldJson = JSONObject.parseObject(oldContractProduct.getEhsdJson());
|
|
|
+// String oldPackMethod = oldJson.getOrDefault("packMethod",null)==null?null:oldJson.getOrDefault("packMethod",null).toString();
|
|
|
+// //取出新合同包装方式
|
|
|
+// JSONObject newJson = JSONObject.parseObject(newCp.getEhsdJson());
|
|
|
+// String newPackMethod = newJson.getOrDefault("packMethod",null)==null?null:oldJson.getOrDefault("packMethod",null).toString();
|
|
|
/**
|
|
|
* 商品英文名、尺寸、包装方式、数量 没有变更---取原本的剩余数量
|
|
|
*/
|
|
|
- if (oldContractProduct.getQuantity().compareTo(newCp.getQuantity()) == 0
|
|
|
- && StringUtils.equals(oldContractProduct.getProductName(), newCp.getProductName())
|
|
|
- && StringUtils.equals(oldContractProduct.getProductModel(), newCp.getProductModel())
|
|
|
- && StringUtils.equals(oldPackMethod, newPackMethod)) {
|
|
|
+ if(oldContractProduct.getQuantity().compareTo(newCp.getQuantity())==0){//如果数量没有变动
|
|
|
//取出旧的剩余数量
|
|
|
newCp.setExpendQuantity(oldContractProduct.getExpendQuantity());
|
|
|
+ }else{//变动了
|
|
|
+ BigDecimal quantity = newCp.getQuantity().subtract(oldContractProduct.getQuantity()).subtract(oldContractProduct.getExpendQuantity());//剩余数量
|
|
|
+ newCp.setExpendQuantity(quantity);
|
|
|
}
|
|
|
}
|
|
|
}
|