|
|
|
@ -18,6 +18,7 @@ import java.util.concurrent.TimeUnit; |
|
|
|
|
|
|
|
/** |
|
|
|
* 仓库记录 |
|
|
|
* |
|
|
|
* @author Dreamchaser |
|
|
|
*/ |
|
|
|
@RestController |
|
|
|
@ -41,7 +42,8 @@ public class DepositoryRecordController { |
|
|
|
@Autowired |
|
|
|
private QyWxOperationService qyWxOperationService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
private SplitUnitService splitUnitService; |
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/myApply") |
|
|
|
@ -183,6 +185,14 @@ public class DepositoryRecordController { |
|
|
|
map.put("applicantId", userToken.getId()); |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
if (params.size() < 1 && map.size() > 3) { |
|
|
|
String unit = (String)(map.get("unit")); |
|
|
|
if (!"-1".equals(unit)) { |
|
|
|
map.put("type","in"); |
|
|
|
Integer addSplitInventory = splitUnitService.addSplitInventory(map); |
|
|
|
if (addSplitInventory != -1) { |
|
|
|
integer += addSplitInventory; |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 获取库位id
|
|
|
|
Integer placeId = ObjectFormatUtil.toInteger(map.get("placeId")); |
|
|
|
if (placeId == 0) {// 如果插入到仓库
|
|
|
|
@ -194,6 +204,7 @@ public class DepositoryRecordController { |
|
|
|
integer += flag; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
List<Object> errMsg = new ArrayList<>(); |
|
|
|
List<Object> successMsg = new ArrayList<>(); |
|
|
|
@ -211,6 +222,18 @@ public class DepositoryRecordController { |
|
|
|
insert.put("producedDate", map.get("producedDate" + temp)); |
|
|
|
insert.put("qrCode", map.get("qrCode" + temp)); |
|
|
|
insert.put("barCode", map.get("barCode" + temp)); |
|
|
|
insert.put("unit",map.get("unit" + temp)); |
|
|
|
String unit = (String)(map.get("unit" + temp)); |
|
|
|
if (!"-1".equals(unit)) { |
|
|
|
insert.put("type","in"); |
|
|
|
Integer addSplitInventory = splitUnitService.addSplitInventory(insert); |
|
|
|
if (addSplitInventory != -1) { |
|
|
|
integer += addSplitInventory; |
|
|
|
successMsg.add(insert); |
|
|
|
}else{ |
|
|
|
errMsg.add(insert); |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (placeId == -1) { // 如果插入到仓库
|
|
|
|
insert.put("placeId", 0); |
|
|
|
Integer add = depositoryRecordService.applicationInPlace(insert); |
|
|
|
@ -231,6 +254,18 @@ public class DepositoryRecordController { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
String unit = (String)(map.get("unit")); |
|
|
|
if (!"-1".equals(unit)) { |
|
|
|
map.put("type","in"); |
|
|
|
Integer addSplitInventory = splitUnitService.addSplitInventory(map); |
|
|
|
if (addSplitInventory != -1) { |
|
|
|
integer += addSplitInventory; |
|
|
|
successMsg.add(map); |
|
|
|
}else{ |
|
|
|
errMsg.add(map); |
|
|
|
} |
|
|
|
} else { |
|
|
|
Integer placeId = ObjectFormatUtil.toInteger(map.get("placeId")); |
|
|
|
if (placeId != null) { |
|
|
|
if (placeId == -1) {// 如果插入到仓库
|
|
|
|
@ -252,6 +287,7 @@ public class DepositoryRecordController { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
result.put("err", errMsg); |
|
|
|
result.put("success", successMsg); |
|
|
|
} |
|
|
|
@ -263,8 +299,7 @@ public class DepositoryRecordController { |
|
|
|
} else { |
|
|
|
return new RestResponse(result, 666, new StatusInfo("错误", "含有错误信息")); |
|
|
|
} |
|
|
|
} |
|
|
|
else{ |
|
|
|
} else { |
|
|
|
return new RestResponse("", 666, new StatusInfo("存储失败", "请重新选择存储位")); |
|
|
|
} |
|
|
|
|
|
|
|
@ -298,8 +333,12 @@ public class DepositoryRecordController { |
|
|
|
map.remove("id"); |
|
|
|
map.put("parentId", id); |
|
|
|
} |
|
|
|
String unit = (String) map.get("unit"); |
|
|
|
if(!"-1".equals(unit)){ |
|
|
|
integer += splitUnitService.addSplitInventory(map); |
|
|
|
}else { |
|
|
|
integer += depositoryRecordService.insertApplicationOutMin(map); |
|
|
|
|
|
|
|
} |
|
|
|
// 开启一个线程执行发送信息操作
|
|
|
|
/*new Thread(new Runnable() { |
|
|
|
@Override |
|
|
|
@ -334,8 +373,7 @@ public class DepositoryRecordController { |
|
|
|
}).start(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
else{ |
|
|
|
} else { |
|
|
|
// 插入主订单
|
|
|
|
map.put("departmenthead", departmentHeadId.toString()); |
|
|
|
if (!map.containsKey("mid")) { |
|
|
|
@ -445,8 +483,7 @@ public class DepositoryRecordController { |
|
|
|
// 获取子订单键值
|
|
|
|
if (minRecord == null && Integer.compare(stateOnView, 0) == 0) { |
|
|
|
return new RestResponse(applicationOutRecordMinList, applicationOutRecordMinList.size(), 200); |
|
|
|
} |
|
|
|
else if(minRecord == null && Integer.compare(stateOnView,1) == 0){ |
|
|
|
} else if (minRecord == null && Integer.compare(stateOnView, 1) == 0) { |
|
|
|
minRecord = "[]"; |
|
|
|
} |
|
|
|
String[] split = minRecord.replace("[", "").replace("]", "").split(","); |
|
|
|
@ -490,7 +527,7 @@ public class DepositoryRecordController { |
|
|
|
// 设置展示时的数量为申请数-已出库数
|
|
|
|
simpleApplicationOutMinRecordP.setQuantity(applicationOutMinById.getQuantity() - applicationOutMinById.getTrueOut()); |
|
|
|
// 获取申请的物料信息
|
|
|
|
Inventory materialById = materialService.findInventoryByMid(applicationOutMinById.getMid()); |
|
|
|
Inventory materialById = materialService.findInventoryById(applicationOutMinById.getMid()); |
|
|
|
// 获取当前物料所存在的库位
|
|
|
|
List<PlaceP> placeByMidAndDid = placeService.findPlaceByMidAndDid(materialById.getId(), applicationOutMinById.getDepositoryId()); |
|
|
|
// 获取库位编码
|
|
|
|
@ -601,6 +638,7 @@ public class DepositoryRecordController { |
|
|
|
|
|
|
|
/** |
|
|
|
* 将选中的物料暂存到redis中 |
|
|
|
* |
|
|
|
* @param map |
|
|
|
* @param request |
|
|
|
* @return |
|
|
|
@ -629,6 +667,7 @@ public class DepositoryRecordController { |
|
|
|
|
|
|
|
/** |
|
|
|
* 将选中的物料从redis中删除 |
|
|
|
* |
|
|
|
* @param map |
|
|
|
* @param request |
|
|
|
* @return |
|
|
|
@ -814,6 +853,7 @@ public class DepositoryRecordController { |
|
|
|
|
|
|
|
/** |
|
|
|
* 自动生成出入库订单 |
|
|
|
* |
|
|
|
* @param map |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@ -837,7 +877,7 @@ public class DepositoryRecordController { |
|
|
|
// 获取库位编码
|
|
|
|
String placeCode = (String) (redisTemplateForHash.opsForList().index("placeCodes" + userToken.getId(), i)); |
|
|
|
// 获取物料信息
|
|
|
|
Inventory materialById = materialService.findInventoryByMid(mid); |
|
|
|
Inventory materialById = materialService.findInventoryById(mid); |
|
|
|
// 获取仓库信息
|
|
|
|
Depository depositoryRecordById = depositoryService.findDepositoryById(depositoryId); |
|
|
|
|
|
|
|
@ -860,6 +900,7 @@ public class DepositoryRecordController { |
|
|
|
|
|
|
|
/** |
|
|
|
* 构造出入库表单 |
|
|
|
* |
|
|
|
* @param map |
|
|
|
* @param request |
|
|
|
* @return |
|
|
|
@ -905,7 +946,7 @@ public class DepositoryRecordController { |
|
|
|
// 待出库物料id
|
|
|
|
Integer mid = ObjectFormatUtil.toInteger(map.get("iid")); |
|
|
|
// 获取库存信息
|
|
|
|
Inventory inventoryByMid = materialService.findInventoryByMid(mid); |
|
|
|
Inventory inventoryByMid = materialService.findInventoryById(mid); |
|
|
|
if (inventoryByMid.getQuantity() < quantity) { |
|
|
|
return new RestResponse("", 666, new StatusInfo("申请失败", "超出最大存储容量")); |
|
|
|
} |
|
|
|
@ -961,6 +1002,7 @@ public class DepositoryRecordController { |
|
|
|
|
|
|
|
/** |
|
|
|
* 构造多个出入库表单 |
|
|
|
* |
|
|
|
* @param map |
|
|
|
* @param request |
|
|
|
* @return |
|
|
|
@ -1024,8 +1066,7 @@ public class DepositoryRecordController { |
|
|
|
inRecord.put("applyRemark", applyRemark); |
|
|
|
success += depositoryRecordService.applicationInPlace(inRecord); |
|
|
|
} |
|
|
|
} |
|
|
|
else if("out".equals(type)){ |
|
|
|
} else if ("out".equals(type)) { |
|
|
|
Map<String, Object> mainRecord = new HashMap<>(); |
|
|
|
Integer sumQuantity = 0; |
|
|
|
for (int i = 0; i < quantitys.size(); i++) { |
|
|
|
|