Browse Source

完成入库功能修改

lwx_dev
erdanergou 3 years ago
parent
commit
39078e5dbd
  1. 4
      src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java
  2. 25
      src/main/java/com/dreamchaser/depository_manage/service/impl/GroupServiceImpl.java
  3. 30
      src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java
  4. 8
      src/main/resources/templates/pages/application/application-in.html
  5. 8
      target/classes/templates/pages/application/application-in.html
  6. 35
      target/classes/templates/pages/split/split_add.html

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

@ -2631,13 +2631,13 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
if (mproducedDate == null) { if (mproducedDate == null) {
mproducedDate = 0L; mproducedDate = 0L;
} }
Integer newMid = updateOrInsertInventory(paramForUpdateInventory, materialByCondition, (double) recordP.getQuantity(), materialById.getId(), recordP.getDepositoryId(), mproducedDate); Integer newMid = updateOrInsertInventory(paramForUpdateInventory, materialByCondition, (double) recordP.getQuantity() / 100, materialById.getId(), recordP.getDepositoryId(), mproducedDate);
// 修改库位库存 // 修改库位库存
paramForUpdateInventory.put("newInMid", newMid); paramForUpdateInventory.put("newInMid", newMid);
paramForUpdateInventory.put("id", recordP.getId()); paramForUpdateInventory.put("id", recordP.getId());
paramForUpdateInventory.put("producedDate", recordP.getMproducedDate()); paramForUpdateInventory.put("producedDate", recordP.getMproducedDate());
Place placeById = placeMapper.findPlaceById(recordP.getPlaceId()); Place placeById = placeMapper.findPlaceById(recordP.getPlaceId());
updateInventoryInfoForApproval(paramForUpdateInventory, recordP.getQuantity(), materialById, placeById); updateInventoryInfoForApproval(paramForUpdateInventory, recordP.getQuantity() / 100, materialById, placeById);
} else { } else {
// 如果是拆单单位 // 如果是拆单单位

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

@ -841,14 +841,6 @@ public class GroupServiceImpl implements GroupService {
// 获取入库的仓库 // 获取入库的仓库
Integer depositoryId = ObjectFormatUtil.toInteger(map.get("depositoryId")); 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<>(); Map<String, Object> insertForApplicationInRecord = new HashMap<>();
@ -856,7 +848,7 @@ public class GroupServiceImpl implements GroupService {
insertForApplicationInRecord.put("applicantId", userToken.getId()); insertForApplicationInRecord.put("applicantId", userToken.getId());
// 获取当前入库的组合数量 // 获取当前入库的组合数量
Integer quantityForGroup = ObjectFormatUtil.toInteger(map.get("quantity")); Double quantityForGroup = ObjectFormatUtil.toDouble(map.get("quantity"));
// 获取要出库的组合 // 获取要出库的组合
Integer gid = ObjectFormatUtil.toInteger(map.get("gid")); Integer gid = ObjectFormatUtil.toInteger(map.get("gid"));
@ -872,9 +864,21 @@ public class GroupServiceImpl implements GroupService {
insertForApplicationInRecord.put("placeId", placeId); insertForApplicationInRecord.put("placeId", placeId);
insertForApplicationInRecord.put("applyRemark", map.get("applyRemark")); insertForApplicationInRecord.put("applyRemark", map.get("applyRemark"));
// 用于标志该是否需要进行审批
boolean flagForApproval = false; // 默认不需要
// 循环当前组合信息 // 循环当前组合信息
for (GroupInfo groupInfo : for (GroupInfo groupInfo :
groupInfoByGid) { groupInfoByGid) {
// 获取当前类型是否有用户进行管理入库审批
Map<String, Object> paramForMtRole = new HashMap<>();
paramForMtRole.put("mtid", groupInfo.getMtid());
List<RoleAndMaterialType> roleAndMaterials = roleMapper.findRoleAndMaterialTypeByCondition(paramForMtRole);
if (roleAndMaterials.size() > 0 ) {
flagForApproval = true; // 需要
}
// 获取当前组合记录中的单位 // 获取当前组合记录中的单位
String unit = groupInfo.getUnit(); String unit = groupInfo.getUnit();
insertForApplicationInRecord.put("mid", groupInfo.getMid()); insertForApplicationInRecord.put("mid", groupInfo.getMid());
@ -913,9 +917,10 @@ public class GroupServiceImpl implements GroupService {
insertForApplicationInRecord.remove("applicationInId"); insertForApplicationInRecord.remove("applicationInId");
} }
} }
map.put("flagForApproval", flagForApproval);
insertForApplicationInRecord.remove("toGroupId"); insertForApplicationInRecord.remove("toGroupId");
insertForApplicationInRecord.put("flagForGroup", 2); insertForApplicationInRecord.put("flagForGroup", 2);
insertForApplicationInRecord.put("quantity", quantityForGroup.toString()); insertForApplicationInRecord.put("quantity", quantityForGroup * 100);
insertForApplicationInRecord.put("mid", gid); insertForApplicationInRecord.put("mid", gid);
insertForApplicationInRecord.put("unit", -1); insertForApplicationInRecord.put("unit", -1);
Depository depository = depositoryMapper.findDepositoryById(depositoryId); Depository depository = depositoryMapper.findDepositoryById(depositoryId);

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

@ -219,26 +219,6 @@ public class MaterialServiceImpl implements MaterialService {
} else { } else {
material.setPrice(0.0); material.setPrice(0.0);
} }
material.setAmounts(material.getPrice() * material.getQuantity());
// 获取当前物料所处仓库
Integer depositoryId = material.getDepositoryId();
// 获取当前物料所处库位
StringBuilder placeCode = new StringBuilder();
if (depositoryId != null) {
Integer mid = material.getId();
List<PlaceP> placeByMidAndDid = placeService.findPlaceByMidAndDid(mid, depositoryId);
for (int j = 0; j < placeByMidAndDid.size(); j++) {
placeCode.append(placeByMidAndDid.get(j).getCode()).append(" ");
}
}
if (depositoryId != null) {
Depository depositoryRecordById = depositoryMapper.findDepositoryById(depositoryId);
String code = depositoryRecordById.getCode();
material.setDepositoryCode(code);
}
material.setPlaceCode(placeCode.toString());
} }
return packForMatieral(list); return packForMatieral(list);
} }
@ -894,11 +874,11 @@ public class MaterialServiceImpl implements MaterialService {
splitInfoByMid = new ArrayList<>(); splitInfoByMid = new ArrayList<>();
} }
Map<String, Object> paramByBarcode = new HashMap<>(); // Map<String, Object> paramByBarcode = new HashMap<>();
paramByBarcode.put("mcode", m.getCode()); // paramByBarcode.put("mcode", m.getCode());
paramByBarcode.put("codeFlag", 1); // paramByBarcode.put("codeFlag", 1);
List<MaterialAndBarCode> materialByBarCodeByCondition = materialMapper.findMaterialByBarCodeByCondition(paramByBarcode); // List<MaterialAndBarCode> materialByBarCodeByCondition = materialMapper.findMaterialByBarCodeByCondition(paramByBarcode);
m.setMaterialAndBarCodeList(materialByBarCodeByCondition); // m.setMaterialAndBarCodeList(materialByBarCodeByCondition);
m.setSplitInfoList(splitInfoByMid); m.setSplitInfoList(splitInfoByMid);
MaterialType materialTypeByOldId = materialTypeMapper.findMaterialTypeByOldId(material.getMaterialTypeId()); MaterialType materialTypeByOldId = materialTypeMapper.findMaterialTypeByOldId(material.getMaterialTypeId());
m.setTypeName(materialTypeByOldId.getTname()); m.setTypeName(materialTypeByOldId.getTname());

8
src/main/resources/templates/pages/application/application-in.html

@ -473,7 +473,9 @@
if (data.status >= 300) { if (data.status >= 300) {
var d = data.data; var d = data.data;
if (d === "") { if (d === "") {
layer.msg(data.statusInfo.detail); layer.msg(data.statusInfo.detail,{icon:0,time:500},function () {
flagForForm = false;
});
} else { } else {
var err = d["err"]; var err = d["err"];
var success = d["success"]; var success = d["success"];
@ -531,7 +533,9 @@
success: function (d) { success: function (d) {
layer.close(this.layerIndex); layer.close(this.layerIndex);
if (d.status >= 300) { if (d.status >= 300) {
layer.msg(d.statusInfo.detail);//失败的表情 layer.msg(d.statusInfo.detail,{icon:5,time:1000},function() {
GroupflagForForm = false;
});//失败的表情
} else { } else {
layer.msg("申请提交成功", { layer.msg("申请提交成功", {

8
target/classes/templates/pages/application/application-in.html

@ -473,7 +473,9 @@
if (data.status >= 300) { if (data.status >= 300) {
var d = data.data; var d = data.data;
if (d === "") { if (d === "") {
layer.msg(data.statusInfo.detail); layer.msg(data.statusInfo.detail,{icon:0,time:500},function () {
flagForForm = false;
});
} else { } else {
var err = d["err"]; var err = d["err"];
var success = d["success"]; var success = d["success"];
@ -531,7 +533,9 @@
success: function (d) { success: function (d) {
layer.close(this.layerIndex); layer.close(this.layerIndex);
if (d.status >= 300) { if (d.status >= 300) {
layer.msg(d.statusInfo.detail);//失败的表情 layer.msg(d.statusInfo.detail,{icon:5,time:1000},function() {
GroupflagForForm = false;
});//失败的表情
} else { } else {
layer.msg("申请提交成功", { layer.msg("申请提交成功", {

35
target/classes/templates/pages/split/split_add.html

@ -236,6 +236,7 @@
data = data.split(",")[0]; data = data.split(",")[0];
if(data !== ""){ if(data !== ""){
req.mname = data; req.mname = data;
let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
let materialId = $("#mid"); let materialId = $("#mid");
let codeValue = $("#code"); let codeValue = $("#code");
let version = $("#version"); let version = $("#version");
@ -249,21 +250,27 @@
contentType: "application/json;charset=utf-8", contentType: "application/json;charset=utf-8",
success: function (d) { success: function (d) {
if (d.count > 1) { if (d.count > 1) {
layer.msg("请点击右侧搜索确定物品"); layer.msg("请点击右侧搜索确定物品",{icon:0,time:500},function () {
materialId.val(""); materialId.val("");
codeValue.val(""); codeValue.val("");
version.val(""); version.val("");
typeName.val(""); typeName.val("");
unit.empty(); unit.empty();
layer.close(loading2);
});
return false; return false;
} else if (d.count === 0) { } else if (d.count === 0) {
layer.msg("没有该物品,请确认输入是否正确"); layer.msg("没有该物品,请确认输入是否正确",{icon:0,time:500},function () {
materialId.val(""); materialId.val("");
codeValue.val(""); codeValue.val("");
materialName.val(""); materialName.val("");
version.val(""); version.val("");
typeName.val(""); typeName.val("");
unit.empty(); unit.empty();
layer.close(loading2);
});
return false; return false;
} else { } else {
var material = d.data[0]; var material = d.data[0];
@ -292,6 +299,7 @@
} else { } else {
$("#barCode").empty(); $("#barCode").empty();
} }
layer.close(loading2);
} }
} }
}); });
@ -323,6 +331,7 @@
end: function () { end: function () {
var mid = $("#mid").val(); var mid = $("#mid").val();
if (mid !== '') { if (mid !== '') {
let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({ $.ajax({
url: "/material/findMatrialById?mid=" + mid, url: "/material/findMatrialById?mid=" + mid,
type: "get", type: "get",
@ -349,7 +358,7 @@
if (materialAndBarCodeList !== null && materialAndBarCodeList.length > 0) { if (materialAndBarCodeList !== null && materialAndBarCodeList.length > 0) {
// 如果有对应的条形码 // 如果有对应的条形码
$("#barCode").empty() $("#barCode").empty();
$.each(materialAndBarCodeList, function (index, item) { $.each(materialAndBarCodeList, function (index, item) {
$("#barCode").append(new Option(item.bmcode, item.id));//往下拉菜单里添加元素 $("#barCode").append(new Option(item.bmcode, item.id));//往下拉菜单里添加元素
}); });
@ -358,6 +367,7 @@
$("#barCode").empty(); $("#barCode").empty();
} }
layer.close(loading2);
} }
}); });
} }
@ -385,6 +395,8 @@
var req = {}; var req = {};
req.qrCode = result; req.qrCode = result;
req.codeFlag = 2; req.codeFlag = 2;
let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({ $.ajax({
url: "/material/qywxApplicationInScanQrCode", url: "/material/qywxApplicationInScanQrCode",
type: "post", type: "post",
@ -406,6 +418,7 @@
$("#version").val(""); $("#version").val("");
$("#barCode").empty(); $("#barCode").empty();
$("#unit").empty(); $("#unit").empty();
layer.close(loading2);
}) })
} else { } else {
// 如果有对应关系 // 如果有对应关系
@ -441,6 +454,7 @@
unit.append(new Option(unitList[i].newUnit, unitList[i].newUnit)); unit.append(new Option(unitList[i].newUnit, unitList[i].newUnit));
} }
form.render(); form.render();
layer.close(loading2);
} }
} }
@ -470,6 +484,7 @@
let barCode = $("#barCode"); let barCode = $("#barCode");
barCode.empty(); barCode.empty();
barCode.append(new Option(result, result)); barCode.append(new Option(result, result));
let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({ $.ajax({
url: "/material/qywxApplicationInScanBarCode", url: "/material/qywxApplicationInScanBarCode",
type: "post", type: "post",
@ -494,7 +509,7 @@
}); });
} }
form.render(); form.render();
layer.close(loading2);
} }
else { else {
@ -509,6 +524,7 @@
$("#version").val(""); $("#version").val("");
unit.empty(); unit.empty();
$("#barCode").empty(); $("#barCode").empty();
layer.close(loading2);
}) })
} }
@ -533,6 +549,8 @@
var req = {}; var req = {};
req.code = code; req.code = code;
req.type = "in"; req.type = "in";
if(code !== ""){
let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({ $.ajax({
url: "/material/findMatrialByCode", url: "/material/findMatrialByCode",
type: "get", type: "get",
@ -542,7 +560,7 @@
success: function (d) { success: function (d) {
var d = d.data; var d = d.data;
if (d == null) { if (d == null) {
layer.msg("没有该编码,请确认是否输入正确"); layer.msg("没有该编码,请确认是否输入正确",{icon:0,time:500},function () {
$("#mname").val(""); $("#mname").val("");
$("#mid").val(""); $("#mid").val("");
$("#code").val(""); $("#code").val("");
@ -551,6 +569,9 @@
$("#unit").empty(); $("#unit").empty();
$("#typeName").val(""); $("#typeName").val("");
form.render(); form.render();
layer.close(loading2);
});
} else { } else {
$("#mname").val(d.mname); $("#mname").val(d.mname);
@ -587,11 +608,13 @@
$(children[1]).empty(); $(children[1]).empty();
} }
} }
layer.close(loading2);
} }
} }
}); });
}
}; };
}) })

Loading…
Cancel
Save