|
@ -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,12 +270,219 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i |
|
|
throw new BadRequestException("查不到出库单信息"); |
|
|
throw new BadRequestException("查不到出库单信息"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
String bill_type = ioStorInv.getBill_type(); |
|
|
//查询生成和未分配完的明细
|
|
|
|
|
|
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); |
|
|
|
|
|
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)) { |
|
|
|
|
|
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){ |
|
|
|
|
|
throw new BadRequestException("物料编号:"+ dtl.getMaterial_code() +"出库分配数量不满足"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
* 分配规则: |
|
|
|
|
|
* 1.按批次先进先出 |
|
|
|
|
|
* 2.相同批次载具量小优先 |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
//出库分配查询货位信息
|
|
|
|
|
|
List<MdPbStoragevehicleextDto> outAllocationList = mdPbStoragevehicleextMapper.queryOutAllocation(pcsn,material_id); |
|
|
|
|
|
|
|
|
|
|
|
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; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//更新详情
|
|
|
|
|
|
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(); |
|
|
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")); |
|
|
queryDtl.put("iostorinvdtl_id", whereJson.getString("iostorinvdtl_id")); |
|
|
List<IOStorInvDtlDto> dtls = ioStorInvMapper.getIODtl(queryDtl); |
|
|
List<IOStorInvDtlDto> dtls = ioStorInvMapper.getIODtl(queryDtl); |
|
@ -272,228 +494,186 @@ 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.相同批次载具量小优先 |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
//出库分配查询货位信息
|
|
|
|
|
|
List<MdPbStoragevehicleextDto> outAllocationList = mdPbStoragevehicleextMapper.queryOutAllocation(pcsn,material_id); |
|
|
|
|
|
|
|
|
|
|
|
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; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (StrUtil.isBlank(pcsn)) { |
|
|
//更新详情
|
|
|
throw new BadRequestException("出库明细存在批次号为空"); |
|
|
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); |
|
|
} |
|
|
} |
|
|
// 根据批次号查询库存可用
|
|
|
|
|
|
BigDecimal canuseSum = mdPbStoragevehicleextMapper.queryCanuseSumByPcsn(pcsn); |
|
|
|
|
|
|
|
|
|
|
|
if (canuseSum.doubleValue()<unassign_qty){ |
|
|
//更新主表
|
|
|
throw new BadRequestException("出库分配数量不满足"); |
|
|
//根据单据标识判断明细是否都已经分配完成
|
|
|
|
|
|
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); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// boolean is_top3 = false;
|
|
|
@Override |
|
|
// if (ObjectUtil.isEmpty(dtl.getString("source_bill_code")) && ObjectUtil.isEmpty(dtl.getString("pcsn"))) {
|
|
|
public void autoCancel(JSONObject whereJson) { |
|
|
// is_top3 = true;
|
|
|
String currentUserId = SecurityUtils.getCurrentUserId(); |
|
|
// }
|
|
|
String nickName = SecurityUtils.getCurrentNickName(); |
|
|
// JSONObject jsonMap = new JSONObject();
|
|
|
String now = DateUtil.now(); |
|
|
// // 已分配重量
|
|
|
|
|
|
// double assign_qty = dtl.getDoubleValue("assign_qty");
|
|
|
String iostorinv_id = whereJson.getString("iostorinv_id"); |
|
|
//
|
|
|
|
|
|
// if (ObjectUtil.isNotEmpty(dtl.getString("source_bill_code")) || is_top3) {
|
|
|
List<IOStorInvDis> ioStorInvDisList = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDis.class) |
|
|
// while (unassign_qty > 0) {
|
|
|
.le(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("生成")) |
|
|
// // 1.有销售订单号
|
|
|
.eq(IOStorInvDis::getIs_issued,BaseDataEnum.IS_YES_NOT.code("否")) |
|
|
// jsonMap.put("flag", "1");
|
|
|
.eq(IOStorInvDis::getIostorinv_id,iostorinv_id) |
|
|
// jsonMap.put("material_id", dtl.getString("material_id"));
|
|
|
.eq(IOStorInvDis::getIostorinvdtl_id,whereJson.getString("iostorinvdtl_id")) |
|
|
// jsonMap.put("sale_order_name", dtl.getString("source_bill_code"));
|
|
|
); |
|
|
// jsonMap.put("sect_id", whereJson.getString("sect_id"));
|
|
|
if (ObjectUtil.isEmpty(ioStorInvDisList)){ |
|
|
// jsonMap.put("stor_id", whereJson.getString("stor_id"));
|
|
|
throw new BadRequestException("不存在可取消的出库分配明细"); |
|
|
//
|
|
|
} |
|
|
// JSONObject jsonOneIvt = WQL.getWO("ST_OUTIVT01").addParamMap(jsonMap).process().uniqueResult(0);
|
|
|
//需要更新的出入库单明细
|
|
|
// if (ObjectUtil.isEmpty(jsonOneIvt)) {
|
|
|
Set<String> dtlSet = new HashSet<>(); |
|
|
// throw new BadRequestException("库存不足");
|
|
|
|
|
|
// }
|
|
|
for (IOStorInvDis ioStorInvDis:ioStorInvDisList){ |
|
|
//
|
|
|
|
|
|
// // 查询这一巷道所有此物料此库存此销售订单的库存
|
|
|
//添加需要更新的明细标识
|
|
|
// jsonMap.put("flag", "2");
|
|
|
dtlSet.add(ioStorInvDis.getIostorinvdtl_id()); |
|
|
// jsonMap.put("row_num", jsonOneIvt.getString("row_num"));
|
|
|
|
|
|
// jsonMap.put("block_num", jsonOneIvt.getString("block_num"));
|
|
|
//更新库存 减冻结加可用
|
|
|
// JSONArray ivtAllArr = WQL.getWO("ST_OUTIVT01").addParamMap(jsonMap).process().getResultJSONArray(0);
|
|
|
List<JSONObject> updateIvtList = new ArrayList<>(); |
|
|
//
|
|
|
JSONObject jsonIvt = new JSONObject(); |
|
|
// for (int j = 0; j < ivtAllArr.size(); j++) {
|
|
|
jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_SUB_FROZEN_ADD_CANUSE); |
|
|
// JSONObject ivt = ivtAllArr.getJSONObject(j);
|
|
|
jsonIvt.put("storagevehicle_code", ioStorInvDis.getStoragevehicle_code()); |
|
|
// double canuse_qty = ivt.getDoubleValue("canuse_qty");
|
|
|
jsonIvt.put("material_id", ioStorInvDis.getMaterial_id()); |
|
|
// assign_qty = NumberUtil.add(assign_qty, canuse_qty);
|
|
|
jsonIvt.put("pcsn", ioStorInvDis.getPcsn()); |
|
|
//
|
|
|
jsonIvt.put("qty_unit_id", ioStorInvDis.getQty_unit_id()); |
|
|
// if (unassign_qty >= canuse_qty) {
|
|
|
jsonIvt.put("qty_unit_name", ioStorInvDis.getQty_unit_name()); |
|
|
// unassign_qty = NumberUtil.sub(unassign_qty, canuse_qty);
|
|
|
jsonIvt.put("change_qty", ioStorInvDis.getPlan_qty()); |
|
|
// } else {
|
|
|
updateIvtList.add(jsonIvt); |
|
|
// unassign_qty = 0;
|
|
|
iMdPbStoragevehicleextService.updateIvt(updateIvtList); |
|
|
// }
|
|
|
|
|
|
//
|
|
|
//解锁库位
|
|
|
// // 查询此木箱下的所有子卷
|
|
|
JSONObject unlock_map = new JSONObject(); |
|
|
// jsonMap.put("flag", "3");
|
|
|
unlock_map.put("struct_code", ioStorInvDis.getStruct_code()); |
|
|
// jsonMap.put("storagevehicle_code", ivt.getString("storagevehicle_code"));
|
|
|
unlock_map.put("inv_type", null); |
|
|
// JSONArray ivtAllArr2 = WQL.getWO("ST_OUTIVT01").addParamMap(jsonMap).process().getResultJSONArray(0);
|
|
|
unlock_map.put("inv_id", null); |
|
|
//
|
|
|
unlock_map.put("inv_code", null); |
|
|
// for (int k = 0; k < ivtAllArr2.size(); k++) {
|
|
|
iStructattrService.updateStatusByCode("2",unlock_map); |
|
|
// // 更新库存
|
|
|
|
|
|
// JSONObject ivt2 = ivtAllArr2.getJSONObject(k);
|
|
|
//删除出入库单分配表
|
|
|
// ivt2.put("change_qty", ivt2.getDoubleValue("canuse_qty"));
|
|
|
ioStorInvDisMapper.deleteById(ioStorInvDis.getIostorinvdis_id()); |
|
|
// ivt2.put("bill_type_scode", jo_mst.getString("bill_type"));
|
|
|
|
|
|
// ivt2.put("inv_id", dtl.getString("iostorinv_id"));
|
|
|
|
|
|
// ivt2.put("bill_code", jo_mst.getString("bill_code"));
|
|
|
|
|
|
// ivt2.put("bill_table", "ST_IVT_IOStorInv");
|
|
|
|
|
|
// storPublicService.IOStor(ivt2, "11");
|
|
|
|
|
|
//
|
|
|
|
|
|
// //生成分配明细
|
|
|
|
|
|
// dtl.put("iostorinvdis_id", cn.hutool.core.util.IdUtil.getSnowflake(1, 1).nextId());
|
|
|
|
|
|
// dtl.put("sect_id", ivt2.getString("sect_id"));
|
|
|
|
|
|
// dtl.put("sect_code", ivt2.getString("sect_code"));
|
|
|
|
|
|
// dtl.put("sect_name", ivt2.getString("sect_name"));
|
|
|
|
|
|
// dtl.put("struct_id", ivt2.getString("struct_id"));
|
|
|
|
|
|
// dtl.put("struct_code", ivt2.getString("struct_code"));
|
|
|
|
|
|
// dtl.put("struct_name", ivt2.getString("struct_name"));
|
|
|
|
|
|
// dtl.put("pcsn", ivt2.getString("pcsn"));
|
|
|
|
|
|
// dtl.put("box_no", ivt2.getString("storagevehicle_code"));
|
|
|
|
|
|
// dtl.put("storagevehicle_id", ivt2.getString("storagevehicle_id"));
|
|
|
|
|
|
// dtl.put("storagevehicle_code", ivt2.getString("storagevehicle_code"));
|
|
|
|
|
|
// 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.put("instorage_time", ivt2.getString("instorage_time"));
|
|
|
|
|
|
//
|
|
|
|
|
|
// // 如果所属仓位是虚拟区 则将分配明细状态变为生成
|
|
|
|
|
|
// JSONObject jsonSect = wo_sect.query("sect_id = '" + ivt2.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 (ivt2.getString("is_overdue").equals("1")) {
|
|
|
|
|
|
// dtl.put("work_status", "01");
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// wo_dis.insert(dtl);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// //记录需锁定的仓位
|
|
|
|
|
|
// Struct_map.put(ivt.getString("struct_id"), ivt);
|
|
|
|
|
|
// // 为零结束
|
|
|
|
|
|
// if (unassign_qty == 0) {
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// // 确定子卷: 根据子卷找到库存出掉
|
|
|
|
|
|
// jsonMap.put("flag", "1");
|
|
|
|
|
|
// jsonMap.put("material_id", dtl.getString("material_id"));
|
|
|
|
|
|
// jsonMap.put("pcsn", dtl.getString("pcsn"));
|
|
|
|
|
|
// jsonMap.put("box_no", dtl.getString("box_no"));
|
|
|
|
|
|
// jsonMap.put("sect_id", whereJson.getString("sect_id"));
|
|
|
|
|
|
// jsonMap.put("stor_id", whereJson.getString("stor_id"));
|
|
|
|
|
|
//
|
|
|
|
|
|
// JSONObject jsonIvt = WQL.getWO("ST_OUTIVT01").addParamMap(jsonMap).process().uniqueResult(0);
|
|
|
|
|
|
// if (ObjectUtil.isEmpty(jsonIvt)) {
|
|
|
|
|
|
// 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);
|
|
|
|
|
|
// }
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//更新出库明细单状态
|
|
|
|
|
|
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); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|