Browse Source

修改仓储中心提交出库申请时由自己审批

lwx_dev
erdanergou 3 years ago
parent
commit
ba4c97d350
  1. 6
      src/main/java/com/dreamchaser/depository_manage/controller/PageController.java
  2. 2
      src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java
  3. 43
      src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java
  4. 2
      target/classes/templates/pages/application/application-transfer.html

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

@ -566,7 +566,7 @@ public class PageController {
Inventory inventoryById = materialService.findInventoryById(mid);
if (inventoryById.getUnit().equals(unit)) {
// 如果转移的基础单位
mv.addObject("quantity", placeAndMaterialByMidAndPid.getQuantity());
mv.addObject("quantity", (int)(placeAndMaterialByMidAndPid.getQuantity() / 100));
} else {
// 获取当前的拆单记录
Map<String, Object> paramForSplitInfo = new HashMap<>();
@ -576,10 +576,10 @@ public class PageController {
SplitInfo splitInfo = splitUnitService.findSplitInfoByMidAndUnit(paramForSplitInfo);
SplitInventory splitInventory = splitUnitService.findSplitInventoryByIidAndSid(placeAndMaterialByMidAndPid.getId(), splitInfo.getId());
if (splitInventory != null) {
mv.addObject("quantity", splitInventory.getSaveQuantity());
mv.addObject("quantity",(int)(splitInventory.getSaveQuantity() / 100));
} else {
int Scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1);
mv.addObject("quantity", inventoryById.getQuantity() * Scale);
mv.addObject("quantity", (int)(inventoryById.getQuantity() * Scale / 100));
}
}
mv.addObject("depositoryId", depositoryId);

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

@ -3096,7 +3096,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
if (quantity < splitInfo.getQuantity()) {
// 如果当前转移数量小于进制数量
insertForSplitInventory.put("flagForApproval", true);
insertForSplitInventory.put("flagForApproval", false);
// 设置入库数量
insertForSplitInventory.put("inQuantity", (int) (quantity * 100));
// 设置当前库存数

43
src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java

@ -1493,7 +1493,7 @@ public class MaterialServiceImpl implements MaterialService {
// 获取当前转移之前的库位与库存的对应关系
MaterialAndPlace pidAndMidForBefore = placeService.findPlaceAndMaterialByMidAndPid(fromPlaceId, id);
// 获取要转移的数量
Integer quantity = ObjectFormatUtil.toInteger(map.get("quantity"));
Double quantity = ObjectFormatUtil.toDouble(map.get("quantity"));
// 获取转移到的库位
Integer toPlaceId = ObjectFormatUtil.toInteger(map.get("toPlaceId"));
Place toPlace = placeService.findPlaceById(toPlaceId);
@ -1503,13 +1503,13 @@ public class MaterialServiceImpl implements MaterialService {
// 获取当前转移的计量单位
String unit = (String) map.get("unit");
// 获取转移之前的库存转移的数量
int beforeQuantity = pidAndMidForBefore.getQuantity() - quantity;
int beforeQuantity = pidAndMidForBefore.getQuantity() - (int) (quantity * 100);
if (inventoryByMid.getUnit().equals(unit)) {
// 如果是基础单位
// 判断转移到的库位是否超出库存
if (toPlace.getQuantity() + quantity > toPlace.getMax()) {
if (toPlace.getQuantity() + (int) (quantity * 100) > toPlace.getMax()) {
// 如果超出最大存储量
return -1;
} else {
@ -1521,7 +1521,7 @@ public class MaterialServiceImpl implements MaterialService {
// 如果该库位有物料
// 修改转入物料数量
pidAndMidForAfter.setQuantity(pidAndMidForAfter.getQuantity() + quantity);
pidAndMidForAfter.setQuantity(pidAndMidForAfter.getQuantity() + (int) (quantity * 100));
placeService.updateMaterialAndPlace(pidAndMidForAfter);
} else {
// 如果没有
@ -1548,9 +1548,9 @@ public class MaterialServiceImpl implements MaterialService {
}
// 修改转移之前库位的数量
fromPlace.setQuantity(fromPlace.getQuantity() - quantity);
fromPlace.setQuantity(fromPlace.getQuantity() - (int) (quantity * 100));
// 修改转移之后库位的数量
toPlace.setQuantity(toPlace.getQuantity() + quantity);
toPlace.setQuantity(toPlace.getQuantity() + (int) (quantity * 100));
placeService.UpdatePlace(fromPlace);
placeService.UpdatePlace(toPlace);
@ -1576,9 +1576,9 @@ public class MaterialServiceImpl implements MaterialService {
//如果存在
// 设置转移前库存的数量
splitInventoryForBefore.setSaveQuantity(splitInventoryForBefore.getSaveQuantity() - quantity);
splitInventoryForBefore.setSaveQuantity(splitInventoryForBefore.getSaveQuantity() - (int) (quantity * 100));
// 设置转移前的出库数量
splitInventoryForBefore.setOutQuantity(splitInventoryForBefore.getOutQuantity() + quantity);
splitInventoryForBefore.setOutQuantity(splitInventoryForBefore.getOutQuantity() + (int) (quantity * 100));
// 修改转移前的记录
splitUnitMapper.updateSplitInventory(splitInventoryForBefore);
@ -1591,11 +1591,11 @@ public class MaterialServiceImpl implements MaterialService {
int num = (int) (Math.ceil(quantity / (double) scale));
// 修改当前库存数量
inventoryByMid.setQuantity(inventoryByMid.getQuantity() - num);
inventoryByMid.setQuantity(inventoryByMid.getQuantity() - num * 100);
materialMapper.updateInventory(inventoryByMid);
// 修改当前库位对应关系的数目
pidAndMidForBefore.setQuantity(pidAndMidForBefore.getQuantity() - num);
pidAndMidForBefore.setQuantity(pidAndMidForBefore.getQuantity() - num * 100);
placeService.updateMaterialAndPlace(pidAndMidForBefore);
Map<String, Object> insertForSplitInventory = new HashMap<>();
@ -1610,6 +1610,7 @@ public class MaterialServiceImpl implements MaterialService {
insertForSplitInventory.put("depositoryId", map.get("depositoryId"));
insertForSplitInventory.put("placeId", pidAndMidForBefore.getPid());
insertForSplitInventory.put("type", "in");
insertForSplitInventory.put("flagForApproval", false);
splitUnitService.addSplitInventory(insertForSplitInventory);
Integer new_id = ObjectFormatUtil.toInteger(insertForSplitInventory.get("newInMid"));
depositoryRecordMapper.deleteApplicationInRecordById(new_id);
@ -1637,7 +1638,7 @@ public class MaterialServiceImpl implements MaterialService {
// 如果转移后的拆单库存记录不为空
// 获取当前转移后的总数
int realQuantity = splitInventoryForAfter.getSaveQuantity() + quantity;
int realQuantity = splitInventoryForAfter.getSaveQuantity() + (int) (quantity * 100);
if (realQuantity >= splitInfo.getQuantity()) {
// 如果当前转移后的总数大于进制数
@ -1649,7 +1650,7 @@ public class MaterialServiceImpl implements MaterialService {
// 设置当前库存数量
splitInventoryForAfter.setSaveQuantity(realQuantity);
// 设置当前入库数量
splitInventoryForAfter.setInQuantity(splitInventoryForAfter.getInQuantity() + quantity);
splitInventoryForAfter.setInQuantity(splitInventoryForAfter.getInQuantity() + (int) (quantity * 100));
// 修改库存记录
splitUnitMapper.updateSplitInventory(splitInventoryForAfter);
@ -1676,7 +1677,7 @@ public class MaterialServiceImpl implements MaterialService {
// 设置转移后的库存数量
splitInventoryForAfter.setSaveQuantity(realQuantity);
// 设置转移后的入库数量
splitInventoryForAfter.setInQuantity(splitInventoryForAfter.getSaveQuantity() + quantity);
splitInventoryForAfter.setInQuantity(splitInventoryForAfter.getSaveQuantity() + (int) (quantity * 100));
// 修改库存数量
splitUnitMapper.updateSplitInventory(splitInventoryForAfter);
}
@ -1694,10 +1695,10 @@ public class MaterialServiceImpl implements MaterialService {
// 获取进制数
int dispose = (int) (Math.floor(quantity / (double) splitInfo.getQuantity()));
// 获取当前进行入库的数量
int realQuantity = quantity - dispose * splitInfo.getQuantity();
double realQuantity = quantity - dispose * splitInfo.getQuantity();
// 如果不大于
insertForSplitInventory.put("saveQuantity", realQuantity);
insertForSplitInventory.put("inQuantity", realQuantity);
insertForSplitInventory.put("saveQuantity", (int) (realQuantity * 100));
insertForSplitInventory.put("inQuantity", (int) (realQuantity * 100));
splitUnitMapper.addSplitInventory(insertForSplitInventory);
if (splitInfo.getParentId() != null) {
@ -1743,10 +1744,10 @@ public class MaterialServiceImpl implements MaterialService {
// 获取进位数量
int dispose = (int) (Math.floor(quantity / (double) splitInfo.getQuantity()));
// 获取当前入库数量
int realQuantity = quantity - dispose * splitInfo.getQuantity();
double realQuantity = quantity - dispose * splitInfo.getQuantity();
insertForSplitInventory.put("saveQuantity", realQuantity);
insertForSplitInventory.put("inQuantity", realQuantity);
insertForSplitInventory.put("saveQuantity", (int) (realQuantity * 100));
insertForSplitInventory.put("inQuantity", (int) (realQuantity * 100));
splitUnitMapper.addSplitInventory(insertForSplitInventory);
if (splitInfo.getParentId() != null) {
@ -1766,8 +1767,8 @@ public class MaterialServiceImpl implements MaterialService {
} else {
// 如果不大于进制数
insertForSplitInventory.put("saveQuantity", quantity);
insertForSplitInventory.put("inQuantity", quantity);
insertForSplitInventory.put("saveQuantity", (int) (quantity * 100));
insertForSplitInventory.put("inQuantity", (int) (quantity * 100));
splitUnitMapper.addSplitInventory(insertForSplitInventory);
}

2
target/classes/templates/pages/application/application-transfer.html

@ -1048,6 +1048,8 @@
layer.close(loading2);
});
}else{
layer.close(loading2);
}
}
});

Loading…
Cancel
Save