Browse Source

[fix]

生产管理 生产领料
修改生产领料实体类导出字段及顺序;
新增生产领料详情实体类可用库存数、订单用量字段;
修改生产领料vo实体类,新增当前状态字段;
修改生产领料controller导出接口;
修改生产领料service新增领料单方法,添加领料数不全为空、不超过可用库存数和本单用量判断;
修改生产领料列表查询mapper,模糊搜索,新增按单号列表查询领料单集合mapper方法;
dev
王晓迪 1 month ago
parent
commit
35e2da343a
  1. 35
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeorderPickController.java
  2. 26
      ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderPick.java
  3. 22
      ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderPickDetail.java
  4. 2
      ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderPickVo.java
  5. 3
      ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysMakeorderPickMapper.java
  6. 26
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeorderPickServiceImpl.java
  7. 27
      ruoyi-admin/src/main/resources/mapper/system/SysMakeorderPickMapper.xml

35
ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeorderPickController.java

@ -3,15 +3,19 @@ package com.ruoyi.system.controller;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.process.general.service.IProcessService; import com.ruoyi.process.general.service.IProcessService;
import com.ruoyi.system.domain.OutsourceQuoteChild;
import com.ruoyi.system.domain.SysMakeorderPick; import com.ruoyi.system.domain.SysMakeorderPick;
import com.ruoyi.system.domain.SysMakeorderPickVo; import com.ruoyi.system.domain.SysMakeorderPickVo;
import com.ruoyi.system.mapper.SysMakeorderPickMapper;
import com.ruoyi.system.service.ISysMakeorderPickService; import com.ruoyi.system.service.ISysMakeorderPickService;
import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.warehouse.service.IWarehouseOutOrderService; import com.ruoyi.warehouse.service.IWarehouseOutOrderService;
import org.activiti.engine.RuntimeService; import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService; import org.activiti.engine.TaskService;
@ -56,6 +60,12 @@ public class SysMakeorderPickController extends BaseController
@Autowired @Autowired
private IWarehouseOutOrderService warehouseOutOrderService; private IWarehouseOutOrderService warehouseOutOrderService;
@Autowired
private SysMakeorderPickMapper sysMakeorderPickMapper;
@Autowired
private ISysUserService sysUserService;
@RequiresPermissions("system:makeorderpick:view") @RequiresPermissions("system:makeorderpick:view")
@GetMapping() @GetMapping()
public String makeorderpick(ModelMap mmap) public String makeorderpick(ModelMap mmap)
@ -84,11 +94,18 @@ public class SysMakeorderPickController extends BaseController
@Log(title = "生产领料单", businessType = BusinessType.EXPORT) @Log(title = "生产领料单", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
@ResponseBody @ResponseBody
public AjaxResult export(SysMakeorderPickVo sysMakeorderPickVo) public AjaxResult export(SysMakeorderPickVo sysMakeorderPickVo,String ids)
{ {
List<SysMakeorderPickVo> list = sysMakeorderPickService.selectSysMakeorderPickList(sysMakeorderPickVo); if (org.springframework.util.StringUtils.isEmpty(ids)){
ExcelUtil<SysMakeorderPickVo> util = new ExcelUtil<SysMakeorderPickVo>(SysMakeorderPickVo.class); List<SysMakeorderPickVo> pickVoList = sysMakeorderPickMapper.selectSysMakeorderPickList(sysMakeorderPickVo);
return util.exportExcel(list, "生产领料单数据"); ExcelUtil<SysMakeorderPickVo> util = new ExcelUtil<SysMakeorderPickVo>(SysMakeorderPickVo.class);
return util.exportExcel(pickVoList, "生产领料数据");
}else {
String[] makeNos = ids.split(",");
List<SysMakeorderPickVo> pickVoList = sysMakeorderPickMapper.selectSysMakeorderPickListByNos(makeNos);
ExcelUtil<SysMakeorderPickVo> util = new ExcelUtil<SysMakeorderPickVo>(SysMakeorderPickVo.class);
return util.exportExcel(pickVoList, ids);
}
} }
/** /**
@ -110,7 +127,7 @@ public class SysMakeorderPickController extends BaseController
public AjaxResult addSave(SysMakeorderPick sysMakeorderPick) public AjaxResult addSave(SysMakeorderPick sysMakeorderPick)
{ {
if (StringUtils.isEmpty(sysMakeorderPick.getPickDetails())){ if (StringUtils.isEmpty(sysMakeorderPick.getPickDetails())){
return AjaxResult.success(); return AjaxResult.error("领料子表数据为空!");
} }
// 审核状态-待审核 // 审核状态-待审核
sysMakeorderPick.setAuditStatus("0"); sysMakeorderPick.setAuditStatus("0");
@ -268,5 +285,11 @@ public class SysMakeorderPickController extends BaseController
return toAjax(sysMakeorderPickService.restoreSysMakeorderPickById(id)); return toAjax(sysMakeorderPickService.restoreSysMakeorderPickById(id));
} }
@GetMapping("/getBinessMembers")
@ResponseBody
public TableDataInfo getBusinessMembers(){
startPage();
List<SysUser> list = sysUserService.selectRoleToUserList("scyRole,scjlRole,sczgRole,admin");
return getDataTable(list);
}
} }

26
ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderPick.java

@ -26,15 +26,15 @@ public class SysMakeorderPick extends BaseEntity
private String delFlag; private String delFlag;
/** 生产订单号 */ /** 生产订单号 */
@Excel(name = "生产订单号") @Excel(name = "生产订单号", sort = 2)
private String makeNo; private String makeNo;
/** 关联销售订单号 */ /** 关联销售订单号 */
@Excel(name = "关联销售订单号") @Excel(name = "关联销售订单号", sort = 3)
private String saleNo; private String saleNo;
/** 生产领料单号 */ /** 生产领料单号 */
@Excel(name = "生产领料单号") @Excel(name = "生产领料单号", sort = 1)
private String pickNo; private String pickNo;
/** 出库单号 */ /** 出库单号 */
@ -43,53 +43,49 @@ public class SysMakeorderPick extends BaseEntity
/** 领料状态 0-待领料 1-部分领料 2-全部领料 */ /** 领料状态 0-待领料 1-部分领料 2-全部领料 */
@Excel(name = "领料状态 0-待领料 1-部分领料 2-全部领料") @Excel(name = "领料状态",dictType = "pickStatus", sort = 6)
private String pickStatus; private String pickStatus;
/** 领料员 */ /** 领料员 */
@Excel(name = "领料员") // @Excel(name = "领料员", sort = 6)
private String pickUser; private String pickUser;
/*物料合计*/ /*物料合计*/
@Excel(name = "物料合计", sort = 4)
private Integer materialSum; private Integer materialSum;
/*数量合计*/ /*数量合计*/
@Excel(name = "数量合计", sort = 5)
private Integer enterpriseSum; private Integer enterpriseSum;
/** 审核状态 0-待审核 1-审核通过 2-审核拒绝 */ /** 审核状态 0-待审核 1-审核通过 2-审核拒绝 */
@Excel(name = "审核状态 0-待审核 1-审核通过 2-审核拒绝") @Excel(name = "审核状态",dictType = "auditStatus", sort = 7)
private String auditStatus; private String auditStatus;
/** 流程实例ID */ /** 流程实例ID */
@Excel(name = "流程实例ID")
private String instanceId; private String instanceId;
/** 流程实例类型 */ /** 流程实例类型 */
@Excel(name = "流程实例类型")
private String instanceType; private String instanceType;
/** 流程提交实例ID */ /** 流程提交实例ID */
@Excel(name = "流程提交实例ID")
private String submitInstanceId; private String submitInstanceId;
/** 流程作废实例ID */ /** 流程作废实例ID */
@Excel(name = "流程作废实例ID")
private String cancelInstanceId; private String cancelInstanceId;
/** 流程恢复实例ID */ /** 流程恢复实例ID */
@Excel(name = "流程恢复实例ID")
private String restoreInstanceId; private String restoreInstanceId;
/** 申请标题 */ /** 申请标题 */
@Excel(name = "申请标题")
private String applyTitle; private String applyTitle;
/** 申请人 */ /** 申请人 */
@Excel(name = "申请人") @Excel(name = "申请人", sort = 8)
private String applyUser; private String applyUser;
/** 申请时间 */ /** 申请时间 */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "申请时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "申请时间", width = 30, dateFormat = "yyyy-MM-dd",sort = 9)
private Date applyTime; private Date applyTime;
private List<SysMakeorderPickDetail> pickDetails; private List<SysMakeorderPickDetail> pickDetails;

22
ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderPickDetail.java

@ -72,6 +72,12 @@ public class SysMakeorderPickDetail extends BaseEntity
/** 排序 */ /** 排序 */
private Long sortNo; private Long sortNo;
// 可用库存数
private BigDecimal storageNum;
// 订单用量
private BigDecimal orderNum;
public void setId(Long id) public void setId(Long id)
{ {
this.id = id; this.id = id;
@ -240,6 +246,22 @@ public class SysMakeorderPickDetail extends BaseEntity
this.sortNo = sortNo; this.sortNo = sortNo;
} }
public BigDecimal getStorageNum() {
return storageNum;
}
public void setStorageNum(BigDecimal storageNum) {
this.storageNum = storageNum;
}
public BigDecimal getOrderNum() {
return orderNum;
}
public void setOrderNum(BigDecimal orderNum) {
this.orderNum = orderNum;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

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

@ -21,6 +21,8 @@ public class SysMakeorderPickVo extends SysMakeorderPick {
private String taskId; private String taskId;
/** 任务名称 */ /** 任务名称 */
private String taskName; private String taskName;
// 当前任务状态
private String taskStatus;
/** 办理时间 */ /** 办理时间 */
private Date doneTime; private Date doneTime;
/** 创建人 */ /** 创建人 */

3
ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysMakeorderPickMapper.java

@ -89,4 +89,7 @@ public interface SysMakeorderPickMapper
* */ * */
int updateMakeorderPickByCode(String outOrderCode); int updateMakeorderPickByCode(String outOrderCode);
// 根据单号集合查询生产领料单
public List<SysMakeorderPickVo> selectSysMakeorderPickListByNos(String[] pickNos);
} }

26
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeorderPickServiceImpl.java

@ -148,6 +148,12 @@ public class SysMakeorderPickServiceImpl implements ISysMakeorderPickService
} else { } else {
pickVo.setTaskName("未启动"); pickVo.setTaskName("未启动");
} }
pickVo.setTaskStatus(pickVo.getTaskName());
if(pickVo.getAuditStatus().equals("1")){
pickVo.setTaskStatus("审核通过");
}else if(pickVo.getAuditStatus().equals("2")){
pickVo.setTaskStatus("审核拒绝");
}
returnList.add(pickVo); returnList.add(pickVo);
} }
returnList.setTotal(org.springframework.util.CollectionUtils.isEmpty(list) ? 0 : list.getTotal()); returnList.setTotal(org.springframework.util.CollectionUtils.isEmpty(list) ? 0 : list.getTotal());
@ -176,7 +182,10 @@ public class SysMakeorderPickServiceImpl implements ISysMakeorderPickService
sysMakeorderPick.setPickNo(billNo); sysMakeorderPick.setPickNo(billNo);
//保留领料单数不为空的数据 //保留领料单数不为空的数据
List<SysMakeorderPickDetail> filterPickDetails = pickDetails.stream().filter(details -> details.getPickNum() != null).collect(Collectors.toList()); List<SysMakeorderPickDetail> filterPickDetails = pickDetails.stream().filter(details -> details.getPickNum() != null&& details.getPickNum() > 0).collect(Collectors.toList());
if(CollectionUtil.isEmpty(filterPickDetails)){
throw new BusinessException("领料数不能全为空!");
}
Integer enterpriseSum = (int) filterPickDetails.stream() Integer enterpriseSum = (int) filterPickDetails.stream()
.mapToLong(SysMakeorderPickDetail::getPickNum) .mapToLong(SysMakeorderPickDetail::getPickNum)
@ -185,15 +194,16 @@ public class SysMakeorderPickServiceImpl implements ISysMakeorderPickService
sysMakeorderPick.setEnterpriseSum(enterpriseSum); sysMakeorderPick.setEnterpriseSum(enterpriseSum);
sysMakeorderPick.setMaterialSum(filterPickDetails.size()); sysMakeorderPick.setMaterialSum(filterPickDetails.size());
int id = sysMakeorderPickMapper.insertSysMakeorderPick(sysMakeorderPick);
// 插入子表 for (SysMakeorderPickDetail pickDetail:filterPickDetails) {
for (int i = 0; i < filterPickDetails.size(); i++) {
//获取过滤后的领料单详情
SysMakeorderPickDetail pickDetail = filterPickDetails.get(i);
pickDetail.setPickNo(billNo); pickDetail.setPickNo(billNo);
pickDetail.setMakeNo(makeNo); pickDetail.setMakeNo(makeNo);
if(pickDetail.getPickNum()>pickDetail.getStorageNum().intValue()){
throw new BusinessException("物料" + pickDetail.getMaterialNo() + "领料数超出可用库存数!");
}
if(pickDetail.getPickNum()>pickDetail.getOrderNum().intValue()){
throw new BusinessException("物料" + pickDetail.getMaterialNo() + "领料数超出订单用量数!");
}
int insertMakeorderPickDetailResult = makeorderPickDetailService.insertSysMakeorderPickDetail(pickDetail); int insertMakeorderPickDetailResult = makeorderPickDetailService.insertSysMakeorderPickDetail(pickDetail);
if (insertMakeorderPickDetailResult <= 0){ if (insertMakeorderPickDetailResult <= 0){
throw new BusinessException("新增生产领料单详情失败"); throw new BusinessException("新增生产领料单详情失败");
@ -201,7 +211,7 @@ public class SysMakeorderPickServiceImpl implements ISysMakeorderPickService
} }
int id = sysMakeorderPickMapper.insertSysMakeorderPick(sysMakeorderPick);
return id; return id;
} }

27
ruoyi-admin/src/main/resources/mapper/system/SysMakeorderPickMapper.xml

@ -46,9 +46,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectSysMakeorderPickList" parameterType="SysMakeorderPick" resultMap="SysMakeorderPickResult"> <select id="selectSysMakeorderPickList" parameterType="SysMakeorderPick" resultMap="SysMakeorderPickResult">
<include refid="selectSysMakeorderPickVo"/> <include refid="selectSysMakeorderPickVo"/>
<where> <where>
<if test="makeNo != null and makeNo != ''"> and a.make_no = #{makeNo}</if> <if test="makeNo != null and makeNo != ''"> and a.make_no like concat('%', #{makeNo}, '%')</if>
<if test="saleNo != null and saleNo != ''"> and a.sale_no = #{saleNo}</if> <if test="saleNo != null and saleNo != ''"> and a.sale_no like concat('%', #{saleNo}, '%')</if>
<if test="pickNo != null and pickNo != ''"> and a.pick_no = #{pickNo}</if> <if test="pickNo != null and pickNo != ''"> and a.pick_no like concat('%', #{pickNo}, '%')</if>
<if test="outOrderCode != null and outOrderCode != ''"> and a.out_order_code = #{outOrderCode}</if> <if test="outOrderCode != null and outOrderCode != ''"> and a.out_order_code = #{outOrderCode}</if>
<if test="pickStatus != null and pickStatus != ''"> and a.pick_status = #{pickStatus}</if> <if test="pickStatus != null and pickStatus != ''"> and a.pick_status = #{pickStatus}</if>
<if test="pickUser != null and pickUser != ''"> and a.pick_user = #{pickUser}</if> <if test="pickUser != null and pickUser != ''"> and a.pick_user = #{pickUser}</if>
@ -61,11 +61,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="applyTitle != null and applyTitle != ''"> and a.apply_title = #{applyTitle}</if> <if test="applyTitle != null and applyTitle != ''"> and a.apply_title = #{applyTitle}</if>
<if test="applyUser != null and applyUser != ''"> and a.apply_user = #{applyUser}</if> <if test="applyUser != null and applyUser != ''"> and a.apply_user = #{applyUser}</if>
<if test="applyTime != null "> and a.apply_time = #{applyTime}</if> <if test="applyTime != null "> and a.apply_time = #{applyTime}</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 --> <!-- <if test="params.beginTime != null and params.beginTime != ''">&lt;!&ndash; 开始时间检索 &ndash;&gt;-->
AND date_format(a.create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d') <!-- AND date_format(a.create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')-->
</if> <!-- </if>-->
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 --> <!-- <if test="params.endTime != null and params.endTime != ''">&lt;!&ndash; 结束时间检索 &ndash;&gt;-->
AND date_format(a.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d') <!-- AND date_format(a.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')-->
<!-- </if>-->
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
and a.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if> </if>
</where> </where>
order by a.audit_status asc, a.create_time desc order by a.audit_status asc, a.create_time desc
@ -210,5 +213,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update sys_makeorder_pick set pick_status = "2" where out_order_code = #{outOrderCode} update sys_makeorder_pick set pick_status = "2" where out_order_code = #{outOrderCode}
</update> </update>
<select id="selectSysMakeorderPickListByNos" parameterType="String" resultMap="SysMakeorderPickResult">
<include refid="selectSysMakeorderPickVo"/>
where a.pick_no in
<foreach item="pickNo" collection="array" open="(" separator="," close=")">
#{pickNo}
</foreach>
</select>
</mapper> </mapper>
Loading…
Cancel
Save