Browse Source

opt: 1.出库分配完善

master
丁世豪 1 week ago
parent
commit
42c1a1b9b4
  1. 7
      wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/basedata_manage/service/dao/mapper/MdPbStoragevehicleextMapper.java
  2. 52
      wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/basedata_manage/service/dao/mapper/MdPbStoragevehicleextMapper.xml
  3. 6
      wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/basedata_manage/service/dto/MdPbStoragevehicleextDto.java
  4. 34
      wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_management/controller/OutBillController.java
  5. 37
      wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_management/service/IOutBillService.java
  6. 384
      wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_management/service/impl/OutBillServiceImpl.java
  7. 46
      wms/nladmin-ui/src/views/wms/st/outbill/StructIvt.vue
  8. 23
      wms/nladmin-ui/src/views/wms/st/outbill/checkoutbill.js

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

@ -73,4 +73,11 @@ public interface MdPbStoragevehicleextMapper extends BaseMapper<MdPbStoragevehic
* @return List<JSONObject>
*/
List<JSONObject> getIosDtl(@Param("param") JSONObject whereJson);
/**
* 查询可用库存
* @param whereJson
* @return
*/
List<MdPbStoragevehicleextDto> queryAvailableInv(@Param("params") Map whereJson);
}

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

@ -207,4 +207,56 @@
</where>
ORDER BY ext.insert_time Desc
</select>
<select id="queryAvailableInv" resultType="org.nl.wms.basedata_manage.service.dto.MdPbStoragevehicleextDto">
SELECT
ext.storagevehicleext_id,
ext.storagevehicle_code,
ext.pcsn,
ext.qty_unit_name,
ext.canuse_qty,
ext.frozen_qty,
ext.remark,
ext.insert_time,
attr.sect_id,
attr.sect_code,
attr.sect_name,
attr.struct_id,
attr.struct_code,
attr.struct_name,
mater.material_code,
mater.material_name
FROM
md_pb_storagevehicleext ext
INNER JOIN st_ivt_structattr attr ON ext.storagevehicle_code = attr.storagevehicle_code
INNER JOIN md_me_materialbase mater ON mater.material_id = ext.material_id
<where>
1 = 1
<if test="params.stor_id != null and params.stor_id != ''">
AND
attr.stor_id = #{params.stor_id}
</if>
<if test="params.material_code != null and params.material_code != ''">
AND
mater.material_code = #{params.material_code}
</if>
<if test="params.sect_id != null and params.sect_id != ''">
AND
attr.sect_id = #{params.sect_id}
</if>
<if test="params.struct_code != null and params.struct_code != ''">
AND
(attr.struct_code LIKE CONCAT('%', #{params.struct_code}, '%')
</if>
<if test="params.pcsn != null and params.pcsn != ''">
AND
ext.pcsn LIKE #{params.pcsn}
</if>
</where>
ORDER BY ext.insert_time
</select>
</mapper>

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

@ -39,4 +39,10 @@ public class MdPbStoragevehicleextDto extends MdPbStoragevehicleext{
* 仓位名称
*/
private String struct_name;
/**
* 物料名称
*/
private String material_name;
}

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

@ -85,4 +85,38 @@ public class OutBillController {
iOutBillService.autoCancel(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@GetMapping("/getStructIvt")
@Log("查询可分配库存")
public ResponseEntity<Object> getStructIvt(@RequestParam Map whereJson) {
return new ResponseEntity<>(iOutBillService.queryAvailableInv(whereJson), HttpStatus.OK);
}
@PostMapping("/manualDiv")
@Log("出库单手动分配")
public ResponseEntity<Object> manualDiv(@RequestBody JSONObject whereJson) {
iOutBillService.manualDiv(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@PostMapping("/oneCancel")
@Log("出库单取消分配")
public ResponseEntity<Object> oneCancel (@RequestBody JSONObject whereJson) {
iOutBillService.oneCancel(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@PostMapping("/allSetPoint")
@Log("一键设置")
public ResponseEntity<Object> allSetPoint(@RequestBody JSONObject whereJson) {
iOutBillService.allSetPoint(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@PostMapping("/confirm")
@Log("出库单强制确认")
public ResponseEntity<Object> confirm(@RequestBody JSONObject whereJson) {
iOutBillService.confirm(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
}

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

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.nl.common.domain.query.PageQuery;
import org.nl.wms.basedata_manage.service.dto.MdPbStoragevehicleextDto;
import org.nl.wms.warehouse_management.service.dao.IOStorInv;
import org.nl.wms.warehouse_management.service.dto.IOStorInvDisDto;
import org.nl.wms.warehouse_management.service.dto.IOStorInvDtlDto;
@ -94,4 +95,40 @@ public interface IOutBillService extends IService<IOStorInv> {
* @param whereJson
*/
void autoCancel(JSONObject whereJson);
/**
* 查询可用库存
* @param whereJson
* @return
*/
List<MdPbStoragevehicleextDto> queryAvailableInv(Map whereJson);
/**
* 出库单手动分配
*
* @param whereJson /
*/
void manualDiv(JSONObject whereJson);
/**
* 出库单取消分配
*
* @param whereJson /
*/
void oneCancel(JSONObject whereJson);
/**
* 设置全部站点
*
* @param whereJson /
*/
void allSetPoint(JSONObject whereJson);
/**
* 出库单强制确认(更新仓位以及库存信息)
*
* @param whereJson /
*/
void confirm(JSONObject whereJson);
}

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

@ -17,6 +17,7 @@ import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.CodeUtil;
import org.nl.common.utils.SecurityUtils;
import org.nl.config.IdUtil;
import org.nl.config.SpringContextHolder;
import org.nl.wms.basedata_manage.enums.BaseDataEnum;
import org.nl.wms.basedata_manage.service.IBsrealStorattrService;
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleextService;
@ -25,12 +26,17 @@ 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.dto.MdPbStoragevehicleextDto;
import org.nl.wms.sch_manage.service.dao.SchBasePoint;
import org.nl.wms.sch_manage.service.dao.mapper.SchBasePointMapper;
import org.nl.wms.sch_manage.service.util.tasks.StInTask;
import org.nl.wms.warehouse_management.enums.IOSConstant;
import org.nl.wms.warehouse_management.enums.IOSEnum;
import org.nl.wms.warehouse_management.service.IOutBillService;
import org.nl.wms.warehouse_management.service.dao.GroupPlate;
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.mapper.GroupPlateMapper;
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.IOStorInvMapper;
@ -75,6 +81,12 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
@Resource
private IOStorInvDtlMapper ioStorInvDtlMapper;
@Resource
private GroupPlateMapper groupPlateMapper;
@Resource
private SchBasePointMapper schBasePointMapper;
@Override
public IPage<IOStorInv> pageQuery(Map whereJson, PageQuery page, String[] stor_id, String[] bill_status, String[] bill_type) {
@ -307,6 +319,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
List<MdPbStoragevehicleextDto> outAllocationList = mdPbStoragevehicleextMapper.queryOutAllocation(pcsn,material_id);
int seq_no = 1;
double allocation_canuse_qty = 0;
for (MdPbStoragevehicleextDto outAllocation : outAllocationList) {
//分配明细
IOStorInvDis ioStorInvDis = new IOStorInvDis();
@ -329,10 +342,18 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
ioStorInvDis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("生成"));
// 未分配数量 - 该库位上的可用数量 < 0 目前做整出
// double canuse_qty = outAllocation.getCanuse_qty().doubleValue();
// if (unassign_qty-canuse_qty>=0){
// ioStorInvDis.setPlan_qty(BigDecimal.valueOf(canuse_qty));
// }else {
// ioStorInvDis.setPlan_qty(BigDecimal.valueOf(unassign_qty));
// }
// unassign_qty = unassign_qty-canuse_qty;
unassign_qty = unassign_qty-outAllocation.getCanuse_qty().doubleValue();
if (unassign_qty<0){
unassign_qty=0;
}
allocation_canuse_qty = allocation_canuse_qty + outAllocation.getCanuse_qty().doubleValue();
ioStorInvDis.setPlan_qty(outAllocation.getCanuse_qty());
//锁定货位
@ -368,7 +389,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
//更新详情
dtl.setBill_status(IOSEnum.BILL_STATUS.code("分配完"));
double assign_qty = dtl.getUnassign_qty().doubleValue() + dtl.getAssign_qty().doubleValue();
double assign_qty = allocation_canuse_qty + dtl.getAssign_qty().doubleValue();
dtl.setUnassign_qty(BigDecimal.valueOf(unassign_qty));
dtl.setAssign_qty(BigDecimal.valueOf(assign_qty));
ioStorInvDtlMapper.updateById(dtl);
@ -513,6 +534,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
List<MdPbStoragevehicleextDto> outAllocationList = mdPbStoragevehicleextMapper.queryOutAllocation(pcsn,material_id);
int seq_no = 1;
double allocation_canuse_qty = 0;
for (MdPbStoragevehicleextDto outAllocation : outAllocationList) {
//分配明细
IOStorInvDis ioStorInvDis = new IOStorInvDis();
@ -535,10 +557,18 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
ioStorInvDis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("生成"));
// 未分配数量 - 该库位上的可用数量 < 0 目前做整出
// double canuse_qty = outAllocation.getCanuse_qty().doubleValue();
// if (unassign_qty-canuse_qty>=0){
// ioStorInvDis.setPlan_qty(BigDecimal.valueOf(canuse_qty));
// }else {
// ioStorInvDis.setPlan_qty(BigDecimal.valueOf(unassign_qty));
// }
// unassign_qty = unassign_qty-canuse_qty;
unassign_qty = unassign_qty-outAllocation.getCanuse_qty().doubleValue();
if (unassign_qty<0){
unassign_qty=0;
}
allocation_canuse_qty = allocation_canuse_qty + outAllocation.getCanuse_qty().doubleValue();
ioStorInvDis.setPlan_qty(outAllocation.getCanuse_qty());
//锁定货位
@ -574,7 +604,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
//更新详情
dtl.setBill_status(IOSEnum.BILL_STATUS.code("分配完"));
double assign_qty = dtl.getUnassign_qty().doubleValue() + dtl.getAssign_qty().doubleValue();
double assign_qty = allocation_canuse_qty + dtl.getAssign_qty().doubleValue();
dtl.setUnassign_qty(BigDecimal.valueOf(unassign_qty));
dtl.setAssign_qty(BigDecimal.valueOf(assign_qty));
ioStorInvDtlMapper.updateById(dtl);
@ -676,4 +706,354 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
ioStorInvMapper.updateById(ios);
}
@Override
public List<MdPbStoragevehicleextDto> queryAvailableInv(Map whereJson) {
return mdPbStoragevehicleextMapper.queryAvailableInv(whereJson);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void manualDiv(JSONObject whereJson) {
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
JSONObject row = whereJson.getJSONObject("row");
JSONArray rows = whereJson.getJSONArray("rows");
String iostorinv_id = row.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", row.getString("iostorinvdtl_id"));
List<IOStorInvDtlDto> dtls = ioStorInvMapper.getIODtl(queryDtl);
if (ObjectUtil.isEmpty(dtls)) {
throw new BadRequestException("当前订单无可分配出库明细");
}
for (IOStorInvDtlDto dtl:dtls){
double unassign_qty = dtl.getUnassign_qty().doubleValue();
//分配数量
double allocation_canuse_qty = 0;
for (int i = 0; i < rows.size(); i++){
JSONObject ivt = rows.getJSONObject(i);
double canuse_qty = ivt.getDoubleValue("canuse_qty");
//分配明细
IOStorInvDis ioStorInvDis = new IOStorInvDis();
ioStorInvDis.setIostorinvdis_id(IdUtil.getStringId());
ioStorInvDis.setIostorinv_id(dtl.getIostorinv_id());
ioStorInvDis.setIostorinvdtl_id(dtl.getIostorinvdtl_id());
ioStorInvDis.setSeq_no((i+1)+"");
ioStorInvDis.setSect_id(ivt.getString("sect_id"));
ioStorInvDis.setPcsn(ivt.getString("pcsn"));
ioStorInvDis.setMaterial_id(dtl.getMaterial_id());
ioStorInvDis.setSect_name(ivt.getString("sect_name"));
ioStorInvDis.setSect_code(ivt.getString("sect_code"));
ioStorInvDis.setStruct_id(ivt.getString("struct_id"));
ioStorInvDis.setStruct_name(ivt.getString("struct_name"));
ioStorInvDis.setStruct_code(ivt.getString("struct_code"));
ioStorInvDis.setStoragevehicle_code(ivt.getString("storagevehicle_code"));
ioStorInvDis.setIs_issued(BaseDataEnum.IS_YES_NOT.code("否"));
ioStorInvDis.setQty_unit_id(dtl.getQty_unit_id());
ioStorInvDis.setQty_unit_name(dtl.getQty_unit_name());
ioStorInvDis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("生成"));
// 未分配数量 - 该库位上的可用数量 < 0 目前做整出
// double canuse_qty = outAllocation.getCanuse_qty().doubleValue();
// if (unassign_qty-canuse_qty>=0){
// ioStorInvDis.setPlan_qty(BigDecimal.valueOf(canuse_qty));
// }else {
// ioStorInvDis.setPlan_qty(BigDecimal.valueOf(unassign_qty));
// }
// unassign_qty = unassign_qty-canuse_qty;
// if (unassign_qty<0){
// unassign_qty=0;
// }
if (unassign_qty <= 0){
throw new BadRequestException("已全部分配完,未分配数量为0");
}
unassign_qty = unassign_qty-canuse_qty;
if (unassign_qty<0){
unassign_qty=0;
}
allocation_canuse_qty = allocation_canuse_qty + canuse_qty;
ioStorInvDis.setPlan_qty(BigDecimal.valueOf(canuse_qty));
//锁定货位
JSONObject lock_map = new JSONObject();
lock_map.put("struct_code", ivt.getString("struct_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", ivt.getString("storagevehicle_code"));
jsonIvt.put("material_id", dtl.getMaterial_id());
jsonIvt.put("pcsn", ivt.getString("pcsn"));
jsonIvt.put("qty_unit_id", dtl.getQty_unit_id());
jsonIvt.put("qty_unit_name", dtl.getQty_unit_name());
jsonIvt.put("change_qty", ioStorInvDis.getPlan_qty());
updateIvtList.add(jsonIvt);
iMdPbStoragevehicleextService.updateIvt(updateIvtList);
}
//更新详情
dtl.setBill_status(unassign_qty==0 ? IOSEnum.BILL_STATUS.code("分配完"): IOSEnum.BILL_STATUS.code("分配中"));
double assign_qty = allocation_canuse_qty + 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
public void oneCancel(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)
.eq(IOStorInvDis::getIostorinvdis_id,whereJson.getString("iostorinvdis_id"))
);
if (ObjectUtil.isEmpty(ioStorInvDisList)){
throw new BadRequestException("不存在可取消的出库分配明细");
}
for (IOStorInvDis ioStorInvDis:ioStorInvDisList){
//更新库存 减冻结加可用
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);
//更新出库明细单状态
IOStorInvDtl ioStorInvDtl = ioStorInvDtlMapper.selectById(whereJson.getString("iostorinvdtl_id"));
//取消分配计算 已分配 = 已分配 - 分配详情计划数量
// 未分配 = 计划分配 - 已分配
double assign_qty = ioStorInvDtl.getAssign_qty().doubleValue()-ioStorInvDis.getPlan_qty().doubleValue();
double unassign_qty = ioStorInvDtl.getUnassign_qty().doubleValue() + (ioStorInvDtl.getPlan_qty().doubleValue()-assign_qty);
ioStorInvDtl.setAssign_qty(BigDecimal.valueOf(assign_qty));
ioStorInvDtl.setUnassign_qty(BigDecimal.valueOf(unassign_qty));
ioStorInvDtl.setBill_status(IOSEnum.BILL_STATUS.code("生成"));
ioStorInvDtlMapper.updateById(ioStorInvDtl);
//删除出入库单分配表
ioStorInvDisMapper.deleteById(ioStorInvDis.getIostorinvdis_id());
}
//更新主表
//根据单据标识判断明细是否都已经分配完成
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);
}
@Override
public void allSetPoint(JSONObject whereJson) {
//出库点
String point_code = whereJson.getString("point_code");
if (StrUtil.isBlank(point_code)){
throw new BadRequestException("未选择出库点");
}
String iostorinv_id = whereJson.getString("iostorinv_id");
//查询主表信息
IOStorInv ioStorInv = ioStorInvMapper.selectById(iostorinv_id);
if (ObjectUtil.isEmpty(ioStorInv)) {
throw new BadRequestException("未查到相关出库单");
}
List<IOStorInvDis> ioStorInvDisList = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDis.class)
.eq(IOStorInvDis::getIostorinv_id,iostorinv_id)
.eq(IOStorInvDis::getIs_issued,BaseDataEnum.IS_YES_NOT.code("否"))
.and(wrapper -> wrapper.isNotNull(IOStorInvDis::getStruct_code).ne(IOStorInvDis::getStruct_code,""))
);
if (ObjectUtil.isEmpty(ioStorInvDisList)){
throw new BadRequestException("当前没有可设置的分配明细");
}
for (IOStorInvDis ioStorInvDis:ioStorInvDisList){
//创建任务
JSONObject task_form = new JSONObject();
task_form.put("task_type", "STInTask");
task_form.put("TaskCode",CodeUtil.getNewCode("TASK_CODE"));
task_form.put("PickingLocation", point_code);
task_form.put("PlacedLocation", ioStorInvDis.getStruct_code());
task_form.put("vehicle_code", ioStorInvDis.getStoragevehicle_code());
StInTask stInTask = SpringContextHolder.getBean("STInTask");
String task_id = stInTask.create(task_form);
//分配明细表更新任务相关数据
IOStorInvDis dis = new IOStorInvDis();
dis.setIostorinvdis_id(ioStorInvDis.getIostorinvdis_id());
dis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("执行中"));
dis.setTask_id(task_id);
dis.setIs_issued(BaseDataEnum.IS_YES_NOT.code("是"));
dis.setPoint_code(point_code);
ioStorInvDisMapper.updateById(dis);
}
}
@Override
public void confirm(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("未查到相关出库单");
}
if (!IOSEnum.BILL_STATUS.code("分配完").equals(ioStorInv.getBill_status())){
throw new BadRequestException("主表状态必须为分配完!");
}
//解锁原货位点位
List<IOStorInvDis> storInvDisList = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDis.class)
.eq(IOStorInvDis::getIostorinv_id,whereJson.get("iostorinv_id"))
);
for (IOStorInvDis ioStorInvDis: storInvDisList){
if (StrUtil.isNotBlank(ioStorInvDis.getStruct_code())){
//解绑仓位
JSONObject finish_map = new JSONObject();
finish_map.put("struct_code",ioStorInvDis.getStruct_code());
finish_map.put("storagevehicle_code",null);
finish_map.put("inv_type", null);
finish_map.put("inv_id", null);
finish_map.put("inv_code", null);
iStructattrService.updateStatusByCode("1",finish_map);
//库存绑定到出库点。
schBasePointMapper.update(new SchBasePoint(),new LambdaUpdateWrapper<>(SchBasePoint.class)
.set(SchBasePoint::getVehicle_code,ioStorInvDis.getStoragevehicle_code())
.set(SchBasePoint::getIos_id,ioStorInvDis.getIostorinvdis_id())
.eq(SchBasePoint::getPoint_code,ioStorInvDis.getPoint_code())
);
//修改库存 减冻结加可用
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);
}
//更新详情数据
ioStorInvDisMapper.update(ioStorInvDis,new LambdaUpdateWrapper<>(IOStorInvDis.class)
.set(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成"))
.set(IOStorInvDis::getReal_qty,ioStorInvDis.getPlan_qty())
.eq(IOStorInvDis::getIostorinvdis_id,ioStorInvDis.getIostorinvdis_id())
.ne(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成"))
);
ioStorInvDtlMapper.update(new IOStorInvDtl(),new LambdaUpdateWrapper<>(IOStorInvDtl.class)
.set(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("完成"))
.set(IOStorInvDtl::getReal_qty,ioStorInvDis.getPlan_qty())
.eq(IOStorInvDtl::getIostorinvdtl_id,ioStorInvDis.getIostorinvdtl_id())
.ne(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("完成"))
);
//更新组盘记录表
groupPlateMapper.update(new GroupPlate(),new LambdaUpdateWrapper<>(GroupPlate.class)
.set(GroupPlate::getStatus,IOSEnum.GROUP_PLATE_STATUS.code("出库"))
.eq(GroupPlate::getPcsn,ioStorInvDis.getPcsn())
.eq(GroupPlate::getMaterial_id,ioStorInvDis.getMaterial_id())
.eq(GroupPlate::getStoragevehicle_code,ioStorInvDis.getStoragevehicle_code())
);
}
//更新主表状态
ioStorInvMapper.update(ioStorInv,new LambdaUpdateWrapper<>(IOStorInv.class)
.set(IOStorInv::getBill_status,IOSEnum.BILL_STATUS.code("完成"))
.set(IOStorInv::getConfirm_optid,currentUserId)
.set(IOStorInv::getConfirm_optname,nickName)
.set(IOStorInv::getConfirm_time,now)
.eq(IOStorInv::getIostorinv_id,whereJson.get("iostorinv_id"))
);
}
}

46
wms/nladmin-ui/src/views/wms/st/outbill/StructIvt.vue

@ -50,9 +50,9 @@
@change="sectQueryChange"
/>
</el-form-item>
<el-form-item label="关键字" prop="remark">
<el-form-item label="货位编码" prop="struct_code">
<el-input
v-model="queryrow.remark"
v-model="queryrow.struct_code"
clearable
style="width: 220px"
size="mini"
@ -61,24 +61,14 @@
class="filter-item"
/>
</el-form-item>
<el-form-item label="sap批次" prop="remark">
<el-input
v-model="queryrow.sap_pcsn"
clearable
style="width: 220px"
size="mini"
placeholder="sap批次"
prefix-icon="el-icon-search"
class="filter-item"
/>
</el-form-item>
<el-form-item label="子卷号" prop="remark">
<el-form-item label="批次号" prop="pcsn">
<el-input
v-model="queryrow.pcsn"
clearable
style="width: 220px"
size="mini"
placeholder="子卷号"
:disabled="queryrow.pcsn!=='' && queryrow.pcsn!==null"
placeholder="批次号"
prefix-icon="el-icon-search"
class="filter-item"
/>
@ -100,18 +90,10 @@
<el-table-column type="index" label="序号" width="50" align="center" />
<el-table-column show-overflow-tooltip prop="sect_name" label="库区" align="center" />
<el-table-column show-overflow-tooltip prop="struct_code" label="仓位" align="center" />
<el-table-column show-overflow-tooltip prop="storagevehicle_code" label="箱号" align="center" width="250px" />
<el-table-column show-overflow-tooltip prop="storagevehicle_code" label="托盘编码" align="center" width="250px" />
<el-table-column show-overflow-tooltip prop="material_name" label="物料名称" align="center" />
<el-table-column show-overflow-tooltip sortable prop="pcsn" label="子卷批次号" align="center" width="150px" />
<el-table-column show-overflow-tooltip sortable prop="sap_pcsn" label="sap批次" align="center" width="140px" />
<el-table-column show-overflow-tooltip sortable prop="pcsn" label="批次号" align="center" width="150px" />
<el-table-column show-overflow-tooltip prop="canuse_qty" label="可出重量" :formatter="crud.formatNum3" align="center" />
<!-- <el-table-column show-overflow-tooltip prop="plan_qty" label="重量" :formatter="crud.formatNum3" width="160" align="center">-->
<!-- <template scope="scope">-->
<!-- <el-input-number v-show="!scope.row.edit" v-model="scope.row.plan_qty" :precision="3" :max="100000000" />-->
<!-- <span v-show="scope.row.edit">{{ scope.row.plan_qty }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column show-overflow-tooltip prop="qty_unit_name" label="单位" align="center" />-->
<el-table-column align="center" label="操作" width="160" fixed="right">
<template scope="scope">
<el-button v-show="!scope.row.edit" type="primary" class="filter-item" size="mini" icon="el-icon-edit" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
@ -212,20 +194,6 @@ export default {
if (row.edit === undefined) {
this.$set(row, 'edit', false)
}
if (!row.edit) {
/* if (row.plan_qty > this.queryrow.unassign_qty) {
this.crud.notify('出库重量不能超过未分配数', CRUD.NOTIFICATION_TYPE.INFO)
return false
}*/
/* if (row.plan_qty > row.canuse_qty) {
this.crud.notify('出库重量不能超过库存可出重量', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (row.plan_qty === 0) {
this.crud.notify('出库重量为0不能保存', CRUD.NOTIFICATION_TYPE.INFO)
return false
}*/
}
row.edit = !row.edit
if (row.edit) {
this.queryrow.unassign_qty = parseFloat(this.queryrow.unassign_qty) - parseFloat(row.canuse_qty)

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

@ -45,13 +45,6 @@ export function getOutBillDisDtl(params) {
params
})
}
export function getOutBillTask(params) {
return request({
url: '/api/checkoutbill/getOutBillTask',
method: 'get',
params
})
}
export function getInvTypes() {
return request({
url: '/api/checkoutbill/getInvTypes',
@ -100,20 +93,6 @@ export function oneCancel(data) {
data
})
}
export function setPoint(data) {
return request({
url: '/api/checkoutbill/setPoint',
method: 'post',
data
})
}
export function oneSetPoint(data) {
return request({
url: '/api/checkoutbill/oneSetPoint',
method: 'post',
data
})
}
export function getStructIvt(params) {
return request({
url: '/api/checkoutbill/getStructIvt',
@ -253,4 +232,4 @@ export function saveUpdate(data) {
data
})
}
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 }
export default { add, edit, del, allDiv, allCancel, getOutBillDtl, getOutBillDis, autoCancel, getStructIvt, manualDiv, confirm, issueTask, finishTask, cancleTaskfinish, getInvTypes, paramByCodeType, schAreaType, backConfirm, getOutBillDisDtl, getType, allDivOne, moneySubmit, getDisNum, queryBox, getOutBillTask2, oneCancel, cancelTask, allSetPoint, oneSetPoint2, outReturn, excelImport, saveUpdate }

Loading…
Cancel
Save