|
@@ -730,7 +730,8 @@ public class ProductInventoryServiceImpl implements IProductInventoryService {
|
|
|
productInvoice1.setTransferWarehouse(productInvoice.getTransferWarehouse());
|
|
|
productInvoice1.setDeliveryClerk(productInvoice.getDeliveryClerk());
|
|
|
productInvoiceMapper.updateProductInvoice(productInvoice1);
|
|
|
-
|
|
|
+ int xs = 0;//箱数用于添加出库记录
|
|
|
+ Double zl = 0.0;//重量用于添加出库记录
|
|
|
// 减去手动输入的老库存,当前订单出库
|
|
|
for (ProductInvoiceVO.SaleProductInfo item : productInvoice.getOldProductInvoiceList()) {
|
|
|
|
|
@@ -771,104 +772,111 @@ public class ProductInventoryServiceImpl implements IProductInventoryService {
|
|
|
// 更新库存对象
|
|
|
ProductInventory editProductInventory = new ProductInventory();
|
|
|
editProductInventory.setId(productInventory.getId());
|
|
|
- //箱数
|
|
|
- if (productInventory.getTotalBoxNum() - 1 < 0) {
|
|
|
- // 判断当前循环是否到达最后
|
|
|
- if (i == productInventoryList.size() - 1) {
|
|
|
- returnState = true;
|
|
|
- msg = "当前库存箱数不足";
|
|
|
- } else {
|
|
|
- del++;
|
|
|
- }
|
|
|
+ if(productInventory.getTotalBoxNum() > xs || item.getOldActualWeight() > zl){
|
|
|
+ //箱数
|
|
|
+ if (productInventory.getTotalBoxNum() - 1 < 0) {
|
|
|
+ // 判断当前循环是否到达最后
|
|
|
+ if (i == productInventoryList.size() - 1) {
|
|
|
+ returnState = true;
|
|
|
+ msg = "当前库存箱数不足";
|
|
|
+ } else {
|
|
|
+ del++;
|
|
|
+ }
|
|
|
|
|
|
- } else {
|
|
|
-
|
|
|
- int totalBoxNum = productInventory.getTotalBoxNum() - item.getOldActualBoxNum();
|
|
|
- // 判断当前减去
|
|
|
- if (totalBoxNum <= 0) {
|
|
|
- Math.abs(totalBoxNum); // 当前出库还差多少箱数
|
|
|
- item.setOldActualBoxNum(Math.abs(totalBoxNum));
|
|
|
- editProductInventory.setTotalBoxNum(0);
|
|
|
} else {
|
|
|
- editProductInventory.setTotalBoxNum(totalBoxNum);
|
|
|
- item.setOldActualBoxNum(0);
|
|
|
+
|
|
|
+ int totalBoxNum = productInventory.getTotalBoxNum() - item.getOldActualBoxNum();
|
|
|
+ // 判断当前减去
|
|
|
+ if (totalBoxNum <= 0) {
|
|
|
+ Math.abs(totalBoxNum); // 当前出库还差多少箱数
|
|
|
+ item.setOldActualBoxNum(Math.abs(totalBoxNum));
|
|
|
+ editProductInventory.setTotalBoxNum(0);
|
|
|
+ } else {
|
|
|
+ editProductInventory.setTotalBoxNum(totalBoxNum);
|
|
|
+ item.setOldActualBoxNum(0);
|
|
|
+ }
|
|
|
+ //获得当前减去的库存箱数
|
|
|
+ xs = productInventory.getTotalBoxNum() - totalBoxNum;
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- //净重
|
|
|
- if (productInventory.getTotalSuttle() - item.getOldActualBoxNum() < 0) {
|
|
|
- // 判断当前循环是否到达最后
|
|
|
- if (i == productInventoryList.size() - 1) {
|
|
|
- returnState = true;
|
|
|
- msg = "当前库存重量不足";
|
|
|
+ //净重
|
|
|
+ if (productInventory.getTotalSuttle() - item.getOldActualWeight() < 0) {
|
|
|
+ // 判断当前循环是否到达最后
|
|
|
+ if (i == productInventoryList.size() - 1) {
|
|
|
+ returnState = true;
|
|
|
+ msg = "当前库存重量不足";
|
|
|
+ } else {
|
|
|
+ del++;
|
|
|
+ }
|
|
|
} else {
|
|
|
- del++;
|
|
|
- }
|
|
|
- } else {
|
|
|
- Double totalSuttle = handlingWeight(productInventory.getTotalSuttle() - item.getOldActualWeight());
|
|
|
- if (totalSuttle <= 0.0) {
|
|
|
+ Double totalSuttle = handlingWeight(productInventory.getTotalSuttle() - item.getOldActualWeight());
|
|
|
+ if (totalSuttle <= 0.0) {
|
|
|
// Math.abs(totalSuttle);
|
|
|
- item.setOldActualWeight(Math.abs(totalSuttle));
|
|
|
- editProductInventory.setTotalSuttle(0.0);
|
|
|
- } else {
|
|
|
- editProductInventory.setTotalSuttle(totalSuttle);
|
|
|
- item.setOldActualWeight(0.0);
|
|
|
+ item.setOldActualWeight(Math.abs(totalSuttle));
|
|
|
+ editProductInventory.setTotalSuttle(0.0);
|
|
|
+ } else {
|
|
|
+ editProductInventory.setTotalSuttle(totalSuttle);
|
|
|
+ item.setOldActualWeight(0.0);
|
|
|
+ }
|
|
|
+ //获得当前减去的库存重量
|
|
|
+ zl = handlingWeight(productInventory.getTotalSuttle() - totalSuttle);
|
|
|
+ }
|
|
|
+
|
|
|
+ // //毛重
|
|
|
+ // if (productInventory.getTotalGrossWeight() - item.getOldActualWeight() < 0) {
|
|
|
+ // // 判断当前循环是否到达最后
|
|
|
+ // if (i == productInventoryList.size() - 1) {
|
|
|
+ // returnState = true;
|
|
|
+ // msg = "当前库存毛重不足";
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // Double totalGrossWeight = handlingWeight(productInventory.getTotalGrossWeight() - item.getOldActualWeight());
|
|
|
+ // if (totalGrossWeight <= 0.0) {
|
|
|
+ // item.setOldActualWeight(Math.abs(totalGrossWeight));
|
|
|
+ // editProductInventory.setTotalSuttle(0.0);
|
|
|
+ // } else {
|
|
|
+ // editProductInventory.setTotalGrossWeight(totalGrossWeight);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
+ if (del == 2) {
|
|
|
+ editProductInventory.setDelFlag("2");
|
|
|
}
|
|
|
+ // 成品出库记录
|
|
|
+ ProductOutboundRecord productOutboundRecord = new ProductOutboundRecord();
|
|
|
+ productOutboundRecord.setQrCode("lkc_"+System.currentTimeMillis());//码单号
|
|
|
+ productOutboundRecord.setQrCodeId("lkc_"+ RandomUtil.getSecureRandom().nextInt());//码单标识
|
|
|
+ productOutboundRecord.setProductId(item.getProductId());//产品编号
|
|
|
+ productOutboundRecord.setCanisterNum(0);//筒数
|
|
|
+ productOutboundRecord.setLevels(productInventory.getLevels());//等级
|
|
|
+ productOutboundRecord.setLotNum(productInventory.getLotNum());//库存批号
|
|
|
+ productOutboundRecord.setBoxNum(xs);//箱数
|
|
|
+ productOutboundRecord.setSuttle(zl);//重量
|
|
|
+ productOutboundRecord.setMachineTool(Long.parseLong("30"));//机台
|
|
|
+ productOutboundRecord.setGrossWeight(item.getOldActualWeight());//毛重
|
|
|
+ productOutboundRecord.setPackaging("2");//包装
|
|
|
+ productOutboundRecord.setWorkShifts("D甲");//班次
|
|
|
+ productOutboundRecord.setForeignTradeNumber("1");//外贸号
|
|
|
+ productOutboundRecord.setCanisterWeight(0.0);//筒重
|
|
|
+ productOutboundRecord.setBoxWeight(0.0);//箱重
|
|
|
+ productOutboundRecord.setTubeColor("塑料管");
|
|
|
+ productOutboundRecord.setPrintFormat("4");//打印格式
|
|
|
+ productOutboundRecord.setDelFlag("0");
|
|
|
+ productOutboundRecord.setCreateById(SecurityUtils.getUserId());
|
|
|
+ productOutboundRecord.setCreateBy(SecurityUtils.getUsername());
|
|
|
+ productOutboundRecord.setCreateTime(new Date());
|
|
|
+ productOutboundRecord.setDepositor(SecurityUtils.getUsername());
|
|
|
+ productOutboundRecord.setNoticeNumber(productInvoice.getNoticeNumber());
|
|
|
+ productOutboundRecord.setProductColour(item.getProductColor());
|
|
|
+ productOutboundRecord.setHistoryBatch(false);
|
|
|
+ productOutboundRecord.setBatchNumber(0);
|
|
|
+ productOutboundRecord.setConfirmOut(1);
|
|
|
+ // 添加成品库存出库记录
|
|
|
+ productOutboundRecordMapper.insertProductOutboundRecord(productOutboundRecord);
|
|
|
+ productInventoryMapper.updateProductInventory(editProductInventory);
|
|
|
}
|
|
|
|
|
|
- // //毛重
|
|
|
- // if (productInventory.getTotalGrossWeight() - item.getOldActualWeight() < 0) {
|
|
|
- // // 判断当前循环是否到达最后
|
|
|
- // if (i == productInventoryList.size() - 1) {
|
|
|
- // returnState = true;
|
|
|
- // msg = "当前库存毛重不足";
|
|
|
- // }
|
|
|
- // } else {
|
|
|
- // Double totalGrossWeight = handlingWeight(productInventory.getTotalGrossWeight() - item.getOldActualWeight());
|
|
|
- // if (totalGrossWeight <= 0.0) {
|
|
|
- // item.setOldActualWeight(Math.abs(totalGrossWeight));
|
|
|
- // editProductInventory.setTotalSuttle(0.0);
|
|
|
- // } else {
|
|
|
- // editProductInventory.setTotalGrossWeight(totalGrossWeight);
|
|
|
- // }
|
|
|
- // }
|
|
|
-
|
|
|
- if (del == 2) {
|
|
|
- editProductInventory.setDelFlag("2");
|
|
|
}
|
|
|
- // 成品出库记录
|
|
|
- ProductOutboundRecord productOutboundRecord = new ProductOutboundRecord();
|
|
|
- productOutboundRecord.setQrCode("lkc_"+System.currentTimeMillis());//码单号
|
|
|
- productOutboundRecord.setQrCodeId("lkc_"+ RandomUtil.getSecureRandom().nextInt());//码单标识
|
|
|
- productOutboundRecord.setProductId(item.getProductId());//产品编号
|
|
|
- productOutboundRecord.setCanisterNum(0);//筒数
|
|
|
- productOutboundRecord.setLevels(productInventory.getLevels());//等级
|
|
|
- productOutboundRecord.setLotNum(productInventory.getLotNum());//库存批号
|
|
|
- productOutboundRecord.setBoxNum(Integer.parseInt(oldProductOutboundRecord.getActualBoxnum()));//箱数
|
|
|
- productOutboundRecord.setSuttle(Double.parseDouble(oldProductOutboundRecord.getActualWeight()));//重量
|
|
|
- productOutboundRecord.setMachineTool(Long.parseLong("30"));//机台
|
|
|
- productOutboundRecord.setGrossWeight(item.getOldActualWeight());//毛重
|
|
|
- productOutboundRecord.setPackaging("2");//包装
|
|
|
- productOutboundRecord.setWorkShifts("D甲");//班次
|
|
|
- productOutboundRecord.setForeignTradeNumber("1");//外贸号
|
|
|
- productOutboundRecord.setCanisterWeight(0.0);//筒重
|
|
|
- productOutboundRecord.setBoxWeight(0.0);//箱重
|
|
|
- productOutboundRecord.setTubeColor("塑料管");
|
|
|
- productOutboundRecord.setPrintFormat("4");//打印格式
|
|
|
- productOutboundRecord.setDelFlag("0");
|
|
|
- productOutboundRecord.setCreateById(SecurityUtils.getUserId());
|
|
|
- productOutboundRecord.setCreateBy(SecurityUtils.getUsername());
|
|
|
- productOutboundRecord.setCreateTime(new Date());
|
|
|
- productOutboundRecord.setDepositor(SecurityUtils.getUsername());
|
|
|
- productOutboundRecord.setNoticeNumber(productInvoice.getNoticeNumber());
|
|
|
- productOutboundRecord.setProductColour(item.getProductColor());
|
|
|
- productOutboundRecord.setHistoryBatch(false);
|
|
|
- productOutboundRecord.setBatchNumber(0);
|
|
|
- productOutboundRecord.setConfirmOut(1);
|
|
|
- // 添加成品库存出库记录
|
|
|
- productOutboundRecordMapper.insertProductOutboundRecord(productOutboundRecord);
|
|
|
- productInventoryMapper.updateProductInventory(editProductInventory);
|
|
|
- }
|
|
|
|
|
|
if (returnState) {
|
|
|
return AjaxResult.error(msg);
|