Browse Source

[fix]工程管理:

修改物料不能选择性导出的bug
dev
liuxiaoxu 8 months ago
parent
commit
b9c2107bf4
  1. 22
      ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpMaterialController.java
  2. 13
      ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpMaterial.java
  3. 14
      ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpMaterialVo.java
  4. 4
      ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpMaterialMapper.java
  5. 8
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpMaterialService.java
  6. 12
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpMaterialServiceImpl.java
  7. 8
      ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialMapper.xml
  8. 173
      ruoyi-admin/src/main/resources/templates/erp/material/material.html

22
ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpMaterialController.java

@ -8,7 +8,6 @@ import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.erp.domain.ErpBom;
import com.ruoyi.erp.domain.ErpMaterial;
import com.ruoyi.erp.domain.ErpMaterialVo;
import com.ruoyi.erp.mapper.ErpMaterialMapper;
@ -27,7 +26,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.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
@ -103,11 +102,20 @@ public class ErpMaterialController extends BaseController
@Log(title = "物料信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(ErpMaterialVo erpMaterialVo)
{
List<ErpMaterialVo> list = erpMaterialMapper.selectErpMaterialList(erpMaterialVo);
ExcelUtil<ErpMaterialVo> util = new ExcelUtil<ErpMaterialVo>(ErpMaterialVo.class);
return util.exportExcel(list, "物料信息数据");
public AjaxResult export(ErpMaterialVo erpMaterialVo, String ids) {
if (StringUtils.isEmpty(ids)){
List<ErpMaterialVo> list = erpMaterialMapper.selectErpMaterialList(erpMaterialVo);
ExcelUtil<ErpMaterialVo> util = new ExcelUtil<>(ErpMaterialVo.class);
return util.exportExcel(list, "物料信息数据");
}else {
List<ErpMaterialVo> erpMaterialList = erpMaterialService.selectErpMaterialByIds(ids);
System.out.println("list:"+erpMaterialList);
ExcelUtil<ErpMaterialVo> util = new ExcelUtil<>(ErpMaterialVo.class);
return util.exportExcel(erpMaterialList, "物料信息数据");
}
}
/**

13
ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpMaterial.java

@ -29,7 +29,7 @@ public class ErpMaterial extends BaseEntity
@Excel(name = "料号",sort = 1)
private String materialNo;
/** 物料名称 */
@Excel(name = "物料名称",sort = 3)
@Excel(name = "物料名称",sort = 4)
private String materialName;
/** 审核状态 0-待审核 1-审核通过 2-审核拒绝*/
@ -53,23 +53,23 @@ public class ErpMaterial extends BaseEntity
/** 物料类型 */
private String materialType;
/** 物料类型名称 */
@Excel(name = "物料类型名称",sort = 4)
@Excel(name = "物料类型名称",sort = 5)
private String materialTypeName;
/** 加工方式 */
@Excel(name = "加工方式",sort = 8,dictType = "processMethod")
@Excel(name = "加工方式",sort = 9,dictType = "processMethod")
private String processMethod;
/** 单位 */
@Excel(name = "单位",sort = 5)
@Excel(name = "单位",sort = 6)
private String unit;
/** 品牌 */
@Excel(name = "品牌",sort = 6)
@Excel(name = "品牌",sort = 7)
private String brand;
/** 描述 */
@Excel(name = "描述",sort = 7)
@Excel(name = "描述",sort = 8)
private String describe;
/** 入库部门 */
@ -102,6 +102,7 @@ public class ErpMaterial extends BaseEntity
private Long photoAttachId;
/** 照片 */
private String photoUrl;
private String fileIdStr;

14
ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpMaterialVo.java

@ -30,6 +30,11 @@ public class ErpMaterialVo extends ErpMaterial {
*/
private String keyword;
/**
* 前端多选数据集合
* */
private String[] ids;
public String getApplyUserName() {
return applyUserName;
}
@ -102,6 +107,14 @@ public class ErpMaterialVo extends ErpMaterial {
this.keyword = keyword;
}
public String[] getIds() {
return ids;
}
public void setIds(String[] ids) {
this.ids = ids;
}
@Override
public String toString() {
return "ErpMaterialVo{" +
@ -114,6 +127,7 @@ public class ErpMaterialVo extends ErpMaterial {
", todoUserId='" + todoUserId + '\'' +
", instanceTypeName='" + instanceTypeName + '\'' +
", keyword='" + keyword + '\'' +
", keyword='" + ids + '\'' +
"} " + super.toString();
}
}

4
ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpMaterialMapper.java

@ -93,4 +93,8 @@ public interface ErpMaterialMapper
public int updateMaterialBomNo(ErpMaterial erpMaterial);
ErpMaterialVo selectErpMaterialByMaterialNo(String materialNo);
/**
* 批量查找物料信息
*/
List<ErpMaterialVo> selectErpMaterialByIds(String[] ids);
}

8
ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpMaterialService.java

@ -55,6 +55,14 @@ public interface IErpMaterialService
*/
public int deleteErpMaterialByIds(String ids);
/**
* 批量查找物料信息
*
* @param ids 需要查找的数据ID
* @return 结果
*/
public List<ErpMaterialVo> selectErpMaterialByIds(String ids);
/**
* 删除物料信息信息
*

12
ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpMaterialServiceImpl.java

@ -247,6 +247,18 @@ public class ErpMaterialServiceImpl implements IErpMaterialService
return erpMaterialMapper.deleteErpMaterialByIds(Convert.toStrArray(ids));
}
/**
* 批量查找物料信息
*
* @param ids 需要查找的数据ID
* @return 结果
*/
@Override
public List<ErpMaterialVo> selectErpMaterialByIds(String ids) {
return erpMaterialMapper.selectErpMaterialByIds(Convert.toStrArray(ids));
}
/**
* 删除物料信息信息
*

8
ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialMapper.xml

@ -142,6 +142,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where erp.material_no = #{materialNo}
</select>
<select id="selectErpMaterialByIds" parameterType="String" resultMap="ErpMaterialResult">
<include refid="selectErpMaterialVo"/> where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<insert id="insertErpMaterial" parameterType="ErpMaterial" useGeneratedKeys="true" keyProperty="id">
insert into erp_material
<trim prefix="(" suffix=")" suffixOverrides=",">

173
ruoyi-admin/src/main/resources/templates/erp/material/material.html

@ -109,13 +109,7 @@
<a class="btn btn-success" onclick="showItem()" shiro:hasPermission="erp:material:item">
<i class="fa fa-plus"></i> 技术团队配置
</a>
<!--<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="erp:material:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="erp:material:remove">
<i class="fa fa-remove"></i> 删除
</a>-->
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="erp:material:export">
<a class="btn btn-warning" onclick="exportSelect()" shiro:hasPermission="erp:material:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
@ -274,89 +268,101 @@
aria-hidden="true">×</span></button>
<h4 class="modal-title">技术团队配置</h4>
</div>
<div class="modal-body" style="height: 180px">
<form id="form-product-material">
<div class="form-group">
<label class="col-sm-3 control-label">料号:</label>
<div class="modal-body">
<form id="form-product-material row">
<div class="form-group col-sm-6">
<label class="col-sm-4 col-form-label">料号:</label>
<div class="col-sm-8">
<input name="materialNo" class="form-control" type="text" readonly>
<input type="text" name="materialNo" class="form-control" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">物料名称:</label>
<div class="form-group col-sm-6">
<label class="col-sm-4 col-form-label">物料名称:</label>
<div class="col-sm-8">
<input name="materialName" class="form-control" type="text" readonly>
<input type="text" name="materialName" class="form-control" readonly>
</div>
</div>
<input name="itemId" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">生产团队id</label>
<input name="itemId" type="hidden">
<div class="form-group col-sm-6">
<label class="col-sm-4 col-form-label">生产团队ID</label>
<div class="col-sm-8">
<select name="id" class="form-control-sm" required>
<select name="id" class="form-control-sm" required>
<option></option>
<!-- 添加具体的团队ID选项 -->
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">生产团队名称:</label>
<div class="form-group col-sm-6">
<label class="col-sm-4 col-form-label">生产团队名称:</label>
<div class="col-sm-8">
<select name="productItem" class="form-control-sm" required>
<select name="productItem" class="form-control-sm" required>
<option></option>
<!-- 添加具体的团队名称选项 -->
</select>
</div>
</div>
<div class="form-group" >
<label class="col-sm-3 control-label">职能:</label>
<div class="col-sm-2">
<input name="functions" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group" >
<label class="col-sm-3 control-label">电气技术人员:</label>
<div class="col-sm-2">
<input name="dianqi" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group" >
<label class="col-sm-3 control-label">结构技术人员:</label>
<div class="col-sm-2">
<input name="struct" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">软件技术人员:</label>
<div class="col-sm-2">
<input name="soft" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group" readonly="">
<label class="col-sm-3 control-label">测试技术人员:</label>
<div class="col-sm-2">
<input name="test" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">主管1:</label>
<div class="col-sm-2">
<input name="zhuguan1" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">主管2:</label>
<div class="col-sm-2">
<input name="zhuguan2" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">经理:</label>
<div class="col-sm-2">
<input name="manger" class="form-control" type="text" readonly>
<div class="row">
<div class="col-sm-3">
<label class="control-label">职能:</label>
</div>
<div class="col-sm-3">
<label class="control-label">电气技术人员:</label>
</div>
<div class="col-sm-3">
<label class="control-label">结构技术人员:</label>
</div>
<div class="col-sm-3">
<label class="control-label">软件技术人员:</label>
</div>
<div class="w-100"></div> <!-- Add a clearfix to wrap the next row -->
<div class="col-sm-3">
<label class="control-label">测试技术人员:</label>
</div>
<div class="col-sm-3">
<label class="control-label">主管1:</label>
</div>
<div class="col-sm-3">
<label class="control-label">主管2:</label>
</div>
<div class="col-sm-3">
<label class="control-label">经理:</label>
</div>
<div class="w-100"></div> <!-- Add a clearfix to wrap the next row -->
<div class="col-sm-3">
<label class="control-label">总监:</label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">总监:</label>
<div class="col-sm-2">
<input name="director" class="form-control" type="text" readonly>
<div class="row">
<div class="col-sm-3">
<input name="functions" class="form-control" type="text" readonly>
</div>
<div class="col-sm-3">
<input name="dianqi" class="form-control" type="text" readonly>
</div>
<div class="col-sm-3">
<input name="struct" class="form-control" type="text" readonly>
</div>
<div class="col-sm-3">
<input name="soft" class="form-control" type="text" readonly>
</div>
<div class="w-100"></div> <!-- Add a clearfix to wrap the next row -->
<div class="col-sm-3">
<input name="test" class="form-control" type="text" readonly>
</div>
<div class="col-sm-3">
<input name="zhuguan1" class="form-control" type="text" readonly>
</div>
<div class="col-sm-3">
<input name="zhuguan2" class="form-control" type="text" readonly>
</div>
<div class="col-sm-3">
<input name="manger" class="form-control" type="text" readonly>
</div>
<div class="w-100"></div> <!-- Add a clearfix to wrap the next row -->
<div class="col-sm-3">
<input name="director" class="form-control" type="text" readonly>
</div>
</div>
</div>
</form>
@ -498,7 +504,6 @@
removeUrl: prefix + "/remove",
cancelUrl: prefix + "/cancel/{id}",
restoreUrl: prefix + "/restore/{id}",
exportUrl: prefix + "/export",
detailUrl: prefix + "/detail/{id}",
modalName: "物料信息",
fixedColumns: true, // 启用冻结列
@ -1427,8 +1432,28 @@
$("input[name='director']").val(productItems[i].director);
}
});
//技术团队选择赋值
//导出数据
function exportSelect() {
var ids = $.table.selectColumns("id");
var dataParam = $("#formId").serializeArray();
let tipMsg = "确定导出当前所有数据吗?";
if ($.common.isNotEmpty(ids)) {
tipMsg = `确定导出当前勾选的 ${ids.length} 条数据吗?`;
dataParam.push({ "name": "ids", "value": ids });
}
$.modal.loading("正在导出数据,请稍后...");
$.modal.confirm(tipMsg, function () {
$.post( prefix + "/export", dataParam, function (result) {
if (result.code === web_status.SUCCESS) {
window.location.href = ctx + "common/download?fileName="+ encodeURI(result.msg) + "&delete=" + true;
} else {
$.modal.alertError(result.msg);
}
$.modal.closeLoading();
});
});
}
</script>
</body>
</html>
Loading…
Cancel
Save