Browse Source

[feat] 生产管理

按照万材要求,生产管理工序明细新增导出功能,支持部分行和全部行导出,导出更多数据
新增导出所有和选择导出后端接口
新增 导出生产管理工序明细单明细方法
新增 根据工序明细单号数组查询工序明细集合方法
dev
liuxiaoxu 5 days ago
parent
commit
ee624f2968
  1. 2
      ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysProcedure.java
  2. 4
      ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysProcedureMapper.java
  3. 4
      ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysProcedureService.java
  4. 9
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysProcedureServiceImpl.java
  5. 20
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProcedureController.java
  6. 8
      ruoyi-admin/src/main/resources/mapper/system/SysProcedureMapper.xml
  7. 105
      ruoyi-admin/src/main/resources/templates/system/procedure/procedure.html

2
ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysProcedure.java

@ -24,9 +24,11 @@ public class SysProcedure extends BaseEntity
private String delFlag;
/** 生产设备型号 */
@Excel(name = "生产设备型号")
private String produceEquipModel;
/** 工序id */
@Excel(name = "工序id")
private String procedureId;
/** 工序编号 */

4
ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysProcedureMapper.java

@ -61,4 +61,8 @@ public interface SysProcedureMapper
*/
int deleteSysProcedureByIds(String[] ids);
/**
* 根据id数据查询生产加工明细表
* */
List<SysProcedure> selectSysProcedureListByIds(String[] procedureIds);
}

4
ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysProcedureService.java

@ -61,4 +61,8 @@ public interface ISysProcedureService
public int deleteSysProcedureById(Long procedureId);
/**
* 根据id数据查询生产加工明细表
* */
List<SysProcedure> selectSysProcedureListByIds(String[] procedureIds);
}

9
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysProcedureServiceImpl.java

@ -51,6 +51,15 @@ public class SysProcedureServiceImpl implements ISysProcedureService
return sysProcedureMapper.selectSysProcedureList(sysProcedure);
}
/**
*
* 根据id数据查询生产加工明细表
* */
@Override
public List<SysProcedure> selectSysProcedureListByIds(String[] procedureIds) {
return sysProcedureMapper.selectSysProcedureListByIds(procedureIds);
}
/**
* 新增生产加工工序明细
*

20
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProcedureController.java

@ -62,12 +62,26 @@ public class SysProcedureController extends BaseController
*/
@RequiresPermissions("system:procedure:export")
@Log(title = "生产加工工序明细", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@PostMapping("/exportAll")
@ResponseBody
public AjaxResult export(SysProcedure sysProcedure)
public AjaxResult exportAll(SysProcedure sysProcedure)
{
List<SysProcedure> list = sysProcedureService.selectSysProcedureList(sysProcedure);
// System.out.println("list----"+list);
ExcelUtil<SysProcedure> util = new ExcelUtil<SysProcedure>(SysProcedure.class);
return util.exportExcel(list, "生产加工工序明细数据");
}
/**
* 导出全部生产加工工序明细列表
*/
@RequiresPermissions("system:procedure:export")
@Log(title = "生产加工工序明细", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(@RequestBody String[] procedureIds)
{
List<SysProcedure> list = sysProcedureService.selectSysProcedureListByIds(procedureIds);
ExcelUtil<SysProcedure> util = new ExcelUtil<SysProcedure>(SysProcedure.class);
return util.exportExcel(list, "生产加工工序明细数据");
}

8
ruoyi-admin/src/main/resources/mapper/system/SysProcedureMapper.xml

@ -45,6 +45,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</select>
<select id="selectSysProcedureListByIds" parameterType="Long" resultMap="SysProcedureResult">
<include refid="selectSysProcedureVo"/>
where procedure_id in
<foreach item="procedureId" collection="array" open="(" separator="," close=")">
#{procedureId}
</foreach>
</select>
<insert id="insertSysProcedure" parameterType="SysProcedure" useGeneratedKeys="true" keyProperty="procedureId">
insert into sys_procedure
<trim prefix="(" suffix=")" suffixOverrides=",">

105
ruoyi-admin/src/main/resources/templates/system/procedure/procedure.html

@ -15,14 +15,6 @@
<label>工序编号:</label>
<input type="text" name="procedureCode"/>
</li>
<!--<li>
<label>车间名称:</label>
&lt;!&ndash; <input type="text" name="workshopName"/>&ndash;&gt;
<select name="workshopName" class="form-control select-list" th:with="type=${@dict.getType('sys_procedure_workshopName')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"></option>
</select>
</li>-->
<li>
<label>工序名称:</label>
<input type="text" name="procedureName"/>
@ -31,14 +23,6 @@
<label>生产设备型号:</label>
<input type="text" name="produceEquipModel"/>
</li>
<!--<li>
<label>核算数量关联项:</label>
&lt;!&ndash; <input type="text" name="associatedItem"/>&ndash;&gt;
<select name="associatedItem" class="form-control select-list" th:with="type=${@dict.getType('sys_procedure_associatedItem')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"></option>
</select>
</li>-->
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
@ -52,9 +36,9 @@
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:procedure:add">
<i class="fa fa-plus"></i> 添加
</a>
<!-- <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:procedure:export">-->
<!-- <i class="fa fa-download"></i> 导出-->
<!-- </a>-->
<a class="btn btn-success" onclick="exportExcel()" shiro:hasPermission="system:processCategory:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" style="white-space:nowrap"></table>
@ -111,40 +95,59 @@
});
function exportSelectedExcel(){
table.set();
var rows = $.common.isEmpty(table.options.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns(table.options.uniqueId);
if (rows.length == 0) {
$.modal.alert("请至少选择一条记录");
return;
} else {
// rows为选中行的id
// alert(rows);
$.modal.confirm("确定导出选中的" + rows.length + "条数据吗?", function() {
axios({
url: prefix + '/exportSelected/'+rows,
method: 'POST',
responseType: 'blob'
}).then(response => {
const URL = window.URL.createObjectURL(response.data)
// 创建隐藏<a>标签进行下载
const tempLink = document.createElement('a')
tempLink.style.display = 'none'
tempLink.href = URL
let time = new Date().toLocaleString()
tempLink.setAttribute('download', time + "生产加工工序明细.xlsx")
if (typeof tempLink.download === 'undefined') {
tempLink.setAttribute('target', '_blank')
}
document.body.appendChild(tempLink)
tempLink.click()
document.body.removeChild(tempLink)// 移除dom元素
window.URL.revokeObjectURL(URL)//释放内存
})
})
// 导出
function exportExcel(formId) {
// $.table.set();
var procedureIdData = [];
var selections = $("#bootstrap-table").bootstrapTable("getSelections");
if(selections.length === 0){
$.modal.confirm("确定导出所有工序明细吗?", function() {
var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId;
var params = $("#bootstrap-table").bootstrapTable('getOptions');
var dataParam = $("#" + currentId).serializeArray();
dataParam.push({ "name": "orderByColumn", "value": params.sortName });
dataParam.push({ "name": "isAsc", "value": params.sortOrder });
$.modal.loading("正在导出数据,请稍后...");
$.post(prefix + '/exportAll', dataParam, function(result) {
if (result.code == web_status.SUCCESS) {
window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
} else if (result.code == web_status.WARNING) {
$.modal.alertWarning(result.msg)
} else {
$.modal.alertError(result.msg);
}
$.modal.closeLoading();
});
});
}else {
$.modal.confirm("确定导出选中的所有工序明细吗?", function () {
//·拼接单号
for(let i=0;i<selections.length;i++){
procedureIdData.push(selections[i].procedureId);
}
var procedureIds = JSON.stringify(procedureIdData);
// console.log(bomNos);
$.modal.loading("正在导出数据,请稍后...");
var config = {
url: prefix + '/export',
type: "post",
dataType: "json",
contentType: "application/json;charset=utf-8",
data: procedureIds,
success: function(result) {
window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
$.modal.alertSuccess("导出成功!")
$.modal.closeLoading();
},
error: function (result){
$.modal.alertError(result.msg);
}
};
$.ajax(config)
});
}
}
};
</script>

Loading…
Cancel
Save