Browse Source

抽离组合入库相同方法

lwx_dev
erdanergou 3 years ago
parent
commit
bc995e8260
  1. 4
      src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java
  2. 91
      src/main/java/com/dreamchaser/depository_manage/service/impl/GroupServiceImpl.java
  3. 24
      target/classes/templates/pages/other/welcome.html
  4. 21
      target/classes/templates/pages/other/welcome_mobile.html

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

@ -2579,6 +2579,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 获取具体入库订单
ApplicationInRecordP recordP = depositoryRecordMapper.findApplicationInRecordPById(ObjectFormatUtil.toInteger(id));
// 用于判断当前入库的是组合还是物料
Integer flagForGroup = recordP.getFlagForGroup();
// 获取当前入库对应的物料
Material materialById = materialMapper.findMaterialById(recordP.getMid());

91
src/main/java/com/dreamchaser/depository_manage/service/impl/GroupServiceImpl.java

@ -704,74 +704,53 @@ public class GroupServiceImpl implements GroupService {
@Transactional(rollbackFor = Exception.class)
@Override
public Integer insertApplicationInRecord(Map<String, Object> map, UserByPort userToken) {
// 获取当前提交数
List<String> params = (List<String>) map.get("params");
// 用于存储申请数
Integer result = 0;
// 定义参数用与入库
Map<String,Object> insertForApplicationInRecord = new HashMap<>();
insertForApplicationInRecord.put("applicantId", userToken.getId());
// 循环参数列表
for (String temp : params) {
// 获取当前入库的组合数量
Integer quantityForGroup = ObjectFormatUtil.toInteger(map.get("quantity" + temp));
Map<String,Object> paramForMethod = new HashMap<>();
paramForMethod.put("quantity",map.get("quantity" + temp));
paramForMethod.put("gid",map.get("gid" + temp));
paramForMethod.put("placeId",map.get("placeId" + temp));
paramForMethod.put("depositoryId",map.get("depositoryId" + temp));
paramForMethod.put("applyRemark",map.get("applyRemark" + temp));
result += insertOrUpdateInventoryForGroupInfo(paramForMethod,userToken,true);
// 获取要出库的组合
Integer gid = ObjectFormatUtil.toInteger(map.get("gid"+temp));
}
result += insertOrUpdateInventoryForGroupInfo(map,userToken,false);
return result;
}
/**
* 用于处理组合入库时的库位
* @param map 入库数据
* @param userToken 入库人员
* @param flag 标志是否需要保存入库单号true时不需要false时需要
* @return
*/
Integer insertOrUpdateInventoryForGroupInfo(Map<String,Object> map,UserByPort userToken,boolean flag){
// 用于存储申请数
Integer result = 0;
// 获取要出库组合的具体信息
List<GroupInfo> groupInfoByGid = groupMapper.findGroupInfoByGid(gid);
// 获取入库的库位
Integer placeId = ObjectFormatUtil.toInteger(map.get("placeId" + temp));
// 获取入库的仓库
Integer depositoryId = ObjectFormatUtil.toInteger(map.get("depositoryId" + temp));
// 获取入库的仓库
Integer depositoryId = ObjectFormatUtil.toInteger(map.get("depositoryId"));
insertForApplicationInRecord.put("depositoryId",depositoryId);
insertForApplicationInRecord.put("placeId",placeId);
insertForApplicationInRecord.put("applyRemark", map.get("applyRemark" + temp));
// 循环当前组合信息
for (GroupInfo groupInfo :
groupInfoByGid) {
// 获取当前组合记录中的单位
String unit = groupInfo.getUnit();
insertForApplicationInRecord.put("mid",groupInfo.getMid());
insertForApplicationInRecord.put("quantity",String.valueOf(groupInfo.getQuantity() * quantityForGroup));
insertForApplicationInRecord.put("code",groupInfo.getMcode());
if("-1".equals(unit)){
// 如果是基础单位
Material material = materialMapper.findMaterialById(groupInfo.getMid());
insertForApplicationInRecord.put("unit",material.getUnit());
insertForApplicationInRecord.put("price", String.valueOf(0));
result += depositoryRecordService.applicationInPlace(insertForApplicationInRecord,false);
depositoryRecordMapper.deleteApplicationInRecordById(ObjectFormatUtil.toInteger(insertForApplicationInRecord.get("id")));
}else{
insertForApplicationInRecord.put("unit",unit);
insertForApplicationInRecord.put("type","in");
insertForApplicationInRecord.put("price", String.valueOf(0));
result += splitUnitService.addSplitInventory(insertForApplicationInRecord);
depositoryRecordMapper.deleteApplicationInRecordById(ObjectFormatUtil.toInteger(insertForApplicationInRecord.get("applicationInId")));
insertForApplicationInRecord.remove("applicationInId");
}
// 定义参数用与入库
Map<String,Object> insertForApplicationInRecord = new HashMap<>();
}
insertForApplicationInRecord.put("flagForGroup",2);
insertForApplicationInRecord.put("quantity",quantityForGroup.toString());
insertForApplicationInRecord.put("mid",gid);
insertForApplicationInRecord.put("unit",-1);
Depository depository = depositoryMapper.findDepositoryById(depositoryId);
insertForApplicationInRecord.put("code",depositoryRecordService.createCode(depository.getDname(), "InOrderNumber", "in", ""));
insertForApplicationInRecord.put("applicant_time",System.currentTimeMillis());
depositoryRecordMapper.insertApplicationInRecord(insertForApplicationInRecord);
insertForApplicationInRecord.remove("id");
}
insertForApplicationInRecord.put("applicantId", userToken.getId());
// 获取当前入库的组合数量
Integer quantityForGroup = ObjectFormatUtil.toInteger(map.get("quantity"));
@ -784,8 +763,7 @@ public class GroupServiceImpl implements GroupService {
// 获取入库的库位
Integer placeId = ObjectFormatUtil.toInteger(map.get("placeId"));
// 获取入库的仓库
Integer depositoryId = ObjectFormatUtil.toInteger(map.get("depositoryId"));
insertForApplicationInRecord.put("depositoryId",depositoryId);
insertForApplicationInRecord.put("placeId",placeId);
@ -823,9 +801,12 @@ public class GroupServiceImpl implements GroupService {
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");
}
return result;
}
/**
* 用于插入子出库订单
*

24
target/classes/templates/pages/other/welcome.html

@ -413,7 +413,26 @@
$(window).on("resize", function () {
layer.full(index);
});
} else if (type === "库存盘点请求") {
}
else if (type === '入库请求') {
var index = layer.open({
title: '请求详情',
type: 2,
shade: 0.2,
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/application_in_review?id=' + id,
end: function () {
location.reload()
}
});
$(window).on("resize", function () {
layer.full(index);
});
}
else if (type === "库存盘点请求") {
var index = layer.open({
title: '请求详情',
type: 2,
@ -429,7 +448,8 @@
$(window).on("resize", function () {
layer.full(index);
});
} else if (type === "物料出库请求") {
}
else if (type === "物料出库请求") {
var index = layer.open({
title: '请求详情',
type: 2,

21
target/classes/templates/pages/other/welcome_mobile.html

@ -418,7 +418,26 @@
$(window).on("resize", function () {
layer.full(index);
});
} else if (type === "库存盘点请求") {
}
else if (type === '入库请求') {
var index = layer.open({
title: '请求详情',
type: 2,
shade: 0.2,
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/application_in_review?id=' + id,
end: function () {
location.reload()
}
});
$(window).on("resize", function () {
layer.full(index);
});
}
else if (type === "库存盘点请求") {
var index = layer.open({
title: '请求详情',
type: 2,

Loading…
Cancel
Save