Browse Source

[fix] 生产领料单管理 出库单管理

生产领料单新增 出库单号
生产领料单 新增更新后端接口生产领料单审核通过后增加出库单号
新增通过入库单号更新生产领料单数后端接口
修改出库单 不同订单来源的 显示按钮条件判断
修改领料单审核通过后生成出库单后端接口:
新增 审核过后 设置领料状态 为待领料并且更新领料单的出库单号;
新增设置出库单详情 的仓库员,新增设置已出库数为实际出口数;
新增 设置出库单主表的出库数为子表的所有实际出库数的总和;
新增 出库时更改生产领料单为已领料状态
dev
liuxiaoxu 4 months ago
parent
commit
fe7739def5
  1. 17
      ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderPick.java
  2. 14
      ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysMakeorderPickMapper.java
  3. 81
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderServiceImpl.java
  4. 41
      ruoyi-admin/src/main/resources/mapper/system/SysMakeorderPickMapper.xml
  5. 14
      ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/warehouseOutOrder.html

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

@ -37,6 +37,11 @@ public class SysMakeorderPick extends BaseEntity
@Excel(name = "生产领料单号")
private String pickNo;
/** 出库单号 */
@Excel(name = "出库单号")
private String outOrderCode;
/** 领料状态 0-待领料 1-部分领料 2-全部领料 */
@Excel(name = "领料状态 0-待领料 1-部分领料 2-全部领料")
private String pickStatus;
@ -129,7 +134,16 @@ public class SysMakeorderPick extends BaseEntity
{
return pickNo;
}
public void setPickStatus(String pickStatus)
public String getOutOrderCode() {
return outOrderCode;
}
public void setOutOrderCode(String outOrderCode) {
this.outOrderCode = outOrderCode;
}
public void setPickStatus(String pickStatus)
{
this.pickStatus = pickStatus;
}
@ -250,6 +264,7 @@ public class SysMakeorderPick extends BaseEntity
.append("makeNo", getMakeNo())
.append("saleNo", getSaleNo())
.append("pickNo", getPickNo())
.append("outOrderCode", getOutOrderCode())
.append("pickStatus", getPickStatus())
.append("pickUser", getPickUser())
.append("auditStatus", getAuditStatus())

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

@ -75,4 +75,18 @@ public interface SysMakeorderPickMapper
* @return 结果
*/
public int restoreSysMakeorderPickById(Long id);
/**
* 生产领料单审核通过后增加出库单号
*
* @param sysMakeorderPickVo 生产领料单
* @return 结果
*/
int updateMakeorderPickOutOrderCodeById(SysMakeorderPickVo sysMakeorderPickVo);
/*
* 通过入库单号更新生产领料单数
* */
int updateMakeorderPickByCode(String outOrderCode);
}

81
ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderServiceImpl.java

@ -246,15 +246,23 @@ public class WarehouseOutOrderServiceImpl implements IWarehouseOutOrderService
@Transactional(rollbackFor = Exception.class)
@Override
public int generateWarehouseOutOrderByMakeorderPick(SysMakeorderPickVo sysMakeorderPickVo) {
String outOrderCode = redisCache.generateBillNo("CK");
WarehouseOutOrder warehouseOutOrder = new WarehouseOutOrder();
SysMakeorderPickVo tempSysMakeorderPickVo = sysMakeorderPickMapper.selectSysMakeorderPickById(sysMakeorderPickVo.getId());
if (tempSysMakeorderPickVo == null){
log.warn("生产领料单数据为空:{}",sysMakeorderPickVo.getId());
throw new BusinessException("生产领料单数据为空:" + sysMakeorderPickVo.getId());
}
tempSysMakeorderPickVo.setOutOrderCode(outOrderCode);
//设置领料状态 为待领料
tempSysMakeorderPickVo.setPickStatus("0");
//更新领料单的出库单号
int updateMakeorderPickResult = sysMakeorderPickMapper.updateMakeorderPickOutOrderCodeById(tempSysMakeorderPickVo);
if (updateMakeorderPickResult <= 0){
throw new BusinessException("更新生产领料单失败");
}
String outOrderCode = redisCache.generateBillNo("CK");
warehouseOutOrder.setOutOrderCode(outOrderCode);
warehouseOutOrder.setWarehouseOutStatus("4");
warehouseOutOrder.setRelatedOrderCode(tempSysMakeorderPickVo.getMakeNo());
@ -402,12 +410,55 @@ public class WarehouseOutOrderServiceImpl implements IWarehouseOutOrderService
throw new BusinessException("更新出库单信息失败:缺少必要参数");
}
List<WarehouseOutOrderDetail> warehouseOutOrderDetailList = warehouseOutOrder.getWarehouseOutOrderDetailList();
if (CollectionUtils.isEmpty(warehouseOutOrderDetailList)){
log.warn("保存生产单出库,物料列表信息为空:{}",warehouseOutOrder);
throw new BusinessException("出库单详情数据为空");
}else {
int updateRows = 0;
for (WarehouseOutOrderDetail warehouseOutOrderDetail : warehouseOutOrderDetailList) {
warehouseOutOrderDetail.setUpdateBy(loginName);
warehouseOutOrderDetail.setUpdateTime(new Date());
warehouseOutOrderDetail.setRemark(warehouseOutOrder.getRemark());
//设置已出库数
warehouseOutOrderDetail.setHasOutOrderSum(warehouseOutOrderDetail.getActualOutOrderSum());
//设置仓库员
warehouseOutOrderDetail.setWarehouseName(loginName);
//更新数据库记录
updateRows += outOrderDetailMapper.updateWarehouseOutOrderDetail(warehouseOutOrderDetail);
}
if (updateRows <= 0){
throw new BusinessException("更新出库单详情数据失败");
}
}
warehouseOutOrder.setUpdateBy(loginName);
warehouseOutOrder.setUpdateTime(new Date());
//表面已出库
//表已出库
warehouseOutOrder.setWarehouseOutStatus("7");
//设置出库时间
warehouseOutOrder.setOutOrderTime(new Date());
warehouseOutOrderMapper.updateWarehouseOutOrder(warehouseOutOrder);
//设置仓库员
warehouseOutOrder.setWarehouseName(loginName);
//计算出库单主表的出库数
Integer outOrderSum = 0;
// 检查outOrderSum是否含有null值
boolean hasOutOrderSumNull = warehouseOutOrderDetailList.stream()
.anyMatch(item -> item.getActualOutOrderSum() == null);
if (hasOutOrderSumNull) {
throw new BusinessException("存在实际出库数为空,请检查!");
}
// 计算各个字段的总和
outOrderSum = warehouseOutOrderDetailList.stream()
.mapToInt(WarehouseOutOrderDetail::getActualOutOrderSum)
.sum();
//设置出库单主表的出库数
warehouseOutOrder.setOutOrderSum(outOrderSum);
//更新生产订单信息
SysMakeOrder sysMakeOrder = new SysMakeOrder();
@ -439,22 +490,12 @@ public class WarehouseOutOrderServiceImpl implements IWarehouseOutOrderService
log.warn("更新销售订单信息失败");
throw new BusinessException("更新销售订单信息失败");
}
List<WarehouseOutOrderDetail> warehouseOutOrderDetailList = warehouseOutOrder.getWarehouseOutOrderDetailList();
if (CollectionUtils.isEmpty(warehouseOutOrderDetailList)){
log.warn("保存生产单出库,物料列表信息为空:{}",warehouseOutOrder);
}else {
int updateRows = 0;
for (WarehouseOutOrderDetail warehouseOutOrderDetail : warehouseOutOrderDetailList) {
warehouseOutOrderDetail.setUpdateBy(loginName);
warehouseOutOrderDetail.setUpdateTime(new Date());
warehouseOutOrderDetail.setRemark(warehouseOutOrder.getRemark());
//更新数据库记录
updateRows += outOrderDetailMapper.updateWarehouseOutOrderDetail(warehouseOutOrderDetail);
}
return updateRows;
// 更新生产领料单数据表示已领料
int updateMakeorderPickResult = sysMakeorderPickMapper.updateMakeorderPickByCode(warehouseOutOrder.getOutOrderCode());
if (updateMakeorderPickResult <= 0){
log.warn("更新生产领料单信息失败");
throw new BusinessException("更新生产领料单信息失败");
}
return 0;
return warehouseOutOrderMapper.updateWarehouseOutOrder(warehouseOutOrder);
}
}

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

@ -15,6 +15,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="makeNo" column="make_no" />
<result property="saleNo" column="sale_no" />
<result property="pickNo" column="pick_no" />
<result property="outOrderCode" column="out_order_code" />
<result property="pickStatus" column="pick_status" />
<result property="pickUser" column="pick_user" />
<result property="auditStatus" column="audit_status" />
@ -33,7 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectSysMakeorderPickVo">
select a.id, a.del_flag, a.create_by, a.create_time, a.update_by, a.update_time, a.remark
, a.make_no, a.sale_no, a.pick_no, a.pick_status, a.pick_user, a.audit_status
, a.make_no, a.sale_no, a.pick_no, a.out_order_code, a.pick_status, a.pick_user, a.audit_status
, a.instance_id, a.instance_type, a.submit_instance_id, a.cancel_instance_id, a.restore_instance_id, a.apply_title, a.apply_user, a.apply_time
,b.material_sum
,b.enterprise_sum
@ -48,6 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="makeNo != null and makeNo != ''"> and a.make_no = #{makeNo}</if>
<if test="saleNo != null and saleNo != ''"> and a.sale_no = #{saleNo}</if>
<if test="pickNo != null and pickNo != ''"> and a.pick_no = #{pickNo}</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="pickUser != null and pickUser != ''"> and a.pick_user = #{pickUser}</if>
<if test="auditStatus != null and auditStatus != ''"> and a.audit_status = #{auditStatus}</if>
@ -85,6 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="makeNo != null">make_no,</if>
<if test="saleNo != null">sale_no,</if>
<if test="pickNo != null">pick_no,</if>
<if test="outOrderCode != null">out_order_code,</if>
<if test="pickStatus != null">pick_status,</if>
<if test="pickUser != null">pick_user,</if>
<if test="auditStatus != null">audit_status,</if>
@ -107,6 +110,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="makeNo != null">#{makeNo},</if>
<if test="saleNo != null">#{saleNo},</if>
<if test="pickNo != null">#{pickNo},</if>
<if test="outOrderCode != null">#{outOrderCode},</if>
<if test="pickStatus != null">#{pickStatus},</if>
<if test="pickUser != null">#{pickUser},</if>
<if test="auditStatus != null">#{auditStatus},</if>
@ -133,6 +137,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="makeNo != null">make_no = #{makeNo},</if>
<if test="saleNo != null">sale_no = #{saleNo},</if>
<if test="pickNo != null">pick_no = #{pickNo},</if>
<if test="outOrderCode != null">out_order_code = #{outOrderCode},</if>
<if test="pickStatus != null">pick_status = #{pickStatus},</if>
<if test="pickUser != null">pick_user = #{pickUser},</if>
<if test="auditStatus != null">audit_status = #{auditStatus},</if>
@ -167,4 +172,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update sys_makeorder_pick set del_flag = '0' where id = #{id}
</update>
<update id="updateMakeorderPickOutOrderCodeById" parameterType="SysMakeorderPickVo">
update sys_makeorder_pick
<trim prefix="SET" suffixOverrides=",">
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="makeNo != null">make_no = #{makeNo},</if>
<if test="saleNo != null">sale_no = #{saleNo},</if>
<if test="pickNo != null">pick_no = #{pickNo},</if>
<if test="outOrderCode != null">out_order_code = #{outOrderCode},</if>
<if test="pickStatus != null">pick_status = #{pickStatus},</if>
<if test="pickUser != null">pick_user = #{pickUser},</if>
<if test="auditStatus != null">audit_status = #{auditStatus},</if>
<if test="instanceId != null">instance_id = #{instanceId},</if>
<if test="instanceType != null">instance_type = #{instanceType},</if>
<if test="submitInstanceId != null">submit_instance_id = #{submitInstanceId},</if>
<if test="cancelInstanceId != null">cancel_instance_id = #{cancelInstanceId},</if>
<if test="restoreInstanceId != null">restore_instance_id = #{restoreInstanceId},</if>
<if test="applyTitle != null">apply_title = #{applyTitle},</if>
<if test="applyUser != null">apply_user = #{applyUser},</if>
<if test="applyTime != null">apply_time = #{applyTime},</if>
</trim>
where id = #{id}
</update>
<update id="updateMakeorderPickByCode" parameterType="SysMakeorderPick">
update sys_makeorder_pick set pick_status = "2" where out_order_code = #{outOrderCode}
</update>
</mapper>

14
ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/warehouseOutOrder.html

@ -194,22 +194,36 @@
actions.push('<a class="btn btn-success btn-xs ' + salesOutWarehouseFlag + '" href="javascript:void(0)" onclick="salesOutWarehouse(\'' + row.outOrderId + '\')"><i class="fa fa-edit"></i>出库</a> ');
actions.push('<a class="btn btn-success btn-xs ' + salesOutWarehouseDetailFlag + '" href="javascript:void(0)" onclick="salesOutWarehouseDetail(\'' + row.outOrderId + '\')"><i class="fa fa-edit"></i>详情</a> ');
}
/*生产单-出库*/
if (row.warehouseOutStatus == 4 && row.warehouseOrderType == 1 && row.warehouseOutType == 1){
actions.push('<a class="btn btn-success btn-xs ' + makeOutWarehouseFlag + '" href="javascript:void(0)" onclick="makeOutWarehouse(\'' + row.outOrderId + '\')"><i class="fa fa-edit"></i>出库</a> ');
}
/*生产单-出库 详情*/
if (row.warehouseOrderType == 1 && row.warehouseOutType == 1){
actions.push('<a class="btn btn-success btn-xs ' + makeOutWarehouseDetailFlag + '" href="javascript:void(0)" onclick="makeOutWarehouseDetail(\'' + row.outOrderId + '\')"><i class="fa fa-edit"></i>详情</a> ');
}
/*请购单-出库*/
if (row.warehouseOutStatus == 4 && row.warehouseOrderType == 2 && row.warehouseOutType == 2){
actions.push('<a class="btn btn-success btn-xs ' + requisitioningOutWarehouseFlag + '" href="javascript:void(0)" onclick="requisitioningOutWarehouse(\'' + row.outOrderId + '\')"><i class="fa fa-edit"></i>出库</a> ');
}
/*请购单-出库 详情*/
if (row.warehouseOrderType == 2 && row.warehouseOutType == 2){
actions.push('<a class="btn btn-success btn-xs ' + requisitioningOutWarehouseDetailFlag + '" href="javascript:void(0)" onclick="requisitioningOutWarehouseDetail(\'' + row.outOrderId + '\')"><i class="fa fa-edit"></i>详情</a> ');
}
/*退换货-出库*/
if (row.warehouseOutStatus == 4 && row.warehouseOrderType == 4 && row.warehouseOutType == 4){
actions.push('<a class="btn btn-success btn-xs ' + refundsExchangesOutWarehouseFlag + '" href="javascript:void(0)" onclick="refundsExchangesOutWarehouse(\'' + row.outOrderId + '\')"><i class="fa fa-edit"></i>出库</a> ');
}
/*退换货-出库*/
if (row.warehouseOrderType == 4 && row.warehouseOutType == 4){
actions.push('<a class="btn btn-success btn-xs ' + refundsExchangesOutWarehouseDetailFlag + '" href="javascript:void(0)" onclick="refundsExchangesOutWarehouseDetail(\'' + row.outOrderId + '\')"><i class="fa fa-edit"></i>详情</a> ');
}
return actions.join('');
}
}]

Loading…
Cancel
Save