Browse Source

修改库存查询页面

lwx_dev
erdanergou 3 years ago
parent
commit
3e07a83f45
  1. 9
      src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java
  2. 4
      src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java
  3. 5
      src/main/java/com/dreamchaser/depository_manage/pojo/InventoryP.java
  4. 6
      src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java
  5. 31
      src/main/resources/templates/pages/application/application_multi.html
  6. 39
      src/main/resources/templates/pages/depository/table-stock.html
  7. 31
      target/classes/templates/pages/application/application_multi.html
  8. 39
      target/classes/templates/pages/depository/table-stock.html

9
src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java

@ -941,7 +941,16 @@ public class DepositoryRecordController {
String type = (String) map.get("type"); String type = (String) map.get("type");
Integer success = 0; Integer success = 0;
if ("in".equals(type)) { if ("in".equals(type)) {
String unit = (String)(map.get("unit"));
if (!"-1".equals(unit)) {
map.put("type","in");
Integer addSplitInventory = splitUnitService.addSplitInventory(map);
if (addSplitInventory != -1) {
success += addSplitInventory;
}
} else {
success += depositoryRecordService.applicationInPlace(map); success += depositoryRecordService.applicationInPlace(map);
}
} else if ("out".equals(type)) { } else if ("out".equals(type)) {
// 获取部门负责人 // 获取部门负责人
List<UserByPort> departmentHeadByUsers = LinkInterfaceUtil.findDepartmentHeadByUser(userToken); List<UserByPort> departmentHeadByUsers = LinkInterfaceUtil.findDepartmentHeadByUser(userToken);

4
src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java

@ -173,6 +173,10 @@ public class MaterialController {
list.addAll(inventory); list.addAll(inventory);
total += materialService.findInventoryCount(map); total += materialService.findInventoryCount(map);
} }
for (InventoryP inventoryP :list
) {
inventoryP.setSplitInfoList(splitUnitService.findSplitInfoByMid(inventoryP.getMid()));
}
return new RestResponse(list, total, 200); return new RestResponse(list, total, 200);
} }

5
src/main/java/com/dreamchaser/depository_manage/pojo/InventoryP.java

@ -7,6 +7,7 @@ import com.dreamchaser.depository_manage.entity.SplitInfo;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
import java.util.Map;
@Data @Data
public class InventoryP { public class InventoryP {
@ -175,7 +176,9 @@ public class InventoryP {
/** /**
* 用于展示的数量 * 用于展示的数量
*/ */
private String showQuantity; private Map<String,Integer> showQuantity;

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

@ -678,10 +678,8 @@ public class MaterialServiceImpl implements MaterialService {
// 设置新总额 // 设置新总额
m.setAmounts(m.getAmounts() + amounts); m.setAmounts(m.getAmounts() + amounts);
// 获取当前各拆单信息对应的库存 // 获取当前各拆单信息对应的库存
for (Map.Entry<String, Integer> entry : splitInventoryForUnit.entrySet()) { splitInventoryForUnit.put(inventory.getUnit(),inventory.getQuantity());
showQuantity.append(entry.getKey()).append(":").append(entry.getValue()).append(" "); m.setShowQuantity(splitInventoryForUnit);
}
m.setShowQuantity(showQuantity.toString());
result.add(m); result.add(m);
} }
return result; return result;

31
src/main/resources/templates/pages/application/application_multi.html

@ -43,10 +43,9 @@
<a class="layui-btn layui-btn-xs data-count-edit" lay-event="applicationOut" >出库申请</a> <a class="layui-btn layui-btn-xs data-count-edit" lay-event="applicationOut" >出库申请</a>
</script> </script>
<script type="text/html" id="selectUnit" > <!-- 用于计量单位的展示-->
<select name="unit" lay-filter="selectUnit" id="unit" > <script id="changeUnit" type="text/html">
<option value="-1">{{d.unit}}</option> <button class="layui-btn layui-btn-primary layui-btn-xs" lay-event="changeUnit" click_num="0" id="btn_{{d.id}}" value="{{d.unit}}">{{d.unit}}</button>
</select>
</script> </script>
</div> </div>
</div> </div>
@ -89,9 +88,8 @@
{field: 'version', width: 150, title: '规格型号'}, {field: 'version', width: 150, title: '规格型号'},
{field: 'code',width: 200,title: '存货编码',sort: true}, {field: 'code',width: 200,title: '存货编码',sort: true},
{field: 'depositoryName', width: 150, title: '仓库名称'}, {field: 'depositoryName', width: 150, title: '仓库名称'},
{field: 'placeCode', width: 150, title: '库位编码'},
{field: 'quantity', width: 150, title: '数量',edit:'quantity'}, {field: 'quantity', width: 150, title: '数量',edit:'quantity'},
{field: 'unit', width: 150, title: '计量单位'}, {title: '计量单位', width: 200, templet: '#changeUnit', align: "center"},
// {rowspan: 2,title:'计量单位', width: 200, templet: '#selectUnit'}, // {rowspan: 2,title:'计量单位', width: 200, templet: '#selectUnit'},
{field: 'price', width: 150, title: '单价',edit:'price'}, {field: 'price', width: 150, title: '单价',edit:'price'},
@ -332,7 +330,26 @@
} }
else if(obj.event === 'selectDepository'){ else if (obj.event === 'changeUnit') {
let splitInfoList = data.splitInfoList;
let btn = $("#btn_"+data.id);
let clickNum = Number(btn.attr("click_num"));
if(splitInfoList.length > 0){
if(clickNum < splitInfoList.length){
let newUnit = splitInfoList[clickNum].newUnit;
btn.text(newUnit);
clickNum += 1;
btn.attr("click_num",clickNum);
obj.update({unit:newUnit})
}else{
btn.text(data.unit);
obj.update({unit:data.unit})
btn.attr("click_num",0);
}
}
} }
}); });
}); });

39
src/main/resources/templates/pages/depository/table-stock.html

@ -69,9 +69,9 @@
<a class="layui-btn layui-btn-xs data-count-edit" lay-event="applicationOut">出库申请</a> <a class="layui-btn layui-btn-xs data-count-edit" lay-event="applicationOut">出库申请</a>
</script> </script>
<!-- 用于计量单位的展示-->
<script id="selectManager" type="text/html"> <script id="changeUnit" type="text/html">
<button class="layui-btn layui-btn-primary layui-btn-xs" lay-event="changeUnit" click_num="0" id="btn_{{d.id}}" value="{{d.unit}}">{{d.unit}}</button>
</script> </script>
</div> </div>
</div> </div>
@ -79,6 +79,7 @@
<script> <script>
var data; var data;
function changePlaceCode(){} function changePlaceCode(){}
function changeUnit(){}
layui.use(['form', 'table', 'upload'], function () { layui.use(['form', 'table', 'upload'], function () {
var $ = layui.jquery, var $ = layui.jquery,
form = layui.form, form = layui.form,
@ -139,7 +140,8 @@
{field: 'version', width: 200, title: '规格型号'}, {field: 'version', width: 200, title: '规格型号'},
{field: 'code', width: 200, title: '存货编码'}, {field: 'code', width: 200, title: '存货编码'},
{field: 'typeName', width: 200, title: '物料类型'}, {field: 'typeName', width: 200, title: '物料类型'},
{field: 'showQuantity', width: 200, title: '数量'}, {title: '计量单位', width: 200, templet: '#changeUnit', align: "center"},
{field: 'quantity', width: 200, title: '数量'},
{field: 'depositoryName', width: 200, title: '仓库名称'}, {field: 'depositoryName', width: 200, title: '仓库名称'},
{field: 'depositoryCode', width: 200, title: '仓库编码'}, {field: 'depositoryCode', width: 200, title: '仓库编码'},
{title: '所处库位', width: 200, templet: '#selectManager', align: "center"}, {title: '所处库位', width: 200, templet: '#selectManager', align: "center"},
@ -159,6 +161,7 @@
let jElement = j['warningCount']; let jElement = j['warningCount'];
let placeCode = j['placeCode'].split(" "); let placeCode = j['placeCode'].split(" ");
let depositoryId = j['depositoryId']; let depositoryId = j['depositoryId'];
let unit = j['unit'];
let mid = j['id']; let mid = j['id'];
if (jElement !== null && jElement !== undefined) { if (jElement !== null && jElement !== undefined) {
let flag = (Number(jElement) !== 0); let flag = (Number(jElement) !== 0);
@ -169,14 +172,18 @@
} }
// 所处库位 // 所处库位
var placeCodeItem = $("[lay-id='currentTableId'] tr:eq(" + (i+1) + ")").children()[8]; var placeCodeItem = $("[lay-id='currentTableId'] tr:eq(" + (i+1) + ")").children()[9];
//计量单位
// 用于库位的添加
var aItem = placeCodeItem.childNodes[0]; var aItem = placeCodeItem.childNodes[0];
// 用于计量单位的添加
for (let k = 0; k < placeCode.length; k++) { for (let k = 0; k < placeCode.length; k++) {
if(placeCode[k] !== ""){ if(placeCode[k] !== ""){
$(aItem).append('<button id='+mid+' class="layui-btn layui-btn-primary layui-btn-xs" onclick="changePlaceCode(this)" value='+depositoryId+'>'+placeCode[k]+'</button>') $(aItem).append('<button id='+mid+' class="layui-btn layui-btn-primary layui-btn-xs" onclick="changePlaceCode(this)" value='+depositoryId+'>'+placeCode[k]+'</button>')
} }
} }
}); });
} }
@ -344,6 +351,28 @@
}); });
return false; return false;
} }
else if (obj.event === 'changeUnit') {
let splitInfoList = data.splitInfoList;
let btn = $("#btn_"+data.id);
let clickNum = Number(btn.attr("click_num"));
if(splitInfoList.length > 0){
if(clickNum < splitInfoList.length){
let newUnit = splitInfoList[clickNum].newUnit;
btn.text(newUnit);
clickNum += 1;
btn.attr("click_num",clickNum);
let showQuantity = data.showQuantity[newUnit];
obj.update({quantity:showQuantity});
}else{
btn.text(data.unit);
btn.attr("click_num",0);
let showQuantity = data.showQuantity[data.unit];
obj.update({quantity:showQuantity});
}
}
}
}); });
changePlaceCode = function (obj) { changePlaceCode = function (obj) {

31
target/classes/templates/pages/application/application_multi.html

@ -43,10 +43,9 @@
<a class="layui-btn layui-btn-xs data-count-edit" lay-event="applicationOut" >出库申请</a> <a class="layui-btn layui-btn-xs data-count-edit" lay-event="applicationOut" >出库申请</a>
</script> </script>
<script type="text/html" id="selectUnit" > <!-- 用于计量单位的展示-->
<select name="unit" lay-filter="selectUnit" id="unit" > <script id="changeUnit" type="text/html">
<option value="-1">{{d.unit}}</option> <button class="layui-btn layui-btn-primary layui-btn-xs" lay-event="changeUnit" click_num="0" id="btn_{{d.id}}" value="{{d.unit}}">{{d.unit}}</button>
</select>
</script> </script>
</div> </div>
</div> </div>
@ -89,9 +88,8 @@
{field: 'version', width: 150, title: '规格型号'}, {field: 'version', width: 150, title: '规格型号'},
{field: 'code',width: 200,title: '存货编码',sort: true}, {field: 'code',width: 200,title: '存货编码',sort: true},
{field: 'depositoryName', width: 150, title: '仓库名称'}, {field: 'depositoryName', width: 150, title: '仓库名称'},
{field: 'placeCode', width: 150, title: '库位编码'},
{field: 'quantity', width: 150, title: '数量',edit:'quantity'}, {field: 'quantity', width: 150, title: '数量',edit:'quantity'},
{field: 'unit', width: 150, title: '计量单位'}, {title: '计量单位', width: 200, templet: '#changeUnit', align: "center"},
// {rowspan: 2,title:'计量单位', width: 200, templet: '#selectUnit'}, // {rowspan: 2,title:'计量单位', width: 200, templet: '#selectUnit'},
{field: 'price', width: 150, title: '单价',edit:'price'}, {field: 'price', width: 150, title: '单价',edit:'price'},
@ -332,7 +330,26 @@
} }
else if(obj.event === 'selectDepository'){ else if (obj.event === 'changeUnit') {
let splitInfoList = data.splitInfoList;
let btn = $("#btn_"+data.id);
let clickNum = Number(btn.attr("click_num"));
if(splitInfoList.length > 0){
if(clickNum < splitInfoList.length){
let newUnit = splitInfoList[clickNum].newUnit;
btn.text(newUnit);
clickNum += 1;
btn.attr("click_num",clickNum);
obj.update({unit:newUnit})
}else{
btn.text(data.unit);
obj.update({unit:data.unit})
btn.attr("click_num",0);
}
}
} }
}); });
}); });

39
target/classes/templates/pages/depository/table-stock.html

@ -69,9 +69,9 @@
<a class="layui-btn layui-btn-xs data-count-edit" lay-event="applicationOut">出库申请</a> <a class="layui-btn layui-btn-xs data-count-edit" lay-event="applicationOut">出库申请</a>
</script> </script>
<!-- 用于计量单位的展示-->
<script id="selectManager" type="text/html"> <script id="changeUnit" type="text/html">
<button class="layui-btn layui-btn-primary layui-btn-xs" lay-event="changeUnit" click_num="0" id="btn_{{d.id}}" value="{{d.unit}}">{{d.unit}}</button>
</script> </script>
</div> </div>
</div> </div>
@ -79,6 +79,7 @@
<script> <script>
var data; var data;
function changePlaceCode(){} function changePlaceCode(){}
function changeUnit(){}
layui.use(['form', 'table', 'upload'], function () { layui.use(['form', 'table', 'upload'], function () {
var $ = layui.jquery, var $ = layui.jquery,
form = layui.form, form = layui.form,
@ -139,7 +140,8 @@
{field: 'version', width: 200, title: '规格型号'}, {field: 'version', width: 200, title: '规格型号'},
{field: 'code', width: 200, title: '存货编码'}, {field: 'code', width: 200, title: '存货编码'},
{field: 'typeName', width: 200, title: '物料类型'}, {field: 'typeName', width: 200, title: '物料类型'},
{field: 'showQuantity', width: 200, title: '数量'}, {title: '计量单位', width: 200, templet: '#changeUnit', align: "center"},
{field: 'quantity', width: 200, title: '数量'},
{field: 'depositoryName', width: 200, title: '仓库名称'}, {field: 'depositoryName', width: 200, title: '仓库名称'},
{field: 'depositoryCode', width: 200, title: '仓库编码'}, {field: 'depositoryCode', width: 200, title: '仓库编码'},
{title: '所处库位', width: 200, templet: '#selectManager', align: "center"}, {title: '所处库位', width: 200, templet: '#selectManager', align: "center"},
@ -159,6 +161,7 @@
let jElement = j['warningCount']; let jElement = j['warningCount'];
let placeCode = j['placeCode'].split(" "); let placeCode = j['placeCode'].split(" ");
let depositoryId = j['depositoryId']; let depositoryId = j['depositoryId'];
let unit = j['unit'];
let mid = j['id']; let mid = j['id'];
if (jElement !== null && jElement !== undefined) { if (jElement !== null && jElement !== undefined) {
let flag = (Number(jElement) !== 0); let flag = (Number(jElement) !== 0);
@ -169,14 +172,18 @@
} }
// 所处库位 // 所处库位
var placeCodeItem = $("[lay-id='currentTableId'] tr:eq(" + (i+1) + ")").children()[8]; var placeCodeItem = $("[lay-id='currentTableId'] tr:eq(" + (i+1) + ")").children()[9];
//计量单位
// 用于库位的添加
var aItem = placeCodeItem.childNodes[0]; var aItem = placeCodeItem.childNodes[0];
// 用于计量单位的添加
for (let k = 0; k < placeCode.length; k++) { for (let k = 0; k < placeCode.length; k++) {
if(placeCode[k] !== ""){ if(placeCode[k] !== ""){
$(aItem).append('<button id='+mid+' class="layui-btn layui-btn-primary layui-btn-xs" onclick="changePlaceCode(this)" value='+depositoryId+'>'+placeCode[k]+'</button>') $(aItem).append('<button id='+mid+' class="layui-btn layui-btn-primary layui-btn-xs" onclick="changePlaceCode(this)" value='+depositoryId+'>'+placeCode[k]+'</button>')
} }
} }
}); });
} }
@ -344,6 +351,28 @@
}); });
return false; return false;
} }
else if (obj.event === 'changeUnit') {
let splitInfoList = data.splitInfoList;
let btn = $("#btn_"+data.id);
let clickNum = Number(btn.attr("click_num"));
if(splitInfoList.length > 0){
if(clickNum < splitInfoList.length){
let newUnit = splitInfoList[clickNum].newUnit;
btn.text(newUnit);
clickNum += 1;
btn.attr("click_num",clickNum);
let showQuantity = data.showQuantity[newUnit];
obj.update({quantity:showQuantity});
}else{
btn.text(data.unit);
btn.attr("click_num",0);
let showQuantity = data.showQuantity[data.unit];
obj.update({quantity:showQuantity});
}
}
}
}); });
changePlaceCode = function (obj) { changePlaceCode = function (obj) {

Loading…
Cancel
Save