Browse Source

修改出库时bug

lwx_dev
erdanergou 3 years ago
parent
commit
f0e309029f
  1. 4
      src/main/java/com/dreamchaser/depository_manage/controller/PageController.java
  2. 86
      src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java
  3. 8
      src/main/resources/templates/pages/scanQrCode/ScanBarOrQrCodeOut.html
  4. 8
      target/classes/templates/pages/scanQrCode/ScanBarOrQrCodeOut.html

4
src/main/java/com/dreamchaser/depository_manage/controller/PageController.java

@ -1575,9 +1575,9 @@ public class PageController {
// 当前订单总数 // 当前订单总数
Double sumQuantity = 0.0; Double sumQuantity = 0.0;
// 当前总额 // 当前总额
Double sumPrice = 0.0; double sumPrice = 0.0;
// 计量单位 // 计量单位
StringBuffer sumUnit = new StringBuffer(); StringBuilder sumUnit = new StringBuilder();
for (ApplicationOutRecordMinP applicationOutRecordMin : applicationOutRecordMinByParent) { for (ApplicationOutRecordMinP applicationOutRecordMin : applicationOutRecordMinByParent) {
// 获取子订单信息 // 获取子订单信息
// 获取出库物料信息 // 获取出库物料信息

86
src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java

@ -1119,12 +1119,14 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
} }
} }
}).start(); }).start();
} else { }
else {
restResponse.setStatus(508); restResponse.setStatus(508);
restResponse.setData(""); restResponse.setData("");
restResponse.setStatusInfo(new StatusInfo("出库失败", "出库失败,库存不足")); restResponse.setStatusInfo(new StatusInfo("出库失败", "出库失败,库存不足"));
} }
} else { }
else {
// 如果是拆单后的出库 // 如果是拆单后的出库
// 用于获取对应的拆单记录 // 用于获取对应的拆单记录
@ -1151,6 +1153,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
if (splitInventory != null) { if (splitInventory != null) {
// 如果拆单库存处理记录存在 // 如果拆单库存处理记录存在
// 未出库时库存记录
double oldSplitInventory = splitInventory.getSaveQuantity() / 100.0;
if (splitInventory.getSaveQuantity() >= trueOut * 100) { if (splitInventory.getSaveQuantity() >= trueOut * 100) {
// 如果当前待处理树可以满足需求 // 如果当前待处理树可以满足需求
@ -1185,7 +1190,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
restResponse.setStatusInfo(new StatusInfo("出库成功", "出库成功")); restResponse.setStatusInfo(new StatusInfo("出库成功", "出库成功"));
} else { }
else {
// 如果不能满足需求 // 如果不能满足需求
// 获取对应的拆单记录 // 获取对应的拆单记录
@ -1206,10 +1212,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 将当前库存设置为0 // 将当前库存设置为0
splitInventory.setSaveQuantity(0); splitInventory.setSaveQuantity(0);
// 修改库存数量 // 修改库存数量
splitUnitMapper.updateSplitInventory(splitInventory); splitUnitMapper.updateSplitInventory(splitInventory);
// 获取当前父级拆单记录 // 获取当前父级拆单记录
SplitInfo parentSplitInfo = splitUnitMapper.findSplitInfoById(splitInfoById.getParentId()); SplitInfo parentSplitInfo = splitUnitMapper.findSplitInfoById(splitInfoById.getParentId());
@ -1226,10 +1234,17 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
map.put("unit", applicationOutMinById.getUnit()); map.put("unit", applicationOutMinById.getUnit());
transferMaterial(map); transferMaterial(map);
} }
}else{
trueOut = 0.0;
splitInventory.setSaveQuantity((int)(oldSplitInventory * 100));
splitInventory.setOutQuantity(splitInventory.getOutQuantity() - (int)(oldSplitInventory * 100));
// 修改库存数量
splitUnitMapper.updateSplitInventory(splitInventory);
} }
updateApplicationMinOutInfo(id, applicationOutMinById, record, trueOut, userByPort, placeId, userAgent); updateApplicationMinOutInfo(id, applicationOutMinById, record, trueOut, userByPort, placeId, userAgent);
} else { }
else {
// 如果当前拆单没有父级 // 如果当前拆单没有父级
@ -1314,7 +1329,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
restResponse.setData(""); restResponse.setData("");
restResponse.setStatusInfo(new StatusInfo("出库失败", "出库失败,库存不足")); restResponse.setStatusInfo(new StatusInfo("出库失败", "出库失败,库存不足"));
} }
} else { }
else {
// 如果大于 // 如果大于
// 获取库存重要减少的数量 // 获取库存重要减少的数量
@ -1333,6 +1349,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - saveQuantity); splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - saveQuantity);
} }
splitInventory.setOutQuantity(splitInventory.getOutQuantity() + saveQuantity); splitInventory.setOutQuantity(splitInventory.getOutQuantity() + saveQuantity);
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("mid", inventory.getId()); params.put("mid", inventory.getId());
params.put("pid", placeId); params.put("pid", placeId);
@ -1346,7 +1364,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 如果当前库存中的物料库存不足以出库 // 如果当前库存中的物料库存不足以出库
flag = false; flag = false;
} }
} else { }
else {
restResponse.setStatus(566); restResponse.setStatus(566);
restResponse.setData(""); restResponse.setData("");
restResponse.setStatusInfo(new StatusInfo("出库失败", "当前位置未发现该物料")); restResponse.setStatusInfo(new StatusInfo("出库失败", "当前位置未发现该物料"));
@ -1373,6 +1392,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
placeById.setQuantity(placeById.getQuantity() - surplus_redundant); placeById.setQuantity(placeById.getQuantity() - surplus_redundant);
placeMapper.UpdatePlace(placeById); placeMapper.UpdatePlace(placeById);
// 修改拆单单位库存
splitUnitMapper.updateSplitInventory(splitInventory);
// 如果是库存转移订单 // 如果是库存转移订单
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
@ -1397,7 +1419,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
} }
} }
} else { }
else {
// 如果拆单库存处理记录不存在 // 如果拆单库存处理记录不存在
int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1);
@ -1465,7 +1488,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
restResponse.setStatusInfo(new StatusInfo("出库成功", "出库成功")); restResponse.setStatusInfo(new StatusInfo("出库成功", "出库成功"));
} else { }
else {
restResponse.setStatus(508); restResponse.setStatus(508);
restResponse.setData(""); restResponse.setData("");
restResponse.setStatusInfo(new StatusInfo("出库失败", "出库失败,库存不足")); restResponse.setStatusInfo(new StatusInfo("出库失败", "出库失败,库存不足"));
@ -1521,7 +1545,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
restResponse.setStatus(200); restResponse.setStatus(200);
restResponse.setData(""); restResponse.setData("");
restResponse.setStatusInfo(new StatusInfo("出库成功", "出库成功")); restResponse.setStatusInfo(new StatusInfo("出库成功", "出库成功"));
} else { }
else {
// 如果当前库存拆单记录的库存不能满足需要 // 如果当前库存拆单记录的库存不能满足需要
@ -1595,7 +1620,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
restResponse.setData(""); restResponse.setData("");
restResponse.setStatusInfo(new StatusInfo("出库成功", "出库成功")); restResponse.setStatusInfo(new StatusInfo("出库成功", "出库成功"));
} else { }
else {
// 如果当前当前父级与其的库存数量不大于要出库的数量 // 如果当前当前父级与其的库存数量不大于要出库的数量
if (parentSplitInfo.getParentId() != null) { if (parentSplitInfo.getParentId() != null) {
@ -1644,7 +1670,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
} else { } else {
return restResponse1; return restResponse1;
} }
} else { }
else {
// 如果没有父级 // 如果没有父级
// 获取当前拆单单位与顶级之间的进制 // 获取当前拆单单位与顶级之间的进制
@ -1673,7 +1700,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
placeMapper.updateMaterialAndPlace(materialAndPlace); placeMapper.updateMaterialAndPlace(materialAndPlace);
} else { }
else {
// 如果不可出库 // 如果不可出库
restResponse.setStatus(508); restResponse.setStatus(508);
restResponse.setData(""); restResponse.setData("");
@ -1682,28 +1710,48 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
} }
} }
} else { }
else {
// 如果已经没有父级 // 如果已经没有父级
// 获取顶级与当前单位之间的进制 // 获取基础单位与当前实际出库单位单位之间的进制
double splitInfoScaleQuantityForAll = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); double splitInfoScaleQuantityForAll = splitUnitService.findSplitInfoScaleQuantity(realSplitInfo, -1);
// 计算库存减少的数目 // 计算库存减少的数目
int surplus_redundant = (int) Math.ceil(nowQuantity / splitInfoScaleQuantityForAll); int surplus_redundant = (int) Math.ceil(nowQuantity / splitInfoScaleQuantityForAll);
// 获取对应的库存 // 获取对应的库存
Inventory inventory = materialMapper.findInventoryById(materialAndPlace.getMid()); Inventory inventory = materialMapper.findInventoryById(materialAndPlace.getMid());
// 设置当前库存数量 if(surplus_redundant == 0) {
materialAndPlace.setQuantity(materialAndPlace.getQuantity() - surplus_redundant); surplus_redundant = 1;
inventory.setQuantity(inventory.getQuantity() - surplus_redundant); }
// 设置当前库存数量
materialAndPlace.setQuantity(materialAndPlace.getQuantity() - surplus_redundant * 100);
inventory.setQuantity(inventory.getQuantity() - surplus_redundant * 100);
// 修改库存数量 // 修改库存数量
materialMapper.updateInventory(inventory); materialMapper.updateInventory(inventory);
placeMapper.updateMaterialAndPlace(materialAndPlace); placeMapper.updateMaterialAndPlace(materialAndPlace);
Map<String,Object> insertForOut = new HashMap<>();
insertForOut.put("unit",realSplitInfo.getNewUnit());
insertForOut.put("quantity",surplus_redundant * splitInfoScaleQuantityForAll - nowQuantity);
insertForOut.put("placeId",materialAndPlace.getPid());
insertForOut.put("depositoryId",materialAndPlace.getDid());
insertForOut.put("mid", inventory.getMid());
insertForOut.put("mcode", inventory.getCode());
insertForOut.put("type", "in");
insertForOut.put("flagForApproval", false);
splitUnitService.addSplitInventory(insertForOut);
Integer new_id = ObjectFormatUtil.toInteger(insertForOut.get("applicationInIdForOut"));
depositoryRecordMapper.deleteApplicationInRecordById(new_id);
restResponse.setData(surplus_redundant); restResponse.setData(surplus_redundant);
} }
} else { }
else {
// 如果不能满足需求 // 如果不能满足需求
restResponse.setStatus(508); restResponse.setStatus(508);

8
src/main/resources/templates/pages/scanQrCode/ScanBarOrQrCodeOut.html

@ -63,7 +63,7 @@
} else { } else {
wxScan = wxScan.parent.wx; wxScan = wxScan.parent.wx;
} }
wxScan.scanQRCode({ /*wxScan.scanQRCode({
desc: 'scanQRCode desc', desc: 'scanQRCode desc',
needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果, needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果,
scanType: ["barCode", "qrCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有 scanType: ["barCode", "qrCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有
@ -82,7 +82,11 @@
} }
}); });*/
var result = "1638361861757116416";//当needResult为1时返回处理结果
var req = {};
req.qrCode = result;
outboundLogic(req);
}); });

8
target/classes/templates/pages/scanQrCode/ScanBarOrQrCodeOut.html

@ -63,7 +63,7 @@
} else { } else {
wxScan = wxScan.parent.wx; wxScan = wxScan.parent.wx;
} }
wxScan.scanQRCode({ /*wxScan.scanQRCode({
desc: 'scanQRCode desc', desc: 'scanQRCode desc',
needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果, needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果,
scanType: ["barCode", "qrCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有 scanType: ["barCode", "qrCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有
@ -82,7 +82,11 @@
} }
}); });*/
var result = "1638361861757116416";//当needResult为1时返回处理结果
var req = {};
req.qrCode = result;
outboundLogic(req);
}); });

Loading…
Cancel
Save