Browse Source

[fix]

仓库管理 库存报损
修改库存报损添加页面生产订单号输入框为下拉框,修改添加和编辑页面的回调函数;
新增库存报损实体类和mapper报销类型字段;
dev
王晓迪 1 month ago
parent
commit
f7007f5260
  1. 11
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/WarehouseInventoryReportDamage.java
  2. 4
      ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseInventoryReportDamageMapper.xml
  3. 101
      ruoyi-admin/src/main/resources/templates/warehouse/inventoryReportDamage/add.html
  4. 122
      ruoyi-admin/src/main/resources/templates/warehouse/inventoryReportDamage/edit.html
  5. 17
      ruoyi-admin/src/main/resources/templates/warehouse/inventoryReportDamage/inventoryReportDamage.html

11
ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/WarehouseInventoryReportDamage.java

@ -76,6 +76,9 @@ public class WarehouseInventoryReportDamage extends BaseEntity
@Excel(name = "仓库存放地址")
private String warehouseStoreAddress;
/** 报废类型 */
private String scrapType;
/** 流程实例ID */
private String instanceId;
@ -321,6 +324,14 @@ public class WarehouseInventoryReportDamage extends BaseEntity
this.removeFileIdStr = removeFileIdStr;
}
public String getScrapType() {
return scrapType;
}
public void setScrapType(String scrapType) {
this.scrapType = scrapType;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

4
ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseInventoryReportDamageMapper.xml

@ -14,6 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="applyTime" column="apply_time" />
<result property="materialNo" column="material_no" />
<result property="materialName" column="material_name" />
<result property="scrapType" column="scrap_type" />
<result property="materialTotal" column="material_total" />
<result property="numTotal" column="num_total" />
<result property="warehouseCode" column="warehouse_code" />
@ -46,6 +47,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialName != null and materialName != ''">
and report_damage_code in ( select report_damage_code from warehouse_inventory_report_damage_child where material_name like concat('%', #{materialName}, '%') )
</if>
<if test="scrapType != null and scrapType != ''">
and report_damage_code in ( select report_damage_code from warehouse_inventory_report_damage_child where scrap_type like concat('%', #{scrapType}, '%') )
</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
</where>
</select>

101
ruoyi-admin/src/main/resources/templates/warehouse/inventoryReportDamage/add.html

@ -19,13 +19,13 @@
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="col-sm-3 control-label is-required">申请部门:</label>
<label class="col-sm-4 control-label is-required">申请部门:</label>
<div class="col-sm-8">
<select id="applyDept" name="applyDept" class="form-control" type="text" required disabled></select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">申请时间:</label>
<label class="col-sm-4 control-label is-required">申请时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="applyTime" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
@ -34,7 +34,7 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">是否关联生产单号:</label>
<label class="col-sm-4 control-label is-required">是否关联生产单号:</label>
<div class="col-sm-8">
<!-- <div class="radio-box" th:each="dict : ${@dict.getType('yes_or_no')}">-->
<!-- <input type="radio" th:id="${'whetherMakeNo_' + dict.dictCode}" name="whetherMakeNo" th:value="${dict.dictValue}" th:checked="${dict.default}">-->
@ -49,13 +49,15 @@
</div>
</div>
<div class="form-group" id="makeNoInput">
<label class="col-sm-3 control-label is-required">关联生产单号:</label>
<label class="col-sm-4 control-label is-required">关联生产单号:</label>
<div class="col-sm-8">
<input name="makeNo" class="form-control" type="text" required>
<!-- <input name="makeNo" class="form-control" type="text" required>-->
<select name="makeNo" id="selectMakeNo" class="form-control select2-multiple" type="text" required>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">仓库名称:</label>
<label class="col-sm-4 control-label is-required">仓库名称:</label>
<div class="col-sm-8">
<select id="stockNameSelct" name="warehouseName" class="form-control" type="text" required>
@ -63,20 +65,20 @@
</div>
</div>
<div class="form-group is-required">
<label class="col-sm-3 control-label is-required">仓库ID:</label>
<label class="col-sm-4 control-label is-required">仓库ID:</label>
<div class="col-sm-8">
<input name="warehouseCode" class="form-control" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">仓库存放地址:</label>
<label class="col-sm-4 control-label is-required">仓库存放地址:</label>
<div class="col-sm-8">
<input name="warehouseStoreAddress" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<label class="col-sm-4 control-label">备注:</label>
<div class="col-sm-8">
<textarea name="remark" class="form-control"></textarea>
</div>
@ -124,7 +126,7 @@
var whetherMakeNo = $("input[name='whetherMakeNo']:checked").val();
warehouseInventoryReportDamage.whetherMakeNo = whetherMakeNo;
if(whetherMakeNo === "1"){
var makeNo = $("input[name='makeNo']").val();
var makeNo = $("select[name='makeNo']").val();
warehouseInventoryReportDamage.makeNo = makeNo;
}
warehouseInventoryReportDamage.warehouseName = $("select[name='warehouseName']").val();
@ -168,7 +170,8 @@
function insertRow() {
var ifMakeNo = $("input[name='whetherMakeNo']:checked").val();
if(ifMakeNo === "1"){
var makeNo = $("input[name='makeNo']").val();
var makeNo = $("select[name='makeNo']").val();
console.log(makeNo);
if(!makeNo){
$.modal.alertWarning("请输入生产单号!")
}else{
@ -181,7 +184,7 @@
$.modal.openOptions(options);
}
}else{
var url = ctx + 'warehouse/inventoryCheck/materialSelect';
var url = ctx + "erp/material/select";
var options = {
title: '选择物料',
url: url,
@ -191,35 +194,36 @@
}
}
function doSubmit(index, layero,uniqueId){
// console.log(uniqueId);
var iframeWin = window[layero.find('iframe')[0]['name']];
var rowData = iframeWin.$('#bootstrap-materialSelect-table').bootstrapTable('getSelections')[0];
var rows = $("#bootstrap-table-reportDamage-child").bootstrapTable('getData');
if(rows.length > 0){
for(var i=0;i<rows.length;i++){
var data = rows[i];
if(data.materialNo == rowData.materialNo){
$.modal.alertError("不能选择已添加过的相同物料");
return;
var rowData = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections');
//判断是否重复
var data = $("#bootstrap-table-reportDamage-child").bootstrapTable('getData');
var rows = data.length;
if(rows > 0){
for(var i=0;i<rows;i++){
for(var j=0;j<rowData.length;j++){
if(data[i].materialNo===rowData[j].materialNo){
$.modal.alertError("不能选择已添加过的相同物料");
rowData.split(j,1);
break;
}
}
};
insertTable(rowData);
}else{
insertTable(rowData);
}
for(i=0;i<rowData.length;i++){
insertTable(rowData[i]);
}
layer.close(index);
}
function insertTable(rowData){
$("#bootstrap-table-reportDamage-child").bootstrapTable('insertRow', {
index:1,
row: {
materialNo:rowData.materialNo,
var newRow = {
materialNo:rowData.materialNo,
materialName: rowData.materialName,
materialType: rowData.materialType,
materialBrand: rowData.materialBrand,
materialBrand: rowData.brand,
materialPhotourl: rowData.materialPhotourl,
materialDescribe: rowData.materialDescribe,
materialUnit: rowData.materialUnit,
materialDescribe: rowData.describe,
materialUnit: rowData.unit,
actualScrapQuantity: "",
scrapType: "",
scrapDetail: "",
@ -227,8 +231,8 @@
estimatedValueRmb: "",
responsibleUnit: "",
remark : ""
}
})
}
$("#bootstrap-table-reportDamage-child").bootstrapTable('append',newRow);
}
// 逻辑删除前端的一行数据
@ -240,6 +244,11 @@
var options = {
id : 'bootstrap-table-reportDamage-child',
modalName: "仓库库存报损物料信息",
showColumns: false,
showSearch: false,
showRefresh:false,
showToggle:false,
width: 1000,
columns: [
{title: '库存报损id', field: 'reportDamageChildId', visible: false},
{title: '报损单号', field: 'reportDamageCode',visible: false},
@ -314,6 +323,7 @@
};
$.table.init(options);
loadWarehouseCodes();
loadMakeNo();
changeWhetherMakeNo();
getDeptName();
//单选改变是否关联生产单号显示关联生产单号输入框
@ -383,6 +393,31 @@
});
}
function loadMakeNo() {
var options = [];
options.push({id: '',text: '',value: ''})
$.ajax({
url: ctx + 'system/makeorder/getAllMakeNos',
type: "GET",
dataType: "json",
success: function (result) {
if (result != null) {
result.forEach(function (re){
var option = {};
option.id = re.makeNo;
option.text = re.makeNo;
option.value = re.makeNo;
options.push(option);
});
$("#selectMakeNo").select2({
data: options,
});
} else {
$.modal.msgError("生产订单编号获取失败!");
}
}
});
}
function getDeptName(){
$.ajax({
url: prefix + "/getUserDeptName",

122
ruoyi-admin/src/main/resources/templates/warehouse/inventoryReportDamage/edit.html

@ -21,13 +21,13 @@
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="col-sm-3 control-label is-required">申请部门:</label>
<label class="col-sm-4 control-label is-required">申请部门:</label>
<div class="col-sm-8">
<select name="applyDept" th:field="*{applyDept}" class="form-control" type="text" required disabled></select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">申请时间:</label>
<label class="col-sm-4 control-label">申请时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="applyTime" th:value="${#dates.format(warehouseInventoryReportDamage.applyTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
@ -36,7 +36,7 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">是否关联生产单号:</label>
<label class="col-sm-4 control-label is-required">是否关联生产单号:</label>
<div class="col-sm-8">
<!-- <div class="radio-box" th:each="dict : ${@dict.getType('yes_or_no')}" required>-->
<!-- <input type="radio" th:id="${'whetherMakeNo_' + dict.dictCode}" name="whetherMakeNo" th:value="${dict.dictValue}" th:field="*{whetherMakeNo}">-->
@ -51,9 +51,10 @@
</div>
</div>
<div class="form-group" id="makeNoInput">
<label class="col-sm-3 control-label is-required">关联生产单号:</label>
<label class="col-sm-4 control-label is-required">关联生产单号:</label>
<div class="col-sm-8">
<input name="makeNo" th:field="*{makeNo}" class="form-control" type="text" required>
<input id="selectMakeNo" name="makeNo" th:field="*{makeNo}" class="form-control select2-multiple" type="text" required>
</input>
</div>
</div>
<!-- <div class="form-group"> -->
@ -69,25 +70,25 @@
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="col-sm-3 control-label is-required">仓库ID:</label>
<label class="col-sm-4 control-label is-required">仓库ID:</label>
<div class="col-sm-8">
<input name="warehouseCode" th:field="*{warehouseCode}" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">仓库名称:</label>
<label class="col-sm-4 control-label is-required">仓库名称:</label>
<div class="col-sm-8">
<select id="stockNameSelct" name="warehouseName" th:field="*{warehouseName}" class="form-control" type="text" required></select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">仓库存放地址:</label>
<label class="col-sm-4 control-label is-required">仓库存放地址:</label>
<div class="col-sm-8">
<input name="warehouseStoreAddress" th:field="*{warehouseStoreAddress}" class="form-control" type="text" required>
</div>
</div>
<div class="form-group ">
<label class="col-sm-3 control-label ">备注:</label>
<label class="col-sm-4 control-label ">备注:</label>
<div class="col-sm-8">
<textarea name="remark" class="form-control">[[*{remark}]]</textarea>
</div>
@ -127,6 +128,7 @@
$("#form-inventoryReportDamage-edit").validate({focusCleanup: true});
var warehouseInventoryReportDamage = [[${warehouseInventoryReportDamage}]];
var stockData = [];
var makeNo = [[${warehouseInventoryReportDamage.makeNo}]]
function submitHandler() {
if ($.validate.form()) {
var warehouseInventoryReportDamage = {
@ -192,6 +194,10 @@
var options = {
id : 'bootstrap-table-reportDamage-child',
modalName: "仓库库存报损物料信息",
showColumns: false,
showSearch: false,
showRefresh:false,
showToggle:false,
data: [[${warehouseInventoryReportDamage.warehouseInventoryReportDamageChildList}]],
columns: [
{title: '库存报损id', field: 'reportDamageChildId', visible: false},
@ -273,6 +279,8 @@
var stockName = warehouseInventoryReportDamage.warehouseName;
loadWarehouseCodes(stockName);
// loadMakeNo();
$("#selectMakeNo").val(makeNo);
changeWhetherMakeNo();
getDeptName();
@ -330,7 +338,38 @@
}
});
}
function loadMakeNo() {
var options = [];
options.push({id: '',text: '',value: ''})
$.ajax({
url: ctx + 'system/makeorder/getAllMakeNos',
type: "GET",
dataType: "json",
success: function (result) {
if (result != null) {
result.forEach(function (re){
var option = {};
option.id = re.makeNo;
option.text = re.makeNo;
option.value = re.makeNo;
options.push(option);
});
$("#selectMakeNo").select2({
data: options,
}).on('select2:loaded', function(e) {
// 打印所有选项
var allOptions = $("#selectMakeNo").select2('data');
console.log("All Options from Select2:", allOptions);
allOptions.forEach(function(option) {
console.log("ID: " + option.id + ", Text: " + option.text);
});
});
} else {
$.modal.msgError("生产订单编号获取失败!");
}
}
});
}
function getDeptName(){
$.ajax({
url: prefix + "/getUserDeptName",
@ -378,44 +417,45 @@
}
}
function doSubmit(index, layero,uniqueId){
// console.log(uniqueId);
var iframeWin = window[layero.find('iframe')[0]['name']];
var rowData = iframeWin.$('#bootstrap-materialSelect-table').bootstrapTable('getSelections')[0];
var rows = $("#bootstrap-table-reportDamage-child").bootstrapTable('getData');
if(rows.length > 0){
for(var i=0;i<rows.length;i++){
var data = rows[i];
if(data.materialNo == rowData.materialNo){
$.modal.alertError("不能选择已添加过的相同物料");
return;
var rowData = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections');
//判断是否重复
var data = $("#bootstrap-table-reportDamage-child").bootstrapTable('getData');
var rows = data.length;
if(rows > 0){
for(var i=0;i<rows;i++){
for(var j=0;j<rowData.length;j++){
if(data[i].materialNo===rowData[j].materialNo){
$.modal.alertError("不能选择已添加过的相同物料");
rowData.split(j,1);
break;
}
}
};
insertTable(rowData);
}else{
insertTable(rowData);
}
for(i=0;i<rowData.length;i++){
insertTable(rowData[i]);
}
layer.close(index);
}
function insertTable(rowData){
$("#bootstrap-table-reportDamage-child").bootstrapTable('insertRow', {
index:1,
row: {
materialNo:rowData.materialNo,
materialName: rowData.materialName,
materialType: rowData.materialType,
materialBrand: rowData.materialBrand,
materialPhotourl: rowData.materialPhotourl,
materialDescribe: rowData.materialDescribe,
materialUnit: rowData.materialUnit,
actualScrapQuantity: "",
scrapType: "",
scrapDetail: "",
qualityAssessment: "",
estimatedValueRmb: "",
responsibleUnit: "",
remark : ""
}
})
var newRow = {
materialNo:rowData.materialNo,
materialName: rowData.materialName,
materialType: rowData.materialType,
materialBrand: rowData.brand,
materialPhotourl: rowData.materialPhotourl,
materialDescribe: rowData.describe,
materialUnit: rowData.unit,
actualScrapQuantity: "",
scrapType: "",
scrapDetail: "",
qualityAssessment: "",
estimatedValueRmb: "",
responsibleUnit: "",
remark : ""
}
$("#bootstrap-table-reportDamage-child").bootstrapTable('append',newRow);
}
// 逻辑删除前端的一行数据

17
ruoyi-admin/src/main/resources/templates/warehouse/inventoryReportDamage/inventoryReportDamage.html

@ -2,6 +2,8 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('仓库库存报损列表')" />
<th:block th:include="include :: select2-css" />
</head>
<body class="gray-bg">
<div class="container-div">
@ -20,14 +22,15 @@
</li>
<li>
<label>报废类型:</label>
<select name="warehousScrapType" th:with="type=${@dict.getType('warehous_scrap_type')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
<input type="text" name="scrapType">
<!-- th:with="type=${@dict.getType('warehous_scrap_type')}"-->
<!-- <option value="">所有</option>-->
<!-- <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>-->
</input>
</li>
<li>
<label>是否关联生产单号:</label>
<select name="whetherMakeNo" th:with="type=${@dict.getType('yes_or_no')}">
<select name="whetherMakeNo" class="select2-multiple" th:with="type=${@dict.getType('yes_or_no')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
@ -74,6 +77,8 @@
</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: select2-js" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('warehouse:inventoryReportDamage:edit')}]];
var detailFlag = [[${@permission.hasPermi('warehouse:inventoryReportDamage:detail')}]];
@ -122,7 +127,7 @@
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.reportDamageId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-success btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="detail(\'' + row.reportDamageId + '\')"><i class="fa fa-edit"></i>详情</a> ');
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="detail(\'' + row.reportDamageId + '\')"><i class="fa fa-edit"></i>详情</a> ');
return actions.join('');
}
}

Loading…
Cancel
Save