优化
This commit is contained in:
@@ -179,19 +179,20 @@ public class HandReturnOutIvtServiceImpl implements HandReturnOutIvtService {
|
||||
|
||||
int seq_no = 1;
|
||||
//所有桶的总数
|
||||
BigDecimal sum_qty = BigDecimal.valueOf(disObj.getDoubleValue("real_qty"));
|
||||
double sum_qty = disObj.getDoubleValue("real_qty");
|
||||
for (int i = 0; i < dtl.size(); i++) {
|
||||
JSONObject dtljo = dtl.getJSONObject(i);
|
||||
String bucketunique = dtljo.getString("bucketunique");
|
||||
String out_qty = dtljo.getString("out_qty");
|
||||
if (StrUtil.isEmpty(out_qty)) {
|
||||
out_qty = "0";
|
||||
String out_qty1 = dtljo.getString("out_qty");
|
||||
double out_qty = 0;
|
||||
if (StrUtil.isNotEmpty(out_qty1)) {
|
||||
out_qty = Double.valueOf(out_qty1);
|
||||
}
|
||||
//假如出库重量=0 跳过本次循环
|
||||
if (Double.valueOf(out_qty) <= 0) {
|
||||
if (out_qty <= 0) {
|
||||
continue;
|
||||
}
|
||||
sum_qty = NumberUtil.add(out_qty, String.valueOf(sum_qty));
|
||||
sum_qty = NumberUtil.round(out_qty+sum_qty,3).doubleValue();
|
||||
JSONObject disdtljo = new JSONObject();
|
||||
disdtljo.put("iostorinvdisdtl_id", IdUtil.getSnowflake(1, 1).nextId() + "");
|
||||
disdtljo.put("iostorinvdis_id", disObj.getString("iostorinvdis_id"));
|
||||
@@ -239,12 +240,11 @@ public class HandReturnOutIvtServiceImpl implements HandReturnOutIvtService {
|
||||
if (!StrUtil.equals(bucketjo.getString("is_active"), disObj.getString("is_active"))) {
|
||||
throw new PdaRequestException("桶号为【'" + bucketjo.getString("bucketunique") + "'】 的物料是否可用状态跟出库单分配物料不匹配!");
|
||||
}
|
||||
BigDecimal left_qty = NumberUtil.sub(bucketjo.getString("storage_qty"), out_qty);
|
||||
|
||||
double left_qty = NumberUtil.round(bucketjo.getDouble("storage_qty")-out_qty,3).doubleValue();
|
||||
|
||||
// 插入到【配粉间桶记录表】
|
||||
String area_type = pointJO.getString("area_type");
|
||||
if (left_qty.doubleValue() == 0 && bill_type.equals("010501")) {
|
||||
if (left_qty == 0 && bill_type.equals("010501")) {
|
||||
if (StrUtil.equals("22", area_type) || StrUtil.equals("23", area_type) || StrUtil.equals("24", area_type)) {
|
||||
bucketjo.put("area_type", area_type);
|
||||
bucketjo.put("create_time", DateUtil.now());
|
||||
@@ -253,10 +253,10 @@ public class HandReturnOutIvtServiceImpl implements HandReturnOutIvtService {
|
||||
}
|
||||
|
||||
String status = bucketjo.getString("status");
|
||||
if (left_qty.doubleValue() < 0) {
|
||||
if (left_qty < 0) {
|
||||
throw new PdaRequestException("出库重量大于桶记录里面的库存数量!");
|
||||
}
|
||||
if (left_qty.doubleValue() == 0) {
|
||||
if (left_qty == 0) {
|
||||
status = "04";
|
||||
bucketjo.put("storagevehicle_id", "");
|
||||
bucketjo.put("storagevehicle_code", "");
|
||||
@@ -290,8 +290,8 @@ public class HandReturnOutIvtServiceImpl implements HandReturnOutIvtService {
|
||||
// 10更新【出入库分配表】
|
||||
disObj.put("real_qty", sum_qty);
|
||||
|
||||
BigDecimal qty_flag_dis = NumberUtil.sub(sum_qty, disObj.getDoubleValue("plan_qty"));
|
||||
if(qty_flag_dis.doubleValue() > 0){
|
||||
double qty_flag_dis = NumberUtil.round(sum_qty-disObj.getDoubleValue("plan_qty"),3).doubleValue();
|
||||
if(qty_flag_dis > 0){
|
||||
throw new PdaRequestException("总出库数大于计划出库数!");
|
||||
}
|
||||
dis_table.update(disObj);
|
||||
@@ -299,7 +299,7 @@ public class HandReturnOutIvtServiceImpl implements HandReturnOutIvtService {
|
||||
WQLObject iosdlt_table = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl");
|
||||
JSONObject iosdltObj = iosdlt_table.query("iostorinvdtl_id='" + disObj.getString("iostorinvdtl_id") + "'").uniqueResult(0);
|
||||
String plan_qty = iosdltObj.getString("plan_qty");
|
||||
BigDecimal total_qty = NumberUtil.add(sum_qty, iosdltObj.getDoubleValue("real_qty"));
|
||||
double total_qty = NumberUtil.round(sum_qty+iosdltObj.getDoubleValue("real_qty"),3).doubleValue();
|
||||
BigDecimal qty_flag = NumberUtil.sub(total_qty + "", plan_qty);
|
||||
String bill_status = iosdltObj.getString("bill_status");
|
||||
if (qty_flag.doubleValue() == 0) {
|
||||
|
||||
Reference in New Issue
Block a user