Browse Source

[feat] 生产管理

修改生产管理物料退检前端页面:新增导出前端js方法,支持批量导出和单个导出选项
修改生产管理物料退检Controller层:修改导出物料退检单列表后端接口
dev
liuxiaoxu 4 months ago
parent
commit
8e32bde890
  1. 10
      ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpMaterialReturnInspectionController.java
  2. 5
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpMaterialReturnInspectionService.java
  3. 30
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpMaterialReturnInspectionServiceImpl.java
  4. 56
      ruoyi-admin/src/main/resources/templates/erp/materialReturnInspection/materialReturnInspection.html
  5. 4
      ruoyi-admin/src/main/resources/templates/quality/returnInspection/returnInspection.html

10
ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpMaterialReturnInspectionController.java

@ -7,11 +7,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.erp.domain.ErpMaterialReturnInspection;
@ -63,9 +59,9 @@ public class ErpMaterialReturnInspectionController extends BaseController
@Log(title = "物料退检单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(ErpMaterialReturnInspection erpMaterialReturnInspection)
public AjaxResult export(@RequestBody String[] returnInspectionNos)
{
List<ErpMaterialReturnInspectionExcelDto> list = erpMaterialReturnInspectionService.selectExportList(erpMaterialReturnInspection);
List<ErpMaterialReturnInspectionExcelDto> list = erpMaterialReturnInspectionService.selectQualityReturnInspectionByNos(returnInspectionNos);
ExcelUtil<ErpMaterialReturnInspectionExcelDto> util = new ExcelUtil<ErpMaterialReturnInspectionExcelDto>(ErpMaterialReturnInspectionExcelDto.class);
return util.exportExcel(list, "物料退检单数据");
}

5
ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpMaterialReturnInspectionService.java

@ -75,4 +75,9 @@ public interface IErpMaterialReturnInspectionService
int restoreErpMaterialReturnInspectionById(Long id);
List<ErpMaterialReturnInspectionExcelDto> selectExportList(ErpMaterialReturnInspection erpMaterialReturnInspection);
/**
* 批量导出物料退检
* */
List<ErpMaterialReturnInspectionExcelDto> selectQualityReturnInspectionByNos(String[] returnInspectionNos);
}

30
ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpMaterialReturnInspectionServiceImpl.java

@ -10,6 +10,7 @@ import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.erp.domain.ErpMaterialReturnInspectionDetail;
import com.ruoyi.erp.domain.ErpMaterialReturnInspectionExcelDto;
import com.ruoyi.erp.mapper.ErpMaterialReturnInspectionDetailMapper;
import com.ruoyi.erp.service.IErpMaterialReturnInspectionDetailService;
import com.ruoyi.system.domain.SysMakeorderPickDetail;
import org.springframework.beans.factory.annotation.Autowired;
@ -38,6 +39,10 @@ public class ErpMaterialReturnInspectionServiceImpl implements IErpMaterialRetur
@Autowired
private IErpMaterialReturnInspectionDetailService materialReturnInspectionDetailService;
@Autowired
private ErpMaterialReturnInspectionDetailMapper erpMaterialReturnInspectionDetailMapper;
/**
* 查询物料退检单
*
@ -184,4 +189,29 @@ public class ErpMaterialReturnInspectionServiceImpl implements IErpMaterialRetur
public List<ErpMaterialReturnInspectionExcelDto> selectExportList(ErpMaterialReturnInspection erpMaterialReturnInspection) {
return erpMaterialReturnInspectionMapper.selectExportList(erpMaterialReturnInspection);
}
@Override
public List<ErpMaterialReturnInspectionExcelDto> selectQualityReturnInspectionByNos(String[] returnInspectionNos) {
List<ErpMaterialReturnInspectionDetail> erpMaterialReturnInspectionDetails = erpMaterialReturnInspectionDetailMapper.selectQualityReturnInspectionDetailByNos(returnInspectionNos);
List<ErpMaterialReturnInspectionExcelDto> erpMaterialReturnInspectionExcelDtos = new ArrayList<>();
for (ErpMaterialReturnInspectionDetail returnInspectionDetail : erpMaterialReturnInspectionDetails) {
ErpMaterialReturnInspectionExcelDto erpMaterialReturnInspectionExcelDto = new ErpMaterialReturnInspectionExcelDto();
erpMaterialReturnInspectionExcelDto.setAbnormalCause(returnInspectionDetail.getAbnormalCause());
erpMaterialReturnInspectionExcelDto.setDutyUnit(returnInspectionDetail.getDutyUnit());
erpMaterialReturnInspectionExcelDto.setMaterialName(returnInspectionDetail.getMaterialName());
erpMaterialReturnInspectionExcelDto.setMaterialNo(returnInspectionDetail.getMaterialNo());
erpMaterialReturnInspectionExcelDto.setPickMaterialTime(returnInspectionDetail.getPickMaterialTime());
erpMaterialReturnInspectionExcelDto.setRecheckRemark(returnInspectionDetail.getRecheckRemark());
erpMaterialReturnInspectionExcelDto.setReturnInspectionNo(returnInspectionDetail.getReturnInspectionNo());
erpMaterialReturnInspectionExcelDto.setReturnInspectionNum(returnInspectionDetail.getReturnInspectionNum());
erpMaterialReturnInspectionExcelDto.setReturnInspectionRemark(returnInspectionDetail.getReturnInspectionRemark());
erpMaterialReturnInspectionExcelDto.setReturnInspectionType(returnInspectionDetail.getReturnInspectionType());
erpMaterialReturnInspectionExcelDtos.add(erpMaterialReturnInspectionExcelDto);
}
return erpMaterialReturnInspectionExcelDtos;
}
}

56
ruoyi-admin/src/main/resources/templates/erp/materialReturnInspection/materialReturnInspection.html

@ -56,7 +56,7 @@
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="erp:materialReturnInspection:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="erp:materialReturnInspection:export">
<a class="btn btn-warning" onclick="exportExcel()" shiro:hasPermission="erp:materialReturnInspection:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
@ -128,7 +128,6 @@
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.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a> ');
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="detail(\'' + row.id + '\')"><i class="fa fa-edit"></i>详情</a> ');
return actions.join('');
@ -144,6 +143,59 @@
$.modal.open("物料退检单详情",url);
}
// 导出
function exportExcel(formId) {
// $.table.set();
var returnInspectionNoData = [];
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++){
returnInspectionNoData.push(selections[i].returnInspectionNo);
}
var returnInspectionNos = JSON.stringify(returnInspectionNoData);
// console.log(bomNos);
$.modal.loading("正在导出数据,请稍后...");
var config = {
url: prefix + '/export',
type: "post",
dataType: "json",
contentType: "application/json;charset=utf-8",
data: returnInspectionNos,
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>
</body>
</html>

4
ruoyi-admin/src/main/resources/templates/quality/returnInspection/returnInspection.html

@ -144,7 +144,7 @@
var returnInspectionNoData = [];
var selections = $("#bootstrap-table").bootstrapTable("getSelections");
if(selections.length === 0){
$.modal.confirm("确定导出所有退检处理吗?", function() {
$.modal.confirm("确定导出所有的物料退检单吗?", function() {
var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId;
var params = $("#bootstrap-table").bootstrapTable('getOptions');
var dataParam = $("#" + currentId).serializeArray();
@ -163,7 +163,7 @@
});
});
}else {
$.modal.confirm("确定导出选中的所有退检处理吗?", function () {
$.modal.confirm("确定导出选中的所有的物料退检单吗?", function () {
//·拼接单号
for(let i=0;i<selections.length;i++){
returnInspectionNoData.push(selections[i].returnInspectionNo);

Loading…
Cancel
Save