优化浮点数bug
This commit is contained in:
parent
d9c232ab26
commit
3e15bd6457
|
@ -115,10 +115,14 @@ public class saveBeforeCheck implements IBusinessListener {
|
||||||
Object nassistnumObj = valMap.get("nassistnum");
|
Object nassistnumObj = valMap.get("nassistnum");
|
||||||
String nassistnums = (nassistnumObj != null) ? nassistnumObj.toString() : "";
|
String nassistnums = (nassistnumObj != null) ? nassistnumObj.toString() : "";
|
||||||
double nassistnum = (nassistnums.isEmpty()) ? 0 : Double.parseDouble(nassistnums);// 累计出库主数量
|
double nassistnum = (nassistnums.isEmpty()) ? 0 : Double.parseDouble(nassistnums);// 累计出库主数量
|
||||||
if (sQty < (nassistnum + bdsfnum)) {
|
if (new UFDouble(sQty).compareTo((new UFDouble(nassistnum).add(new UFDouble(bdnum)))) <0) {
|
||||||
throw new BusinessException("销售出库单明细" + (i + 1) + ",累计出库实发数量'" + (nassistnum + bdsfnum)
|
throw new BusinessException("销售出库单明细" + (i + 1) + ",累计出库实发数量'" + (new UFDouble(nassistnum).add(new UFDouble(bdnum)).toString())
|
||||||
+ "'大于销售订单累计发货申请数量'" + sQty + "',无法保存!");
|
+ "'大于销售订单累计发货申请数量'" + (new UFDouble(sQty)).toString() + "',无法保存!");
|
||||||
}
|
}
|
||||||
|
// if (sQty < (nassistnum + bdsfnum)) {
|
||||||
|
// throw new BusinessException("销售出库单明细" + (i + 1) + ",累计出库实发数量'" + (nassistnum + bdsfnum)
|
||||||
|
// + "'大于销售订单累计发货申请数量'" + sQty + "',无法保存!");
|
||||||
|
// }
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
throw new BusinessException("累计发货申请数量、累计出库数量转化数值失败" + e);
|
throw new BusinessException("累计发货申请数量、累计出库数量转化数值失败" + e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,11 +13,15 @@ import nc.impl.pubapp.pattern.rule.IRule;
|
||||||
import nc.vo.pu.m20.entity.PraybillItemVO;
|
import nc.vo.pu.m20.entity.PraybillItemVO;
|
||||||
import nc.vo.pu.m20.entity.PraybillVO;
|
import nc.vo.pu.m20.entity.PraybillVO;
|
||||||
import nc.vo.pu.pub.constant.PUMDValue;
|
import nc.vo.pu.pub.constant.PUMDValue;
|
||||||
|
import nc.vo.pub.BusinessException;
|
||||||
|
import nc.vo.pub.lang.UFDouble;
|
||||||
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
|
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
|
||||||
import nccloud.commons.lang.ArrayUtils;
|
import nccloud.commons.lang.ArrayUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请购单删除时回写备料计划是否下达字段
|
* 请购单删除时回写备料计划是否下达字段
|
||||||
|
@ -30,22 +34,35 @@ public class UpdatePickmRule implements IRule<PraybillVO> {
|
||||||
if (!ArrayUtils.isEmpty(vos)) {
|
if (!ArrayUtils.isEmpty(vos)) {
|
||||||
try {
|
try {
|
||||||
List<String> pk= new ArrayList<String>();
|
List<String> pk= new ArrayList<String>();
|
||||||
|
List<Map<String,Object>> updateList = new ArrayList<>();
|
||||||
for (PraybillVO vo : vos) {
|
for (PraybillVO vo : vos) {
|
||||||
PraybillItemVO[] praybillItemVOS=vo.getBVO();
|
PraybillItemVO[] praybillItemVOS=vo.getBVO();
|
||||||
for (PraybillItemVO praybillItemVO : praybillItemVOS) {
|
for (PraybillItemVO praybillItemVO : praybillItemVOS) {
|
||||||
if("55A3".equals(praybillItemVO.getCsourcetypecode())){
|
if("55A3".equals(praybillItemVO.getCsourcetypecode())){
|
||||||
|
Map<String,Object> map = new HashMap<>();
|
||||||
|
map.put("num",praybillItemVO.getNastnum());
|
||||||
|
map.put("pk",praybillItemVO.getCfirstbid());
|
||||||
pk.add(praybillItemVO.getCsourcebid());
|
pk.add(praybillItemVO.getCsourcebid());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!updateList.isEmpty()){
|
||||||
|
// 回写已经下达数量
|
||||||
|
updetaPmoNum(updateList);
|
||||||
|
}
|
||||||
if(!pk.isEmpty()){
|
if(!pk.isEmpty()){
|
||||||
//回写是否下方为是
|
//回写是否下方为是
|
||||||
updetaPmo(pk);
|
updetaPmo(pk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (BusinessException e) {
|
||||||
ExceptionUtils.wrappException(e);
|
try {
|
||||||
|
throw new BusinessException(e.getMessage());
|
||||||
|
} catch (BusinessException ex) {
|
||||||
|
throw new RuntimeException(ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -67,9 +84,19 @@ public class UpdatePickmRule implements IRule<PraybillVO> {
|
||||||
} else {
|
} else {
|
||||||
result = "'" + (String) arrayList.get(0) + "'";
|
result = "'" + (String) arrayList.get(0) + "'";
|
||||||
}
|
}
|
||||||
String sql = " update mm_pickm_b set vbdef13='N' where mm_pickm_b.cpickm_bid in(" + result + ")";
|
String sql = " update mm_pickm_b set vbdef13='N' where mm_pickm_b.cpickm_bid in(" + result + ") and mm_pickm_b.vbdef16='0' ";
|
||||||
|
|
||||||
BaseDAO dao = new BaseDAO();
|
BaseDAO dao = new BaseDAO();
|
||||||
dao.executeUpdate(sql);
|
dao.executeUpdate(sql);
|
||||||
}
|
}
|
||||||
|
private void updetaPmoNum(List<Map<String, Object>> updateList) throws DAOException {
|
||||||
|
BaseDAO dao = new BaseDAO();
|
||||||
|
for (Map<String, Object> updateMap : updateList) {
|
||||||
|
String sql = " update mm_pickm_b set vbdef16 = TO_CHAR(TO_NUMBER(vbdef16) -TO_NUMBER('"+((UFDouble)updateMap.get("num")).toString()+"')) where mm_pickm_b.cpickm_bid ='" + updateMap.get("pk") + "'";
|
||||||
|
|
||||||
|
dao.executeUpdate(sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue