Browse Source

opt: 1.出库分配

master
丁世豪 4 weeks ago
parent
commit
2536eea1e7
  1. 17
      wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/basedata_manage/service/dao/mapper/MdPbStoragevehicleextMapper.java
  2. 25
      wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/basedata_manage/service/dao/mapper/MdPbStoragevehicleextMapper.xml
  3. 42
      wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/basedata_manage/service/dto/MdPbStoragevehicleextDto.java
  4. 2
      wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/basedata_manage/service/impl/StructattrServiceImpl.java
  5. 21
      wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_management/controller/OutBillController.java
  6. 19
      wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_management/service/IOutBillService.java
  7. 2
      wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_management/service/dao/IOStorInvDis.java
  8. 4
      wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_management/service/dao/mapper/IOStorInvMapper.xml
  9. 612
      wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_management/service/impl/OutBillServiceImpl.java
  10. 15
      wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_management/service/impl/RawAssistIStorServiceImpl.java
  11. 18
      wms/nladmin-ui/src/views/wms/st/outbill/DivDialog.vue
  12. 18
      wms/nladmin-ui/src/views/wms/st/outbill/checkoutbill.js
  13. 2
      wms/nladmin-ui/src/views/wms/st/outbill/index.vue

17
wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/basedata_manage/service/dao/mapper/MdPbStoragevehicleextMapper.java

@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleext; import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleext;
import org.nl.wms.basedata_manage.service.dto.MdPbStoragevehicleextDto;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
@ -29,7 +30,13 @@ public interface MdPbStoragevehicleextMapper extends BaseMapper<MdPbStoragevehic
*/ */
IPage<JSONObject> getCanuseIvt(Page<JSONObject> page, @Param("param") Map whereJson); IPage<JSONObject> getCanuseIvt(Page<JSONObject> page, @Param("param") Map whereJson);
BigDecimal queryCanuseSumByPcsn(@Param("pcsn") String pcsn); /**
* 根据批次和物料查看可用库存总和
* @param pcsn
* @param material_id
* @return
*/
BigDecimal queryCanuseSum(@Param("pcsn") String pcsn,@Param("material_id") String material_id);
/** /**
* 分页查询 * 分页查询
@ -50,6 +57,14 @@ public interface MdPbStoragevehicleextMapper extends BaseMapper<MdPbStoragevehic
*/ */
List<JSONObject> erpQueryIvt(@Param("param") JSONObject whereJson); List<JSONObject> erpQueryIvt(@Param("param") JSONObject whereJson);
/**
* 出库分配查询货位信息
* @param pcsn
* @param material_id
* @return
*/
List<MdPbStoragevehicleextDto> queryOutAllocation(@Param("pcsn") String pcsn,@Param("material_id") String material_id);
/** /**
* 手持出库确认查询明细 * 手持出库确认查询明细
* @param whereJson { * @param whereJson {

25
wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/basedata_manage/service/dao/mapper/MdPbStoragevehicleextMapper.xml

@ -108,15 +108,32 @@
ORDER BY ext.insert_time Desc ORDER BY ext.insert_time Desc
</select> </select>
<select id="queryCanuseSumByPcsn" resultType="java.math.BigDecimal"> <select id="queryCanuseSum" resultType="java.math.BigDecimal">
SELECT SELECT
SUM(canuse_qty) SUM(canuse_qty)
FROM FROM
md_pb_storagevehicleext md_pb_storagevehicleext ex
LEFT JOIN st_ivt_structattr st on ex.storagevehicle_code = st.storagevehicle_code
<where> <where>
pcsn = #{pcsn} ex.material_id = #{material_id}
<if test="pcsn!= null and pcsn!= ''">
AND
ex.pcsn = #{pcsn}
</if>
</where> </where>
ORDER BY ext.insert_time Desc </select>
<select id="queryOutAllocation" resultType="org.nl.wms.basedata_manage.service.dto.MdPbStoragevehicleextDto">
SELECT ex.*,st.sect_id,st.sect_code,st.sect_name,st.struct_id,st.struct_code,st.struct_name
FROM md_pb_storagevehicleext ex LEFT JOIN st_ivt_structattr st on ex.storagevehicle_code = st.storagevehicle_code
<where>
material_id = #{material_id}
<if test="pcsn!= null and pcsn!= ''">
AND
pcsn = #{pcsn}
</if>
</where>
ORDER BY ex.insert_time,ex.canuse_qty
</select> </select>
<select id="erpQueryIvt" resultType="com.alibaba.fastjson.JSONObject"> <select id="erpQueryIvt" resultType="com.alibaba.fastjson.JSONObject">

42
wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/basedata_manage/service/dto/MdPbStoragevehicleextDto.java

@ -0,0 +1,42 @@
package org.nl.wms.basedata_manage.service.dto;
import lombok.Data;
import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleext;
/**
* @author dsh
* 2025/6/5
*/
@Data
public class MdPbStoragevehicleextDto extends MdPbStoragevehicleext{
/**
* 库区标识
*/
private String sect_id;
/**
* 库区编码
*/
private String sect_code;
/**
* 库区名称
*/
private String sect_name;
/**
* 仓位标识
*/
private String struct_id;
/**
* 仓位编码
*/
private String struct_code;
/**
* 仓位名称
*/
private String struct_name;
}

2
wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/basedata_manage/service/impl/StructattrServiceImpl.java

@ -240,7 +240,7 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
.set(Structattr::getInv_id,jsonObject.getString("inv_id")) .set(Structattr::getInv_id,jsonObject.getString("inv_id"))
.set(Structattr::getInv_code,jsonObject.getString("inv_code")) .set(Structattr::getInv_code,jsonObject.getString("inv_code"))
.set(Structattr::getInv_type,jsonObject.getString("inv_type")) .set(Structattr::getInv_type,jsonObject.getString("inv_type"))
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("入库锁")) .set(Structattr::getLock_type, jsonObject.getString("lock_type"))
.eq(Structattr::getStruct_code,jsonObject.getString("struct_code")) .eq(Structattr::getStruct_code,jsonObject.getString("struct_code"))
); );
break; break;

21
wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_management/controller/OutBillController.java

@ -64,4 +64,25 @@ public class OutBillController {
iOutBillService.allDiv(whereJson); iOutBillService.allDiv(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT); return new ResponseEntity<>(HttpStatus.NO_CONTENT);
} }
@PostMapping("/allCancel")
@Log("出库单全部取消")
public ResponseEntity<Object> allCancel(@RequestBody JSONObject whereJson) {
iOutBillService.allCancel(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@PostMapping("/autoDiv")
@Log("出库单自动分配")
public ResponseEntity<Object> autoDiv(@RequestBody JSONObject whereJson) {
iOutBillService.autoDiv(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@PostMapping("/autoCancel")
@Log("出库单自动取消分配")
public ResponseEntity<Object> autoCancel(@RequestBody JSONObject whereJson) {
iOutBillService.autoCancel(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
} }

19
wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_management/service/IOutBillService.java

@ -75,4 +75,23 @@ public interface IOutBillService extends IService<IOStorInv> {
*/ */
void allDiv(JSONObject whereJson); void allDiv(JSONObject whereJson);
/**
* 全部取消
*
* @param whereJson /
*/
void allCancel(JSONObject whereJson);
/**
*
* 自动分配 单条出库单明细
* @param whereJson
*/
void autoDiv(JSONObject whereJson);
/**
* 自动取消分配 单条出库单明细
* @param whereJson
*/
void autoCancel(JSONObject whereJson);
} }

2
wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_management/service/dao/IOStorInvDis.java

@ -110,7 +110,7 @@ public class IOStorInvDis implements Serializable {
/** /**
* 计划数量 * 计划数量
*/ */
private String plan_qty; private BigDecimal plan_qty;
/** /**
* 实际数量 * 实际数量

4
wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_management/service/dao/mapper/IOStorInvMapper.xml

@ -82,13 +82,11 @@
dtl.*, dtl.*,
mb.material_code, mb.material_code,
mb.material_name, mb.material_name,
mst.bill_code, mst.bill_code
gp.storagevehicle_code
FROM FROM
st_ivt_iostorinvdtl dtl st_ivt_iostorinvdtl dtl
LEFT JOIN md_me_materialbase mb ON mb.material_id = dtl.material_id LEFT JOIN md_me_materialbase mb ON mb.material_id = dtl.material_id
LEFT JOIN ST_IVT_IOStorInv mst ON mst.iostorinv_id = dtl.iostorinv_id LEFT JOIN ST_IVT_IOStorInv mst ON mst.iostorinv_id = dtl.iostorinv_id
LEFT JOIN md_pb_groupplate gp ON gp.pcsn = dtl.pcsn
where where
1=1 1=1
<if test="params.bill_code != null and params.bill_code != ''"> <if test="params.bill_code != null and params.bill_code != ''">

612
wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_management/service/impl/OutBillServiceImpl.java

@ -7,6 +7,8 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -18,11 +20,16 @@ import org.nl.config.IdUtil;
import org.nl.wms.basedata_manage.enums.BaseDataEnum; import org.nl.wms.basedata_manage.enums.BaseDataEnum;
import org.nl.wms.basedata_manage.service.IBsrealStorattrService; import org.nl.wms.basedata_manage.service.IBsrealStorattrService;
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleextService; import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleextService;
import org.nl.wms.basedata_manage.service.IStructattrService;
import org.nl.wms.basedata_manage.service.dao.BsrealStorattr; import org.nl.wms.basedata_manage.service.dao.BsrealStorattr;
import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleext;
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper; import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper;
import org.nl.wms.basedata_manage.service.dto.MdPbStoragevehicleextDto;
import org.nl.wms.warehouse_management.enums.IOSConstant;
import org.nl.wms.warehouse_management.enums.IOSEnum; import org.nl.wms.warehouse_management.enums.IOSEnum;
import org.nl.wms.warehouse_management.service.IOutBillService; import org.nl.wms.warehouse_management.service.IOutBillService;
import org.nl.wms.warehouse_management.service.dao.IOStorInv; import org.nl.wms.warehouse_management.service.dao.IOStorInv;
import org.nl.wms.warehouse_management.service.dao.IOStorInvDis;
import org.nl.wms.warehouse_management.service.dao.IOStorInvDtl; import org.nl.wms.warehouse_management.service.dao.IOStorInvDtl;
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvDisMapper; import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvDisMapper;
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvDtlMapper; import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvDtlMapper;
@ -50,6 +57,12 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
@Resource @Resource
private IOStorInvDisMapper ioStorInvDisMapper; private IOStorInvDisMapper ioStorInvDisMapper;
@Resource
private IStructattrService iStructattrService;
@Resource
private IMdPbStoragevehicleextService iMdPbStoragevehicleextService;
/** /**
* 载具扩展属性mapper * 载具扩展属性mapper
*/ */
@ -245,8 +258,10 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void allDiv(JSONObject whereJson) { public void allDiv(JSONObject whereJson) {
//定义需要更新的仓位集合 String currentUserId = SecurityUtils.getCurrentUserId();
HashMap<String, JSONObject> Struct_map = new HashMap<String, JSONObject>(); String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
String iostorinv_id = whereJson.getString("iostorinv_id"); String iostorinv_id = whereJson.getString("iostorinv_id");
//查询主表信息 //查询主表信息
@ -255,15 +270,16 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
throw new BadRequestException("查不到出库单信息"); throw new BadRequestException("查不到出库单信息");
} }
String bill_type = ioStorInv.getBill_type();
//查询生成和未分配完的明细 //查询生成和未分配完的明细
JSONObject queryDtl = new JSONObject(); JSONObject queryDtl = new JSONObject();
queryDtl.put("bill_status", IOSEnum.BILL_STATUS.code("分配完")); queryDtl.put("bill_status", IOSEnum.BILL_STATUS.code("分配完"));
queryDtl.put("unassign_flag", BaseDataEnum.IS_YES_NOT.code("")); queryDtl.put("unassign_flag", BaseDataEnum.IS_YES_NOT.code(""));
queryDtl.put("iostorinv_id", iostorinv_id); queryDtl.put("iostorinv_id", iostorinv_id);
queryDtl.put("iostorinvdtl_id", whereJson.getString("iostorinvdtl_id"));
List<IOStorInvDtlDto> dtls = ioStorInvMapper.getIODtl(queryDtl); List<IOStorInvDtlDto> dtls = ioStorInvMapper.getIODtl(queryDtl);
// List<IOStorInvDtl> dtls = ioStorInvDtlMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDtl.class)
// .le(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("分配完"))
// .gt(IOStorInvDtl::getUnassign_qty,0)
// .eq(IOStorInvDtl::getIostorinv_id, iostorinv_id));
if (ObjectUtil.isEmpty(dtls)) { if (ObjectUtil.isEmpty(dtls)) {
throw new BadRequestException("当前订单无可分配出库明细"); throw new BadRequestException("当前订单无可分配出库明细");
} }
@ -272,228 +288,392 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
IOStorInvDtlDto dtl = dtls.get(i); IOStorInvDtlDto dtl = dtls.get(i);
double unassign_qty = dtl.getUnassign_qty().doubleValue(); double unassign_qty = dtl.getUnassign_qty().doubleValue();
String pcsn = dtl.getPcsn(); String pcsn = dtl.getPcsn();
String material_id = dtl.getMaterial_id();
// 根据物料和批次号查询库存可用
BigDecimal canuseSum = mdPbStoragevehicleextMapper.queryCanuseSum(pcsn,material_id);
if (canuseSum.doubleValue()<unassign_qty){
throw new BadRequestException("物料编号:"+ dtl.getMaterial_code() +"出库分配数量不满足");
}
/* /*
* 分配规则 * 分配规则
* 1.按批次先进先出 * 1.按批次先进先出
* 2.相同批次载具量小优先 * 2.相同批次载具量小优先
*/ */
//出库分配查询货位信息
if (StrUtil.isBlank(pcsn)) { List<MdPbStoragevehicleextDto> outAllocationList = mdPbStoragevehicleextMapper.queryOutAllocation(pcsn,material_id);
throw new BadRequestException("出库明细存在批次号为空");
int seq_no = 1;
for (MdPbStoragevehicleextDto outAllocation : outAllocationList) {
//分配明细
IOStorInvDis ioStorInvDis = new IOStorInvDis();
ioStorInvDis.setIostorinvdis_id(IdUtil.getStringId());
ioStorInvDis.setIostorinv_id(dtl.getIostorinv_id());
ioStorInvDis.setIostorinvdtl_id(dtl.getIostorinvdtl_id());
ioStorInvDis.setSeq_no((seq_no++)+"");
ioStorInvDis.setSect_id(outAllocation.getSect_id());
ioStorInvDis.setPcsn(outAllocation.getPcsn());
ioStorInvDis.setMaterial_id(material_id);
ioStorInvDis.setSect_name(outAllocation.getSect_name());
ioStorInvDis.setSect_code(outAllocation.getSect_code());
ioStorInvDis.setStruct_id(outAllocation.getStruct_id());
ioStorInvDis.setStruct_name(outAllocation.getStruct_name());
ioStorInvDis.setStruct_code(outAllocation.getStruct_code());
ioStorInvDis.setStoragevehicle_code(outAllocation.getStoragevehicle_code());
ioStorInvDis.setIs_issued(BaseDataEnum.IS_YES_NOT.code("否"));
ioStorInvDis.setQty_unit_id(outAllocation.getQty_unit_id());
ioStorInvDis.setQty_unit_name(outAllocation.getQty_unit_name());
ioStorInvDis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("生成"));
// 未分配数量 - 该库位上的可用数量 < 0 目前做整出
unassign_qty = unassign_qty-outAllocation.getCanuse_qty().doubleValue();
if (unassign_qty<0){
unassign_qty=0;
}
ioStorInvDis.setPlan_qty(outAllocation.getCanuse_qty());
//锁定货位
JSONObject lock_map = new JSONObject();
lock_map.put("struct_code", outAllocation.getStruct_code());
lock_map.put("inv_id", ioStorInv.getIostorinv_id());
lock_map.put("inv_code", ioStorInv.getBill_code());
lock_map.put("inv_type", ioStorInv.getBill_type());
lock_map.put("lock_type", IOSEnum.LOCK_TYPE.code("出库锁"));
iStructattrService.updateStatusByCode("0",lock_map);
//生成分配明细
ioStorInvDisMapper.insert(ioStorInvDis);
//更新库存 加冻结减可用
List<JSONObject> updateIvtList = new ArrayList<>();
JSONObject jsonIvt = new JSONObject();
jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_ADD_FROZEN);
jsonIvt.put("storagevehicle_code", outAllocation.getStoragevehicle_code());
jsonIvt.put("material_id", outAllocation.getMaterial_id());
jsonIvt.put("pcsn", outAllocation.getPcsn());
jsonIvt.put("qty_unit_id", outAllocation.getQty_unit_id());
jsonIvt.put("qty_unit_name", outAllocation.getQty_unit_name());
jsonIvt.put("change_qty", ioStorInvDis.getPlan_qty());
updateIvtList.add(jsonIvt);
iMdPbStoragevehicleextService.updateIvt(updateIvtList);
//分配完成 结束分配
if (unassign_qty==0){
break;
}
} }
// 根据批次号查询库存可用
BigDecimal canuseSum = mdPbStoragevehicleextMapper.queryCanuseSumByPcsn(pcsn); //更新详情
dtl.setBill_status(IOSEnum.BILL_STATUS.code("分配完"));
double assign_qty = dtl.getUnassign_qty().doubleValue() + dtl.getAssign_qty().doubleValue();
dtl.setUnassign_qty(BigDecimal.valueOf(unassign_qty));
dtl.setAssign_qty(BigDecimal.valueOf(assign_qty));
ioStorInvDtlMapper.updateById(dtl);
}
//更新主表
//根据单据标识判断明细是否都已经分配完成
int disCount = ioStorInvDtlMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDtl.class)
.eq(IOStorInvDtl::getIostorinv_id,iostorinv_id)
.lt(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("分配完"))
);
// 根据分配货位情况 更新主表单据状态
IOStorInv ios = new IOStorInv();
ios.setIostorinv_id(iostorinv_id);
ios.setUpdate_optid(currentUserId);
ios.setUpdate_optname(nickName);
ios.setUpdate_time(now);
ios.setBill_status(disCount>0 ? IOSEnum.BILL_STATUS.code("分配中") : IOSEnum.BILL_STATUS.code("分配完"));
ioStorInvMapper.updateById(ios);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void allCancel(JSONObject whereJson) {
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
String iostorinv_id = whereJson.getString("iostorinv_id");
List<IOStorInvDis> ioStorInvDisList = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDis.class)
.le(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("生成"))
.eq(IOStorInvDis::getIs_issued,BaseDataEnum.IS_YES_NOT.code("否"))
.eq(IOStorInvDis::getIostorinv_id,iostorinv_id)
);
if (ObjectUtil.isEmpty(ioStorInvDisList)){
throw new BadRequestException("不存在可取消的出库分配明细");
}
//需要更新的出入库单明细
Set<String> dtlSet = new HashSet<>();
for (IOStorInvDis ioStorInvDis:ioStorInvDisList){
//添加需要更新的明细标识
dtlSet.add(ioStorInvDis.getIostorinvdtl_id());
//更新库存 减冻结加可用
List<JSONObject> updateIvtList = new ArrayList<>();
JSONObject jsonIvt = new JSONObject();
jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_SUB_FROZEN_ADD_CANUSE);
jsonIvt.put("storagevehicle_code", ioStorInvDis.getStoragevehicle_code());
jsonIvt.put("material_id", ioStorInvDis.getMaterial_id());
jsonIvt.put("pcsn", ioStorInvDis.getPcsn());
jsonIvt.put("qty_unit_id", ioStorInvDis.getQty_unit_id());
jsonIvt.put("qty_unit_name", ioStorInvDis.getQty_unit_name());
jsonIvt.put("change_qty", ioStorInvDis.getPlan_qty());
updateIvtList.add(jsonIvt);
iMdPbStoragevehicleextService.updateIvt(updateIvtList);
//解锁库位
JSONObject unlock_map = new JSONObject();
unlock_map.put("struct_code", ioStorInvDis.getStruct_code());
unlock_map.put("inv_type", null);
unlock_map.put("inv_id", null);
unlock_map.put("inv_code", null);
iStructattrService.updateStatusByCode("2",unlock_map);
//删除出入库单分配表
ioStorInvDisMapper.deleteById(ioStorInvDis.getIostorinvdis_id());
}
//更新出库明细单状态
for (String dtlId:dtlSet){
IOStorInvDtl ioStorInvDtl = ioStorInvDtlMapper.selectById(dtlId);
ioStorInvDtl.setAssign_qty(BigDecimal.ZERO);
ioStorInvDtl.setUnassign_qty(ioStorInvDtl.getPlan_qty());
ioStorInvDtl.setBill_status(IOSEnum.BILL_STATUS.code("生成"));
ioStorInvDtlMapper.updateById(ioStorInvDtl);
}
//更新主表单据状态
IOStorInv ios = new IOStorInv();
ios.setIostorinv_id(iostorinv_id);
ios.setUpdate_optid(currentUserId);
ios.setUpdate_optname(nickName);
ios.setUpdate_time(now);
ios.setBill_status(IOSEnum.BILL_STATUS.code("生成"));
ioStorInvMapper.updateById(ios);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void autoDiv(JSONObject whereJson) {
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
String iostorinv_id = whereJson.getString("iostorinv_id");
//查询主表信息
IOStorInv ioStorInv = ioStorInvMapper.selectById(iostorinv_id);
if (ObjectUtil.isEmpty(ioStorInv)) {
throw new BadRequestException("查不到出库单信息");
}
//查询生成和未分配完的明细
JSONObject queryDtl = new JSONObject();
queryDtl.put("bill_status", IOSEnum.BILL_STATUS.code("分配完"));
queryDtl.put("unassign_flag", BaseDataEnum.IS_YES_NOT.code("是"));
queryDtl.put("iostorinv_id", iostorinv_id);
queryDtl.put("iostorinvdtl_id", whereJson.getString("iostorinvdtl_id"));
List<IOStorInvDtlDto> dtls = ioStorInvMapper.getIODtl(queryDtl);
if (ObjectUtil.isEmpty(dtls)) {
throw new BadRequestException("当前订单无可分配出库明细");
}
for (int i = 0; i < dtls.size(); i++) {
IOStorInvDtlDto dtl = dtls.get(i);
double unassign_qty = dtl.getUnassign_qty().doubleValue();
String pcsn = dtl.getPcsn();
String material_id = dtl.getMaterial_id();
// 根据物料和批次号查询库存可用
BigDecimal canuseSum = mdPbStoragevehicleextMapper.queryCanuseSum(pcsn,material_id);
if (canuseSum.doubleValue()<unassign_qty){ if (canuseSum.doubleValue()<unassign_qty){
throw new BadRequestException("出库分配数量不满足"); throw new BadRequestException("物料编号:"+ dtl.getMaterial_code() +"出库分配数量不满足");
} }
// boolean is_top3 = false; /*
// if (ObjectUtil.isEmpty(dtl.getString("source_bill_code")) && ObjectUtil.isEmpty(dtl.getString("pcsn"))) { * 分配规则
// is_top3 = true; * 1.按批次先进先出
// } * 2.相同批次载具量小优先
// JSONObject jsonMap = new JSONObject(); */
// // 已分配重量
// double assign_qty = dtl.getDoubleValue("assign_qty"); //出库分配查询货位信息
// List<MdPbStoragevehicleextDto> outAllocationList = mdPbStoragevehicleextMapper.queryOutAllocation(pcsn,material_id);
// if (ObjectUtil.isNotEmpty(dtl.getString("source_bill_code")) || is_top3) {
// while (unassign_qty > 0) { int seq_no = 1;
// // 1.有销售订单号 for (MdPbStoragevehicleextDto outAllocation : outAllocationList) {
// jsonMap.put("flag", "1"); //分配明细
// jsonMap.put("material_id", dtl.getString("material_id")); IOStorInvDis ioStorInvDis = new IOStorInvDis();
// jsonMap.put("sale_order_name", dtl.getString("source_bill_code")); ioStorInvDis.setIostorinvdis_id(IdUtil.getStringId());
// jsonMap.put("sect_id", whereJson.getString("sect_id")); ioStorInvDis.setIostorinv_id(dtl.getIostorinv_id());
// jsonMap.put("stor_id", whereJson.getString("stor_id")); ioStorInvDis.setIostorinvdtl_id(dtl.getIostorinvdtl_id());
// ioStorInvDis.setSeq_no((seq_no++)+"");
// JSONObject jsonOneIvt = WQL.getWO("ST_OUTIVT01").addParamMap(jsonMap).process().uniqueResult(0); ioStorInvDis.setSect_id(outAllocation.getSect_id());
// if (ObjectUtil.isEmpty(jsonOneIvt)) { ioStorInvDis.setPcsn(outAllocation.getPcsn());
// throw new BadRequestException("库存不足"); ioStorInvDis.setMaterial_id(material_id);
// } ioStorInvDis.setSect_name(outAllocation.getSect_name());
// ioStorInvDis.setSect_code(outAllocation.getSect_code());
// // 查询这一巷道所有此物料此库存此销售订单的库存 ioStorInvDis.setStruct_id(outAllocation.getStruct_id());
// jsonMap.put("flag", "2"); ioStorInvDis.setStruct_name(outAllocation.getStruct_name());
// jsonMap.put("row_num", jsonOneIvt.getString("row_num")); ioStorInvDis.setStruct_code(outAllocation.getStruct_code());
// jsonMap.put("block_num", jsonOneIvt.getString("block_num")); ioStorInvDis.setStoragevehicle_code(outAllocation.getStoragevehicle_code());
// JSONArray ivtAllArr = WQL.getWO("ST_OUTIVT01").addParamMap(jsonMap).process().getResultJSONArray(0); ioStorInvDis.setIs_issued(BaseDataEnum.IS_YES_NOT.code("否"));
// ioStorInvDis.setQty_unit_id(outAllocation.getQty_unit_id());
// for (int j = 0; j < ivtAllArr.size(); j++) { ioStorInvDis.setQty_unit_name(outAllocation.getQty_unit_name());
// JSONObject ivt = ivtAllArr.getJSONObject(j); ioStorInvDis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("生成"));
// double canuse_qty = ivt.getDoubleValue("canuse_qty");
// assign_qty = NumberUtil.add(assign_qty, canuse_qty); // 未分配数量 - 该库位上的可用数量 < 0 目前做整出
// unassign_qty = unassign_qty-outAllocation.getCanuse_qty().doubleValue();
// if (unassign_qty >= canuse_qty) { if (unassign_qty<0){
// unassign_qty = NumberUtil.sub(unassign_qty, canuse_qty); unassign_qty=0;
// } else { }
// unassign_qty = 0; ioStorInvDis.setPlan_qty(outAllocation.getCanuse_qty());
// }
// //锁定货位
// // 查询此木箱下的所有子卷 JSONObject lock_map = new JSONObject();
// jsonMap.put("flag", "3"); lock_map.put("struct_code", outAllocation.getStruct_code());
// jsonMap.put("storagevehicle_code", ivt.getString("storagevehicle_code")); lock_map.put("inv_id", ioStorInv.getIostorinv_id());
// JSONArray ivtAllArr2 = WQL.getWO("ST_OUTIVT01").addParamMap(jsonMap).process().getResultJSONArray(0); lock_map.put("inv_code", ioStorInv.getBill_code());
// lock_map.put("inv_type", ioStorInv.getBill_type());
// for (int k = 0; k < ivtAllArr2.size(); k++) { lock_map.put("lock_type", IOSEnum.LOCK_TYPE.code("出库锁"));
// // 更新库存 iStructattrService.updateStatusByCode("0",lock_map);
// JSONObject ivt2 = ivtAllArr2.getJSONObject(k);
// ivt2.put("change_qty", ivt2.getDoubleValue("canuse_qty")); //生成分配明细
// ivt2.put("bill_type_scode", jo_mst.getString("bill_type")); ioStorInvDisMapper.insert(ioStorInvDis);
// ivt2.put("inv_id", dtl.getString("iostorinv_id"));
// ivt2.put("bill_code", jo_mst.getString("bill_code")); //更新库存 加冻结减可用
// ivt2.put("bill_table", "ST_IVT_IOStorInv"); List<JSONObject> updateIvtList = new ArrayList<>();
// storPublicService.IOStor(ivt2, "11"); JSONObject jsonIvt = new JSONObject();
// jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_ADD_FROZEN);
// //生成分配明细 jsonIvt.put("storagevehicle_code", outAllocation.getStoragevehicle_code());
// dtl.put("iostorinvdis_id", cn.hutool.core.util.IdUtil.getSnowflake(1, 1).nextId()); jsonIvt.put("material_id", outAllocation.getMaterial_id());
// dtl.put("sect_id", ivt2.getString("sect_id")); jsonIvt.put("pcsn", outAllocation.getPcsn());
// dtl.put("sect_code", ivt2.getString("sect_code")); jsonIvt.put("qty_unit_id", outAllocation.getQty_unit_id());
// dtl.put("sect_name", ivt2.getString("sect_name")); jsonIvt.put("qty_unit_name", outAllocation.getQty_unit_name());
// dtl.put("struct_id", ivt2.getString("struct_id")); jsonIvt.put("change_qty", ioStorInvDis.getPlan_qty());
// dtl.put("struct_code", ivt2.getString("struct_code")); updateIvtList.add(jsonIvt);
// dtl.put("struct_name", ivt2.getString("struct_name")); iMdPbStoragevehicleextService.updateIvt(updateIvtList);
// dtl.put("pcsn", ivt2.getString("pcsn"));
// dtl.put("box_no", ivt2.getString("storagevehicle_code")); //分配完成 结束分配
// dtl.put("storagevehicle_id", ivt2.getString("storagevehicle_id")); if (unassign_qty==0){
// dtl.put("storagevehicle_code", ivt2.getString("storagevehicle_code")); break;
// dtl.put("storagevehicle_type", ivt2.getString("storagevehicle_type")); }
// dtl.put("is_issued", "0"); }
// dtl.put("plan_qty", ivt2.getDoubleValue("change_qty"));
// dtl.put("real_qty", ivt2.getDoubleValue("change_qty")); //更新详情
// dtl.put("is_overdue", ivt2.getString("is_overdue")); dtl.setBill_status(IOSEnum.BILL_STATUS.code("分配完"));
// dtl.put("instorage_time", ivt2.getString("instorage_time")); double assign_qty = dtl.getUnassign_qty().doubleValue() + dtl.getAssign_qty().doubleValue();
// dtl.setUnassign_qty(BigDecimal.valueOf(unassign_qty));
// // 如果所属仓位是虚拟区 则将分配明细状态变为生成 dtl.setAssign_qty(BigDecimal.valueOf(assign_qty));
// JSONObject jsonSect = wo_sect.query("sect_id = '" + ivt2.getString("sect_id") + "'").uniqueResult(0); ioStorInvDtlMapper.updateById(dtl);
// if (StrUtil.equals(jsonSect.getString("sect_type_attr"), "09")) { }
// dtl.put("work_status", "01");
// } else { //更新主表
// dtl.put("work_status", "00"); //根据单据标识判断明细是否都已经分配完成
// } int disCount = ioStorInvDtlMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDtl.class)
// .eq(IOStorInvDtl::getIostorinv_id,iostorinv_id)
// if (jo_mst.getString("is_overdue").equals("1")) { .lt(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("分配完"))
// // 判断是否超期 );
// if (ivt2.getString("is_overdue").equals("1")) {
// dtl.put("work_status", "01"); // 根据分配货位情况 更新主表单据状态
// } IOStorInv ios = new IOStorInv();
// } ios.setIostorinv_id(iostorinv_id);
// wo_dis.insert(dtl); ios.setUpdate_optid(currentUserId);
// } ios.setUpdate_optname(nickName);
// //记录需锁定的仓位 ios.setUpdate_time(now);
// Struct_map.put(ivt.getString("struct_id"), ivt); ios.setBill_status(disCount>0 ? IOSEnum.BILL_STATUS.code("分配中") : IOSEnum.BILL_STATUS.code("分配完"));
// // 为零结束 ioStorInvMapper.updateById(ios);
// if (unassign_qty == 0) { }
// break;
// } @Override
// } public void autoCancel(JSONObject whereJson) {
// } String currentUserId = SecurityUtils.getCurrentUserId();
// String nickName = SecurityUtils.getCurrentNickName();
// } else { String now = DateUtil.now();
// // 确定子卷: 根据子卷找到库存出掉
// jsonMap.put("flag", "1"); String iostorinv_id = whereJson.getString("iostorinv_id");
// jsonMap.put("material_id", dtl.getString("material_id"));
// jsonMap.put("pcsn", dtl.getString("pcsn")); List<IOStorInvDis> ioStorInvDisList = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDis.class)
// jsonMap.put("box_no", dtl.getString("box_no")); .le(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("生成"))
// jsonMap.put("sect_id", whereJson.getString("sect_id")); .eq(IOStorInvDis::getIs_issued,BaseDataEnum.IS_YES_NOT.code("否"))
// jsonMap.put("stor_id", whereJson.getString("stor_id")); .eq(IOStorInvDis::getIostorinv_id,iostorinv_id)
// .eq(IOStorInvDis::getIostorinvdtl_id,whereJson.getString("iostorinvdtl_id"))
// JSONObject jsonIvt = WQL.getWO("ST_OUTIVT01").addParamMap(jsonMap).process().uniqueResult(0); );
// if (ObjectUtil.isEmpty(jsonIvt)) { if (ObjectUtil.isEmpty(ioStorInvDisList)){
// throw new BadRequestException("库存不足"); throw new BadRequestException("不存在可取消的出库分配明细");
// }
//
// double canuse_qty ;
// if (StrUtil.equals(bill_type, "1011")) {
// canuse_qty = dtl.getDoubleValue("plan_qty");
// } else {
// canuse_qty = jsonIvt.getDoubleValue("canuse_qty");
// }
//
// jsonIvt.put("change_qty", canuse_qty + "");
// unassign_qty = 0;
// assign_qty = NumberUtil.add(assign_qty, canuse_qty);
//
// //更新库存
// jsonIvt.put("bill_type_scode", jo_mst.getString("bill_type"));
// jsonIvt.put("inv_id", dtl.getString("iostorinv_id"));
// jsonIvt.put("bill_code", jo_mst.getString("bill_code"));
// jsonIvt.put("bill_table", "ST_IVT_IOStorInv");
// storPublicService.IOStor(jsonIvt, "11");
// //生成分配明细
// dtl.put("iostorinvdis_id", cn.hutool.core.util.IdUtil.getSnowflake(1, 1).nextId());
// dtl.put("sect_id", jsonIvt.getString("sect_id"));
// dtl.put("sect_code", jsonIvt.getString("sect_code"));
// dtl.put("sect_name", jsonIvt.getString("sect_name"));
// dtl.put("struct_id", jsonIvt.getString("struct_id"));
// dtl.put("struct_code", jsonIvt.getString("struct_code"));
// dtl.put("struct_name", jsonIvt.getString("struct_name"));
// dtl.put("pcsn", jsonIvt.getString("pcsn"));
// dtl.put("box_no", jsonIvt.getString("storagevehicle_code"));
// dtl.put("storagevehicle_id", jsonIvt.getString("storagevehicle_id"));
// dtl.put("storagevehicle_code", jsonIvt.getString("storagevehicle_code"));
// dtl.put("storagevehicle_type", jsonIvt.getString("storagevehicle_type"));
// dtl.put("is_issued", "0");
// dtl.put("plan_qty", jsonIvt.getDoubleValue("change_qty"));
// dtl.put("real_qty", jsonIvt.getDoubleValue("change_qty"));
// dtl.put("is_overdue", jsonIvt.getString("is_overdue"));
// dtl.put("instorage_time", jsonIvt.getString("instorage_time"));
// // 如果所属仓位是虚拟区 则将分配明细状态变为生成
// JSONObject jsonSect = wo_sect.query("sect_id = '" + jsonIvt.getString("sect_id") + "'").uniqueResult(0);
// if (StrUtil.equals(jsonSect.getString("sect_type_attr"), "09")) {
// dtl.put("work_status", "01");
// } else {
// dtl.put("work_status", "00");
// }
//
// // 判断是否超期
// if (jo_mst.getString("is_overdue").equals("1")) {
// if (jsonIvt.getString("is_overdue").equals("1")) {
// dtl.put("work_status", "01");
// }
// }
//
// wo_dis.insert(dtl);
//
// //记录需锁定的仓位 (如果此明细有相同物料的且子卷号不能为空的则在最后一个明细分配完成后锁定仓位)
// JSONObject map = new JSONObject();
// map.put("flag", "5");
// map.put("material_id", dtl.getString("material_id"));
// map.put("box_no", dtl.getString("box_no"));
// map.put("iostorinv_id", iostorinv_id);
// map.put("iostorinvdtl_id", dtl.getString("iostorinvdtl_id"));
// JSONArray dtlArr = WQL.getWO("ST_OUTIVT01").addParamMap(map).process().getResultJSONArray(0);
// if (dtlArr.size() == 0) {
// Struct_map.put(jsonIvt.getString("struct_id"), jsonIvt);
// }
//
// }
// HashMap<String, String> map_dtl = new HashMap<String, String>();
// //更新明细
// map_dtl.put("unassign_qty", unassign_qty + "");
// map_dtl.put("assign_qty", assign_qty + "");
// if (unassign_qty == 0) {
// map_dtl.put("bill_status", "40");
// } else {
// map_dtl.put("bill_status", "30");
// }
// wo_dtl.update(map_dtl, "iostorinvdtl_id='" + dtl.getString("iostorinvdtl_id") + "'");
//
// //更新主表状态
// this.updateMststatus(iostorinv_id);
//
// //锁定起点点位、仓位
// Collection<JSONObject> c = Struct_map.values();
// Iterator<JSONObject> it = c.iterator();
// JSONObject from_start = new JSONObject();
// from_start.put("lock_type", "3");
// for (; it.hasNext(); ) {
// JSONObject Struct = it.next();
// from_start.put("struct_id", Struct.getString("struct_id"));
// from_start.put("inv_type", jo_mst.getString("bill_type"));
// from_start.put("inv_id", jo_mst.getString("iostorinv_id"));
// from_start.put("inv_code", jo_mst.getString("bill_code"));
// storPublicService.updateStructAndPoint(from_start);
// }
} }
//需要更新的出入库单明细
Set<String> dtlSet = new HashSet<>();
for (IOStorInvDis ioStorInvDis:ioStorInvDisList){
//添加需要更新的明细标识
dtlSet.add(ioStorInvDis.getIostorinvdtl_id());
//更新库存 减冻结加可用
List<JSONObject> updateIvtList = new ArrayList<>();
JSONObject jsonIvt = new JSONObject();
jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_SUB_FROZEN_ADD_CANUSE);
jsonIvt.put("storagevehicle_code", ioStorInvDis.getStoragevehicle_code());
jsonIvt.put("material_id", ioStorInvDis.getMaterial_id());
jsonIvt.put("pcsn", ioStorInvDis.getPcsn());
jsonIvt.put("qty_unit_id", ioStorInvDis.getQty_unit_id());
jsonIvt.put("qty_unit_name", ioStorInvDis.getQty_unit_name());
jsonIvt.put("change_qty", ioStorInvDis.getPlan_qty());
updateIvtList.add(jsonIvt);
iMdPbStoragevehicleextService.updateIvt(updateIvtList);
//解锁库位
JSONObject unlock_map = new JSONObject();
unlock_map.put("struct_code", ioStorInvDis.getStruct_code());
unlock_map.put("inv_type", null);
unlock_map.put("inv_id", null);
unlock_map.put("inv_code", null);
iStructattrService.updateStatusByCode("2",unlock_map);
//删除出入库单分配表
ioStorInvDisMapper.deleteById(ioStorInvDis.getIostorinvdis_id());
}
//更新出库明细单状态
for (String dtlId:dtlSet){
IOStorInvDtl ioStorInvDtl = ioStorInvDtlMapper.selectById(dtlId);
ioStorInvDtl.setAssign_qty(BigDecimal.ZERO);
ioStorInvDtl.setUnassign_qty(ioStorInvDtl.getPlan_qty());
ioStorInvDtl.setBill_status(IOSEnum.BILL_STATUS.code("生成"));
ioStorInvDtlMapper.updateById(ioStorInvDtl);
}
//更新主表
//根据单据标识判断明细是否都已经分配完成
int disCount = ioStorInvDtlMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDtl.class)
.eq(IOStorInvDtl::getIostorinv_id,iostorinv_id)
.le(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("分配完"))
.gt(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("生成"))
);
// 根据分配货位情况 更新主表单据状态
IOStorInv ios = new IOStorInv();
ios.setIostorinv_id(iostorinv_id);
ios.setUpdate_optid(currentUserId);
ios.setUpdate_optname(nickName);
ios.setUpdate_time(now);
ios.setBill_status(disCount>0 ? IOSEnum.BILL_STATUS.code("分配中") : IOSEnum.BILL_STATUS.code("生成"));
ioStorInvMapper.updateById(ios);
} }
} }

15
wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_management/service/impl/RawAssistIStorServiceImpl.java

@ -186,6 +186,8 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
ioStorInvDtl.put("bill_status",IOSEnum.BILL_STATUS.code("生成")); ioStorInvDtl.put("bill_status",IOSEnum.BILL_STATUS.code("生成"));
ioStorInvDtl.put("qty_unit_id",row.get("qty_unit_id")); ioStorInvDtl.put("qty_unit_id",row.get("qty_unit_id"));
ioStorInvDtl.put("qty_unit_name",row.get("qty_unit_name")); ioStorInvDtl.put("qty_unit_name",row.get("qty_unit_name"));
ioStorInvDtl.put("source_bill_type",row.get("ext_type"));
ioStorInvDtl.put("source_bill_code",row.get("ext_code"));
ioStorInvDtl.put("assign_qty","0"); ioStorInvDtl.put("assign_qty","0");
ioStorInvDtl.put("unassign_qty",row.get("plan_qty")); ioStorInvDtl.put("unassign_qty",row.get("plan_qty"));
ioStorInvDtl.put("plan_qty",row.get("plan_qty")); ioStorInvDtl.put("plan_qty",row.get("plan_qty"));
@ -343,7 +345,7 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
//判断该分配明细是否已经分配货位 //判断该分配明细是否已经分配货位
IOStorInvDis ioStorInvDis = ioStorInvDisMapper.selectOne(new LambdaQueryWrapper<>(IOStorInvDis.class) IOStorInvDis ioStorInvDis = ioStorInvDisMapper.selectOne(new LambdaQueryWrapper<>(IOStorInvDis.class)
.eq(IOStorInvDis::getIostorinvdis_id,map.get("iostorinvdis_id")) .eq(IOStorInvDis::getIostorinvdis_id,map.get("iostorinvdis_id"))
.isNull(IOStorInvDis::getStruct_code).or().eq(IOStorInvDis::getStruct_code,"")); .and(wrapper-> wrapper.isNull(IOStorInvDis::getStruct_code).or().eq(IOStorInvDis::getStruct_code,"")));
if (ObjectUtil.isEmpty(ioStorInvDis)){ if (ObjectUtil.isEmpty(ioStorInvDis)){
throw new BadRequestException("该明细已经分配过货位,无法继续分配!"); throw new BadRequestException("该明细已经分配过货位,无法继续分配!");
} }
@ -405,6 +407,7 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
lock_map.put("inv_id", ioStorInv.getIostorinv_id()); lock_map.put("inv_id", ioStorInv.getIostorinv_id());
lock_map.put("inv_code", ioStorInv.getBill_code()); lock_map.put("inv_code", ioStorInv.getBill_code());
lock_map.put("inv_type", ioStorInv.getBill_type()); lock_map.put("inv_type", ioStorInv.getBill_type());
lock_map.put("lock_type", IOSEnum.LOCK_TYPE.code("入库锁"));
iStructattrService.updateStatusByCode("0",lock_map); iStructattrService.updateStatusByCode("0",lock_map);
// 更新分配明细表 // 更新分配明细表
@ -429,7 +432,7 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
//根据单据标识判断分配明细是否都已经分配完成 //根据单据标识判断分配明细是否都已经分配完成
int disCount = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class) int disCount = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class)
.eq(IOStorInvDis::getIostorinv_id,map.get("iostorinv_id")) .eq(IOStorInvDis::getIostorinv_id,map.get("iostorinv_id"))
.isNull(IOStorInvDis::getStruct_code).or().eq(IOStorInvDis::getStruct_code,"")); .and(wrapper -> wrapper.isNull(IOStorInvDis::getStruct_code).or().eq(IOStorInvDis::getStruct_code,"")));
// 根据分配货位情况 更新主表单据状态 // 根据分配货位情况 更新主表单据状态
IOStorInv ios = new IOStorInv(); IOStorInv ios = new IOStorInv();
@ -482,7 +485,7 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
//根据单据标识判断分配明细是否都已经分配完成 //根据单据标识判断分配明细是否都已经分配完成
int disCount = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class) int disCount = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class)
.eq(IOStorInvDis::getIostorinv_id,jo.get("iostorinv_id")) .eq(IOStorInvDis::getIostorinv_id,jo.get("iostorinv_id"))
.isNotNull(IOStorInvDis::getStruct_code).or().ne(IOStorInvDis::getStruct_code,"")); .and(wrapper -> wrapper.isNotNull(IOStorInvDis::getStruct_code).or().ne(IOStorInvDis::getStruct_code,"")));
// 根据分配货位情况 更新主表单据状态 // 根据分配货位情况 更新主表单据状态
IOStorInv ios = new IOStorInv(); IOStorInv ios = new IOStorInv();
@ -504,7 +507,7 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
//判断是否已经分配好货位 //判断是否已经分配好货位
IOStorInvDis ioStorInvDis = ioStorInvDisMapper.selectOne(new LambdaQueryWrapper<>(IOStorInvDis.class) IOStorInvDis ioStorInvDis = ioStorInvDisMapper.selectOne(new LambdaQueryWrapper<>(IOStorInvDis.class)
.eq(IOStorInvDis::getIostorinvdis_id,map.get("iostorinvdis_id")) .eq(IOStorInvDis::getIostorinvdis_id,map.get("iostorinvdis_id"))
.isNotNull(IOStorInvDis::getStruct_code).or().ne(IOStorInvDis::getStruct_code,"")); .and(wrapper -> wrapper.isNotNull(IOStorInvDis::getStruct_code).or().ne(IOStorInvDis::getStruct_code,"")));
if (ObjectUtil.isEmpty(ioStorInvDis)){ if (ObjectUtil.isEmpty(ioStorInvDis)){
throw new BadRequestException("该明细还没分配货位,请先分配货位"); throw new BadRequestException("该明细还没分配货位,请先分配货位");
} }
@ -630,9 +633,7 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
List<Structattr> structattrList = iStructattrService.list(new LambdaQueryWrapper<>(Structattr.class) List<Structattr> structattrList = iStructattrService.list(new LambdaQueryWrapper<>(Structattr.class)
.eq(Structattr::getSect_id,sect_id) .eq(Structattr::getSect_id,sect_id)
.eq(Structattr::getLock_type,IOSEnum.LOCK_TYPE.code("未锁定")) .eq(Structattr::getLock_type,IOSEnum.LOCK_TYPE.code("未锁定"))
.and(row -> row.isNull(Structattr::getStoragevehicle_code).or( .and(wrapper -> wrapper.isNull(Structattr::getStoragevehicle_code).or().eq(Structattr::getStoragevehicle_code,""))
it -> it.eq(Structattr::getStoragevehicle_code,"")
))
); );
if (ObjectUtil.isEmpty(structattrList)){ if (ObjectUtil.isEmpty(structattrList)){
throw new BadRequestException("该库区没有仓位"); throw new BadRequestException("该库区没有仓位");

18
wms/nladmin-ui/src/views/wms/st/outbill/DivDialog.vue

@ -240,7 +240,7 @@ import StructIvt from '@/views/wms/st/outbill/StructIvt'
import PointDialog from '@/views/wms/sch/point/PointDialog' import PointDialog from '@/views/wms/sch/point/PointDialog'
import crudPoint from '@/views/wms/sch/point/schBasePoint' import crudPoint from '@/views/wms/sch/point/schBasePoint'
import crudSectattr from '@/views/wms/basedata/sectattr/sectattr' import crudSectattr from '@/views/wms/basedata/sectattr/sectattr'
import { getOutBillDis } from './checkoutbill' import { autoCancel, getOutBillDis } from './checkoutbill'
export default { export default {
name: 'DivDialog', name: 'DivDialog',
@ -297,7 +297,6 @@ export default {
pointList: [], pointList: [],
rules: { rules: {
}, },
overdue_qyt: 0
} }
}, },
watch: { watch: {
@ -378,7 +377,6 @@ export default {
deleteRow(row) { deleteRow(row) {
checkoutbill.oneCancel(row).then(res => { checkoutbill.oneCancel(row).then(res => {
this.queryTableDtl() this.queryTableDtl()
this.updataIsOverdue()
}) })
}, },
handleDtlCurrentChange(current) { handleDtlCurrentChange(current) {
@ -423,7 +421,6 @@ export default {
checkoutbill.allDiv(this.mstrow).then(res => { checkoutbill.allDiv(this.mstrow).then(res => {
this.crud.notify('分配成功!', CRUD.NOTIFICATION_TYPE.INFO) this.crud.notify('分配成功!', CRUD.NOTIFICATION_TYPE.INFO)
this.queryTableDtl() this.queryTableDtl()
this.updataIsOverdue()
this.loadingAlldiv = false this.loadingAlldiv = false
}).catch(() => { }).catch(() => {
this.loadingAlldiv = false this.loadingAlldiv = false
@ -435,7 +432,6 @@ export default {
this.mstrow.iostorinvdtl_id = this.currentRow.iostorinvdtl_id this.mstrow.iostorinvdtl_id = this.currentRow.iostorinvdtl_id
checkoutbill.allDivOne(this.mstrow).then(res => { checkoutbill.allDivOne(this.mstrow).then(res => {
this.queryTableDtl() this.queryTableDtl()
this.updataIsOverdue()
this.loadingAutodiv = false this.loadingAutodiv = false
}).catch(() => { }).catch(() => {
this.loadingAutodiv = false this.loadingAutodiv = false
@ -446,7 +442,6 @@ export default {
this.loadingAlldiv = true this.loadingAlldiv = true
checkoutbill.allCancel(this.mstrow).then(res => { checkoutbill.allCancel(this.mstrow).then(res => {
this.queryTableDtl() this.queryTableDtl()
this.updataIsOverdue()
this.loadingAlldiv = false this.loadingAlldiv = false
}).catch(() => { }).catch(() => {
this.loadingAlldiv = false this.loadingAlldiv = false
@ -455,10 +450,9 @@ export default {
oneCancel() { oneCancel() {
this.loadingAlldiv = true this.loadingAlldiv = true
if (this.currentRow.iostorinvdtl_id !== null) { if (this.currentRow.iostorinvdtl_id !== null) {
checkoutbill.allCancel(this.currentRow).then(res => { checkoutbill.autoCancel(this.currentRow).then(res => {
this.queryTableDtl() this.queryTableDtl()
this.loadingAlldiv = false this.loadingAlldiv = false
this.updataIsOverdue()
}).catch(() => { }).catch(() => {
this.loadingAlldiv = false this.loadingAlldiv = false
}) })
@ -491,7 +485,6 @@ export default {
}, },
queryTableDtl2() { queryTableDtl2() {
this.queryTableDtl() this.queryTableDtl()
this.updataIsOverdue()
}, },
queryTableDdis(iostorinvdtl_id) { queryTableDdis(iostorinvdtl_id) {
checkoutbill.getOutBillDis({ 'iostorinvdtl_id': iostorinvdtl_id, 'bill_status': '01' }).then(res => { checkoutbill.getOutBillDis({ 'iostorinvdtl_id': iostorinvdtl_id, 'bill_status': '01' }).then(res => {
@ -519,13 +512,6 @@ export default {
return stylejson return stylejson
} }
} }
},
updataIsOverdue() {
this.rowmst.iostorinvdtl_id = this.currentRow.iostorinvdtl_id
checkoutbill.updataIsOverdue(this.rowmst).then(res => {
this.overdue_qyt = res.overdue_qyt
this.rowmst = res.mst
})
} }
} }
} }

18
wms/nladmin-ui/src/views/wms/st/outbill/checkoutbill.js

@ -74,7 +74,7 @@ export function allDiv(data) {
} }
export function allDivOne(data) { export function allDivOne(data) {
return request({ return request({
url: '/api/checkoutbill/allDivOne', url: '/api/checkoutbill/autoDiv',
method: 'post', method: 'post',
data data
}) })
@ -86,6 +86,13 @@ export function allCancel(data) {
data data
}) })
} }
export function autoCancel(data) {
return request({
url: '/api/checkoutbill/autoCancel',
method: 'post',
data
})
}
export function oneCancel(data) { export function oneCancel(data) {
return request({ return request({
url: '/api/checkoutbill/oneCancel', url: '/api/checkoutbill/oneCancel',
@ -232,13 +239,6 @@ export function outReturn(data) {
data data
}) })
} }
export function updataIsOverdue(data) {
return request({
url: '/api/checkoutbill/updataIsOverdue',
method: 'post',
data
})
}
export function excelImport(data) { export function excelImport(data) {
return request({ return request({
url: '/api/checkoutbill/importExcel', url: '/api/checkoutbill/importExcel',
@ -253,4 +253,4 @@ export function saveUpdate(data) {
data data
}) })
} }
export default { add, edit, del, allDiv, allCancel, getOutBillDtl, getOutBillDis, setPoint, oneSetPoint, getOutBillTask, getStructIvt, manualDiv, confirm, issueTask, finishTask, cancleTaskfinish, getInvTypes, paramByCodeType, schAreaType, backConfirm, getOutBillDisDtl, getType, allDivOne, moneySubmit, getDisNum, queryBox, getOutBillTask2, oneCancel, cancelTask, allSetPoint, oneSetPoint2, outReturn, updataIsOverdue, excelImport, saveUpdate } export default { add, edit, del, allDiv, allCancel, getOutBillDtl, getOutBillDis, autoCancel, setPoint, oneSetPoint, getOutBillTask, getStructIvt, manualDiv, confirm, issueTask, finishTask, cancleTaskfinish, getInvTypes, paramByCodeType, schAreaType, backConfirm, getOutBillDisDtl, getType, allDivOne, moneySubmit, getDisNum, queryBox, getOutBillTask2, oneCancel, cancelTask, allSetPoint, oneSetPoint2, outReturn, excelImport, saveUpdate }

2
wms/nladmin-ui/src/views/wms/st/outbill/index.vue

@ -334,7 +334,7 @@ export default {
buttonChange(current) { buttonChange(current) {
if (current !== null) { if (current !== null) {
this.currentRow = current this.currentRow = current
if (current.bill_status === '10' || current.bill_status === '30' || current.bill_status === '40') { if (current.bill_status === '10' || current.bill_status === '20' || current.bill_status === '30' || current.bill_status === '40') {
this.dis_flag = false this.dis_flag = false
} else { } else {
this.dis_flag = true this.dis_flag = true

Loading…
Cancel
Save