|
|
|
@ -867,10 +867,13 @@ public class DepositoryRecordController { |
|
|
|
public RestResponse applicantMultiCreate(@RequestParam Map<String, Object> map, HttpServletRequest request) { |
|
|
|
Integer page = ObjectFormatUtil.toInteger(map.get("page")); |
|
|
|
Integer pagesize = ObjectFormatUtil.toInteger(map.get("size")); |
|
|
|
Integer start = (page - 1) * pagesize; |
|
|
|
int start = (page - 1) * pagesize; |
|
|
|
Integer end = page * 10; |
|
|
|
UserByPort userToken = (UserByPort) request.getAttribute("userToken"); |
|
|
|
Long size = redisTemplateForHash.boundListOps("mids" + userToken.getId()).size(); |
|
|
|
if(size == null){ |
|
|
|
size = 0L; |
|
|
|
} |
|
|
|
if (end > size) { |
|
|
|
end = ObjectFormatUtil.toInteger(size); |
|
|
|
} |
|
|
|
@ -892,16 +895,17 @@ public class DepositoryRecordController { |
|
|
|
ap.setDepositoryName(depositoryRecordById.getDname()); |
|
|
|
ap.setMid(materialById.getMid()); |
|
|
|
ap.setIid(materialById.getId()); |
|
|
|
ap.setPlaceCode(placeCode); |
|
|
|
ap.setVersion(materialById.getVersion()); |
|
|
|
ap.setMname(materialById.getMname()); |
|
|
|
ap.setCode(materialById.getCode()); |
|
|
|
ap.setPrice(materialById.getPrice()); |
|
|
|
ap.setApplicant(userToken.getId()); |
|
|
|
ap.setQuantity(1.0); |
|
|
|
ap.setUnit(materialById.getUnit()); |
|
|
|
|
|
|
|
|
|
|
|
ap.setUnit("-1"); |
|
|
|
ap.setShowUnit(materialById.getUnit()); |
|
|
|
String[] placeCodes = placeCode.split(" "); |
|
|
|
ap.setPlaceCodes(placeCodes); |
|
|
|
ap.setPlaceCode(placeCodes[0]); |
|
|
|
List<SplitInfo> splitInfoByMid = splitUnitService.findSplitInfoByMid(materialById.getMid()); |
|
|
|
ap.setSplitInfoList(splitInfoByMid); |
|
|
|
list.add(ap); |
|
|
|
@ -926,7 +930,6 @@ public class DepositoryRecordController { |
|
|
|
map.put("price", map.get("price").toString()); |
|
|
|
map.put("applicantId", userToken.getId()); |
|
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
|
|
|
|
|
String placeCode = (String) map.get("placeCode"); |
|
|
|
placeCode = placeCode.trim(); |
|
|
|
param.put("code", placeCode); |
|
|
|
@ -1042,6 +1045,7 @@ public class DepositoryRecordController { |
|
|
|
List<String> placeCodes = (List<String>) map.get("placeCodes"); |
|
|
|
List<String> applyRemarks = (List<String>) map.get("applyRemarks"); |
|
|
|
List<Object> prices = (List<Object>) map.get("prices"); |
|
|
|
List<String> units = (List<String>)map.get("units"); |
|
|
|
String errMsg = ""; |
|
|
|
Integer id = 0; |
|
|
|
if ("in".equals(type)) { |
|
|
|
@ -1053,44 +1057,43 @@ public class DepositoryRecordController { |
|
|
|
// 获取当前申请数量
|
|
|
|
Integer integer = ObjectFormatUtil.toInteger(quantitys.get(i)); |
|
|
|
String quantity = integer.toString(); |
|
|
|
// 获取每个库位编码
|
|
|
|
String[] s = placeCode.split(" "); |
|
|
|
// 先定义最终要使用的库位,默认是默认库位
|
|
|
|
Integer place = 0; |
|
|
|
if (s.length > 1) { |
|
|
|
// 获取当前仓库所有库位
|
|
|
|
List<Place> placeByDid = placeService.findPlaceByDid(depositoryId); |
|
|
|
// 遍历当前物料存储的库位
|
|
|
|
for (int j = 0; j < s.length; j++) { |
|
|
|
Place place1 = placeByDid.get(j); |
|
|
|
if (placeCode.equals(place1.getCode())) { |
|
|
|
// 如果当前物料存放在当前库位
|
|
|
|
if (place1.getMax() - place1.getQuantity() >= integer) { |
|
|
|
// 如果当前库位能够存放当前数量
|
|
|
|
place = place1.getId(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
Integer placeId = 0; |
|
|
|
|
|
|
|
if(!"0000".equals(placeCode)){ |
|
|
|
// 如果当前选择的不是默认库位
|
|
|
|
Place place = placeService.findPlaceByDidAndCode(depositoryId, placeCode); |
|
|
|
placeId = place.getId(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Integer mid = mids.get(i); |
|
|
|
String price = prices.get(i).toString(); |
|
|
|
String applyRemark = applyRemarks.get(i); |
|
|
|
String unit = units.get(i); |
|
|
|
Map<String, Object> inRecord = new HashMap<>(); |
|
|
|
inRecord.put("applicantId", userToken.getId()); |
|
|
|
inRecord.put("mid", mid); |
|
|
|
inRecord.put("placeId", place); |
|
|
|
inRecord.put("placeId", placeId); |
|
|
|
inRecord.put("depositoryId", depositoryId); |
|
|
|
inRecord.put("quantity", quantity); |
|
|
|
inRecord.put("price", price); |
|
|
|
inRecord.put("applyRemark", applyRemark); |
|
|
|
success += depositoryRecordService.applicationInPlace(inRecord); |
|
|
|
if (!"-1".equals(unit)) { |
|
|
|
map.put("type","in"); |
|
|
|
Integer addSplitInventory = splitUnitService.addSplitInventory(inRecord); |
|
|
|
if (addSplitInventory != -1) { |
|
|
|
success += addSplitInventory; |
|
|
|
} |
|
|
|
} else { |
|
|
|
success += depositoryRecordService.applicationInPlace(inRecord); |
|
|
|
} |
|
|
|
} |
|
|
|
} else if ("out".equals(type)) { |
|
|
|
Map<String, Object> mainRecord = new HashMap<>(); |
|
|
|
Integer sumQuantity = 0; |
|
|
|
for (int i = 0; i < quantitys.size(); i++) { |
|
|
|
Integer integer = ObjectFormatUtil.toInteger(quantitys.get(i)); |
|
|
|
for (Object o : quantitys) { |
|
|
|
Integer integer = ObjectFormatUtil.toInteger(o); |
|
|
|
sumQuantity += integer; |
|
|
|
} |
|
|
|
// 获取部门负责人
|
|
|
|
|