|
|
|
@ -698,6 +698,7 @@ public class GroupServiceImpl implements GroupService { |
|
|
|
|
|
|
|
/** |
|
|
|
* 插入一条入库记录 |
|
|
|
* |
|
|
|
* @param map 具体数据 |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@ -706,7 +707,6 @@ public class GroupServiceImpl implements GroupService { |
|
|
|
public Integer insertApplicationInRecord(Map<String, Object> map, UserByPort userToken) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取当前提交数
|
|
|
|
List<String> params = (List<String>) map.get("params"); |
|
|
|
|
|
|
|
@ -732,6 +732,7 @@ public class GroupServiceImpl implements GroupService { |
|
|
|
|
|
|
|
/** |
|
|
|
* 用于处理组合入库时的库位 |
|
|
|
* |
|
|
|
* @param map 入库数据 |
|
|
|
* @param userToken 入库人员 |
|
|
|
* @param flag 标志是否需要保存入库单号(true时不需要,false时需要) |
|
|
|
@ -741,10 +742,23 @@ public class GroupServiceImpl implements GroupService { |
|
|
|
// 用于存储申请数
|
|
|
|
Integer result = 0; |
|
|
|
|
|
|
|
// 定义列表用于储存入库单id
|
|
|
|
List<Integer> recordIds = new ArrayList<>(); |
|
|
|
// 定义列表用于存储入库仓库id
|
|
|
|
List<Integer> depositoryIds = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
// 获取入库的仓库
|
|
|
|
Integer depositoryId = ObjectFormatUtil.toInteger(map.get("depositoryId")); |
|
|
|
|
|
|
|
List<RoleAndDepository> depositoryIdForIn = roleMapper.findRoleAndDepositoryByDepositoryIdForIn(depositoryId); |
|
|
|
|
|
|
|
// 用于标志该仓库是否需要进行审批
|
|
|
|
boolean flagForApproval = false; // 默认不需要
|
|
|
|
if (depositoryIdForIn.size() > 0) { |
|
|
|
flagForApproval = true; // 需要
|
|
|
|
} |
|
|
|
map.put("flagForApproval", flagForApproval); |
|
|
|
|
|
|
|
// 定义参数用与入库
|
|
|
|
Map<String, Object> insertForApplicationInRecord = new HashMap<>(); |
|
|
|
@ -783,16 +797,31 @@ public class GroupServiceImpl implements GroupService { |
|
|
|
Material material = materialMapper.findMaterialById(groupInfo.getMid()); |
|
|
|
insertForApplicationInRecord.put("unit", material.getUnit()); |
|
|
|
result += depositoryRecordService.applicationInPlace(insertForApplicationInRecord, false); |
|
|
|
depositoryRecordMapper.deleteApplicationInRecordById(ObjectFormatUtil.toInteger(insertForApplicationInRecord.get("id"))); |
|
|
|
if (!flagForApproval) { |
|
|
|
// 当不需要审批时删除冗余订单
|
|
|
|
depositoryRecordMapper.deleteApplicationInRecordById(ObjectFormatUtil.toInteger(insertForApplicationInRecord.get("applicationInId"))); |
|
|
|
} else { |
|
|
|
// 如果需要将其添加到列表中待后续使用
|
|
|
|
recordIds.add(ObjectFormatUtil.toInteger(map.get("applicationInId"))); |
|
|
|
depositoryIds.add(ObjectFormatUtil.toInteger(map.get("depositoryId"))); |
|
|
|
} |
|
|
|
} else { |
|
|
|
insertForApplicationInRecord.put("price", String.valueOf(0)); |
|
|
|
insertForApplicationInRecord.put("unit", unit); |
|
|
|
insertForApplicationInRecord.put("type", "in"); |
|
|
|
result += splitUnitService.addSplitInventory(insertForApplicationInRecord); |
|
|
|
if (!flagForApproval) { |
|
|
|
// 当不需要审批时删除冗余订单
|
|
|
|
depositoryRecordMapper.deleteApplicationInRecordById(ObjectFormatUtil.toInteger(insertForApplicationInRecord.get("applicationInId"))); |
|
|
|
} else { |
|
|
|
// 如果需要将其添加到列表中待后续使用
|
|
|
|
recordIds.add(ObjectFormatUtil.toInteger(map.get("applicationInId"))); |
|
|
|
depositoryIds.add(ObjectFormatUtil.toInteger(map.get("depositoryId"))); |
|
|
|
} |
|
|
|
insertForApplicationInRecord.remove("applicationInId"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
insertForApplicationInRecord.put("flagForGroup", 2); |
|
|
|
insertForApplicationInRecord.put("quantity", quantityForGroup.toString()); |
|
|
|
insertForApplicationInRecord.put("mid", gid); |
|
|
|
@ -800,13 +829,12 @@ public class GroupServiceImpl implements GroupService { |
|
|
|
Depository depository = depositoryMapper.findDepositoryById(depositoryId); |
|
|
|
insertForApplicationInRecord.put("code", depositoryRecordService.createCode(depository.getDname(), "InOrderNumber", "in", "")); |
|
|
|
insertForApplicationInRecord.put("applicant_time", System.currentTimeMillis()); |
|
|
|
// 添加一个组合订单用于展示
|
|
|
|
depositoryRecordMapper.insertApplicationInRecord(insertForApplicationInRecord); |
|
|
|
if(!flag){ |
|
|
|
depositoryRecordMapper.deleteApplicationInRecordById(ObjectFormatUtil.toInteger(insertForApplicationInRecord.get("applicationInId"))); |
|
|
|
insertForApplicationInRecord.remove("applicationInId"); |
|
|
|
} |
|
|
|
insertForApplicationInRecord.remove("id"); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 用于插入子出库订单 |
|
|
|
* |
|
|
|
|