opt:出库完成相关逻辑修改。
This commit is contained in:
@@ -44,7 +44,7 @@
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="is_lock != null and is_lock != ''">
|
||||
and ivt.lock_type = '00'
|
||||
and ivt.lock_type = '0'
|
||||
and gro.frozen_qty = 0
|
||||
</if>
|
||||
<if test="order_by != null and order_by != ''">
|
||||
|
||||
@@ -145,13 +145,15 @@ public class MdMeMaterialbaseServiceImpl extends ServiceImpl<MdMeMaterialbaseMap
|
||||
}
|
||||
|
||||
@Override
|
||||
public MdMeMaterialbase getByCode(String material_code) {
|
||||
public MdMeMaterialbase getByCode(String materialCode) {
|
||||
MdMeMaterialbase one = this.getOne(
|
||||
new QueryWrapper<MdMeMaterialbase>().lambda()
|
||||
.eq(MdMeMaterialbase::getMaterial_code, material_code)
|
||||
);
|
||||
new QueryWrapper<MdMeMaterialbase>().lambda().nested(r -> {
|
||||
r.eq(MdMeMaterialbase::getMaterial_id, materialCode)
|
||||
.or()
|
||||
.eq(MdMeMaterialbase::getMaterial_code, materialCode);
|
||||
}));
|
||||
if (ObjectUtil.isEmpty(one)) {
|
||||
throw new BadRequestException("物料编码为【"+material_code+"】不存在!");
|
||||
throw new BadRequestException("物料信息为【" + materialCode + "】不存在!");
|
||||
}
|
||||
return one;
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
||||
// 数量
|
||||
String qty = whereJson.getString("qty");
|
||||
MdPbStoragevehicleinfo vehicleDao = iMdPbStoragevehicleinfoService.getByCode(whereJson.getString("vehicle_code"));
|
||||
MdMeMaterialbase materDao = iMdMeMaterialbaseService.getById(materialId);
|
||||
MdMeMaterialbase materDao = iMdMeMaterialbaseService.getByCode(materialId);
|
||||
MdPbMeasureunit unitDao = iMdPbMeasureunitService.getById(materDao.getBase_unit_id());
|
||||
// 校验
|
||||
if (ObjectUtil.isEmpty(vehicleDao) || ObjectUtil.isEmpty(materDao) || ObjectUtil.isEmpty(materDao)) {
|
||||
@@ -376,6 +376,8 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
||||
} else {
|
||||
//空载具入库
|
||||
whereJson.put("qty", 1);
|
||||
String materialCode = "1".equals(whereJson.getString("material_id")) ? StatusEnum.VEHICLE_TYPE.code("空托盘") : StatusEnum.VEHICLE_TYPE.code("空料箱");
|
||||
whereJson.put("material_id", materialCode);
|
||||
//组盘
|
||||
groupPlate(whereJson);
|
||||
// 生成空载具入库任务
|
||||
|
||||
@@ -187,7 +187,7 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
//创建出库单/明细/分配
|
||||
GroupPlate plateDao = mdPbGroupplateMapper.selectOne(
|
||||
new LambdaQueryWrapper<GroupPlate>()
|
||||
.eq(GroupPlate::getStoragevehicle_code, whereJson.getString("group_id")));
|
||||
.eq(GroupPlate::getGroup_id, whereJson.getString("group_id")));
|
||||
Structattr sectDao = iStructattrService.getOne(new LambdaQueryWrapper<Structattr>()
|
||||
.eq(Structattr::getStruct_code, whereJson.getString("struct_code")));
|
||||
MdMeMaterialbase materDao = iMdMeMaterialbaseService.getById(plateDao.getMaterial_id());
|
||||
@@ -224,7 +224,7 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
);
|
||||
//更新组盘记录表
|
||||
mdPbGroupplateMapper.update(new GroupPlate(), new LambdaUpdateWrapper<>(GroupPlate.class)
|
||||
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库"))
|
||||
.set(GroupPlate::getFrozen_qty, plateDao.getQty())
|
||||
.eq(GroupPlate::getGroup_id, whereJson.getString("group_id"))
|
||||
);
|
||||
return PdaResponse.requestOk();
|
||||
@@ -240,19 +240,24 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
@Transactional
|
||||
public PdaResponse vehicleOutConfirm(JSONObject whereJson) {
|
||||
long qty = 1L;
|
||||
LambdaQueryWrapper<MdMeMaterialbase> queryWrapper = new LambdaQueryWrapper<>();
|
||||
//空料箱出库
|
||||
if (StringUtils.isNotBlank(whereJson.getString("qty"))) {
|
||||
qty = whereJson.getLongValue("qty");
|
||||
if (qty > 6) {
|
||||
throw new BadRequestException("请输入小于7以内的载具数量");
|
||||
throw new BadRequestException("一次性只能输入小于7以内的载具数量");
|
||||
}
|
||||
whereJson.put("material_id", "2");
|
||||
whereJson.put("material_code", "2");
|
||||
queryWrapper.eq(MdMeMaterialbase::getMaterial_id, StatusEnum.VEHICLE_TYPE.code("空料箱"));
|
||||
} else {
|
||||
//空托盘出库
|
||||
whereJson.put("material_id", "1");
|
||||
whereJson.put("material_code", "1");
|
||||
queryWrapper.eq(MdMeMaterialbase::getMaterial_id, StatusEnum.VEHICLE_TYPE.code("空托盘"));
|
||||
|
||||
}
|
||||
MdMeMaterialbase materDao = iMdMeMaterialbaseService.getOne(queryWrapper);
|
||||
if (materDao == null) {
|
||||
throw new BadRequestException("未找到空载具物料信息!");
|
||||
}
|
||||
whereJson.put("material_id", materDao.getMaterial_id());
|
||||
whereJson.put("material_code", materDao.getMaterial_code());
|
||||
Sectattr sectattr = iSectattrService.getById(new LambdaQueryWrapper<>(Sectattr.class)
|
||||
.eq(Sectattr::getSect_id, whereJson.getString("sect_id"))
|
||||
.eq(Sectattr::getIs_used, BaseDataEnum.IS_YES_NOT.code("是"))
|
||||
@@ -284,9 +289,9 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
taskForm.put("PickingLocation", r.getStruct_code());
|
||||
taskForm.put("PlacedLocation", whereJson.getString("siteCode"));
|
||||
taskForm.put("vehicle_code", r.getStoragevehicle_code());
|
||||
VehicleOutTask VehicleOutTask = SpringContextHolder.getBean("VehicleOutTask");
|
||||
VehicleOutTask vehicleOutTask = SpringContextHolder.getBean("VehicleOutTask");
|
||||
applyTaskMap.get(IOSConstant.VEHICLE_IN_TASK).create(whereJson);
|
||||
VehicleOutTask.create(taskForm);
|
||||
vehicleOutTask.create(taskForm);
|
||||
});
|
||||
//更新组盘记录表
|
||||
Set<String> vehicleCodeSet = structList.stream()
|
||||
@@ -419,9 +424,16 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 1.库存载具绑定到出库点位
|
||||
* 2.更新组盘记录为出库
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public PdaResponse outStorageConfirm(JSONObject whereJson) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
//获取终点
|
||||
SchBasePoint pointDao = iSchBasePointService.getOne(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getVehicle_code, whereJson.getString("storagevehicle_code")));
|
||||
if (ObjectUtil.isEmpty(pointDao)) {
|
||||
@@ -431,16 +443,26 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
//更新组盘信息
|
||||
LambdaUpdateWrapper<GroupPlate> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
//出库确认
|
||||
if ("1" .equals(whereJson.getString("type"))) {
|
||||
if ("1".equals(whereJson.getString("type"))) {
|
||||
BigDecimal qty = groupPlate.getQty().subtract(groupPlate.getFrozen_qty()).abs();
|
||||
updateWrapper.set(GroupPlate::getQty, qty).set(GroupPlate::getFrozen_qty, 0);
|
||||
} else {
|
||||
//强制确认
|
||||
updateWrapper.set(GroupPlate::getQty, 0).set(GroupPlate::getFrozen_qty, 0);
|
||||
}
|
||||
updateWrapper.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库")).eq(GroupPlate::getGroup_id, whereJson.getString("group_id"));
|
||||
// 释放点位
|
||||
// iSchBasePointService.unLockPoint(pointDao.getPoint_code());
|
||||
updateWrapper.set(GroupPlate::getUpdate_optid, currentUserId + "")
|
||||
.set(GroupPlate::getUpdate_optname, nickName)
|
||||
.set(GroupPlate::getUpdate_time, now)
|
||||
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库"))
|
||||
.eq(GroupPlate::getGroup_id, whereJson.getString("group_id"));
|
||||
//更新组盘记录表
|
||||
mdPbGroupplateMapper.update(new GroupPlate(), updateWrapper);
|
||||
//库存绑定到出库点。
|
||||
iSchBasePointService.update(new SchBasePoint(), new LambdaUpdateWrapper<>(SchBasePoint.class)
|
||||
.set(SchBasePoint::getVehicle_code, groupPlate.getStoragevehicle_code())
|
||||
.set(SchBasePoint::getIos_id, BaseDataEnum.IS_YES_NOT.code("是"))
|
||||
.eq(SchBasePoint::getPoint_code, pointDao.getPoint_code())
|
||||
);
|
||||
return PdaResponse.requestOk();
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,11 @@ public enum StatusEnum {
|
||||
)),
|
||||
BIND_TYPE(ForkMap.of(
|
||||
"解绑", "0", null, "绑定", "1", null, "不操作", "3", null
|
||||
)),
|
||||
VEHICLE_TYPE(ForkMap.of(
|
||||
"空托盘", "KT001", null, "空料箱", "KL001", null
|
||||
));
|
||||
|
||||
/**
|
||||
* L:label
|
||||
* M:编码
|
||||
|
||||
@@ -67,7 +67,6 @@ public enum IOSEnum {
|
||||
|
||||
// 盘点明细状态
|
||||
CHECK_DTL_STATUS(MapOf.of("生成", "10", "盘点中", "20", "已盘点", "30", "完成", "99")),
|
||||
|
||||
;
|
||||
|
||||
private Map<String, String> code;
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.warehouse_management.service.dao.GroupPlate;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -32,4 +33,19 @@ public interface IMdPbGroupplateService extends IService<GroupPlate> {
|
||||
* @param ids 标识集合
|
||||
*/
|
||||
void delete(Set<String> ids);
|
||||
|
||||
/**
|
||||
* 更新库存以及仓位状态
|
||||
* @param updateIvtList :{
|
||||
* type: 更新类型
|
||||
* storagevehicle_code: 载具编码
|
||||
* material_id: 物料标识
|
||||
* pcsn: 批次
|
||||
* qty_unit_id: 计量单位标识
|
||||
* qty_unit_name: 计量单位名称
|
||||
* change_qty: 变动数量
|
||||
* remark: 备注
|
||||
* }
|
||||
*/
|
||||
void updateIvt(List<JSONObject> updateIvtList);
|
||||
}
|
||||
|
||||
@@ -88,6 +88,21 @@ public class GroupPlate implements Serializable {
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String update_optid;
|
||||
|
||||
/**
|
||||
* 修改人姓名
|
||||
*/
|
||||
private String update_optname;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
/**
|
||||
* 来源单据号
|
||||
*/
|
||||
|
||||
@@ -8,9 +8,12 @@ import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.warehouse_management.service.IMdPbGroupplateService;
|
||||
import org.nl.wms.warehouse_management.service.dao.GroupPlate;
|
||||
import org.nl.wms.warehouse_management.service.dao.mapper.MdPbGroupplateMapper;
|
||||
import org.nl.wms.warehouse_management.service.util.UpdateIvtUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -24,6 +27,11 @@ import java.util.Set;
|
||||
*/
|
||||
@Service
|
||||
public class MdPbGroupplateServiceImpl extends ServiceImpl<MdPbGroupplateMapper, GroupPlate> implements IMdPbGroupplateService {
|
||||
/**
|
||||
* 更新库存工具类
|
||||
*/
|
||||
@Autowired
|
||||
private UpdateIvtUtils updateIvtUtils;
|
||||
|
||||
@Override
|
||||
public IPage<JSONObject> queryAll(Map whereJson, PageQuery page) {
|
||||
@@ -36,4 +44,25 @@ public class MdPbGroupplateServiceImpl extends ServiceImpl<MdPbGroupplateMapper,
|
||||
public void delete(Set<String> ids) {
|
||||
this.baseMapper.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新库存以及仓位状态
|
||||
* @param updateIvtList :{
|
||||
* type: 更新类型
|
||||
* storagevehicle_code: 载具编码
|
||||
* material_id: 物料标识
|
||||
* pcsn: 批次
|
||||
* qty_unit_id: 计量单位标识
|
||||
* qty_unit_name: 计量单位名称
|
||||
* change_qty: 变动数量
|
||||
* remark: 备注
|
||||
* }
|
||||
*/
|
||||
@Override
|
||||
public void updateIvt(List<JSONObject> updateIvtList) {
|
||||
for (JSONObject json : updateIvtList) {
|
||||
updateIvtUtils.updateIvt(json);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package org.nl.wms.warehouse_management.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
@@ -24,8 +23,6 @@ import org.nl.wms.basedata_manage.service.IBsrealStorattrService;
|
||||
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.MdPbStoragevehicleext;
|
||||
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||
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.enums.TaskStatus;
|
||||
@@ -33,10 +30,10 @@ import org.nl.wms.sch_manage.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch_manage.service.dao.mapper.SchBasePointMapper;
|
||||
import org.nl.wms.sch_manage.service.util.tasks.StInTask;
|
||||
import org.nl.wms.sch_manage.service.util.tasks.StOutTask;
|
||||
import org.nl.wms.warehouse_management.enums.IOSConstant;
|
||||
import org.nl.wms.warehouse_management.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_management.service.IMdPbGroupplateService;
|
||||
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;
|
||||
@@ -99,10 +96,12 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
private IOStorInvDtlMapper ioStorInvDtlMapper;
|
||||
|
||||
|
||||
|
||||
@Resource
|
||||
private SchBasePointMapper schBasePointMapper;
|
||||
|
||||
@Resource
|
||||
private IMdPbGroupplateService iMdPbGroupPlateService;
|
||||
|
||||
|
||||
@Override
|
||||
public IPage<IOStorInv> pageQuery(Map whereJson, PageQuery page, String[] stor_id, String[] bill_status, String[] bill_type) {
|
||||
@@ -934,7 +933,6 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
}
|
||||
|
||||
for (IOStorInvDis ioStorInvDis:ioStorInvDisList){
|
||||
|
||||
//更新库存 减冻结加可用
|
||||
List<JSONObject> updateIvtList = new ArrayList<>();
|
||||
JSONObject jsonIvt = new JSONObject();
|
||||
@@ -1145,21 +1143,21 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
}
|
||||
|
||||
//更新出库明细单状态
|
||||
for (String dtlId:dtlSet){
|
||||
ioStorInvDtlMapper.update(new IOStorInvDtl(),new LambdaUpdateWrapper<>(IOStorInvDtl.class)
|
||||
.set(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("完成"))
|
||||
.set(IOStorInvDtl::getReal_qty,BigDecimal.ZERO)
|
||||
.eq(IOStorInvDtl::getIostorinvdtl_id,dtlId)
|
||||
for (String dtlId : dtlSet) {
|
||||
ioStorInvDtlMapper.update(new IOStorInvDtl(), new LambdaUpdateWrapper<>(IOStorInvDtl.class)
|
||||
.set(IOStorInvDtl::getBill_status, IOSEnum.BILL_STATUS.code("完成"))
|
||||
.set(IOStorInvDtl::getReal_qty, BigDecimal.ZERO)
|
||||
.eq(IOStorInvDtl::getIostorinvdtl_id, dtlId)
|
||||
);
|
||||
}
|
||||
|
||||
//更新主表状态
|
||||
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"))
|
||||
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"))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1169,27 +1167,31 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
return ioStorInvDisMapper.getBillTaskDtl(iostorinvdtl_id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 任务完成,减库存
|
||||
* 1.解锁库位
|
||||
* 2.修改库存
|
||||
* 3.完成当前分配明细
|
||||
* 4.更新所有出库单明细及主表
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void taskFinish(SchBaseTask task) {
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
IOStorInvDis ioStorInvDis = ioStorInvDisMapper.selectOne(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getTask_id,task.getTask_id())
|
||||
.eq(IOStorInvDis::getTask_id, task.getTask_id())
|
||||
);
|
||||
if (ObjectUtil.isEmpty(ioStorInvDis)){
|
||||
if (ObjectUtil.isEmpty(ioStorInvDis)) {
|
||||
throw new BadRequestException("未找到任务对应的分配明细");
|
||||
}
|
||||
|
||||
// 完成当前分配明细
|
||||
ioStorInvDisMapper.update(ioStorInvDis,new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
||||
.set(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
||||
.eq(IOStorInvDis::getIostorinvdis_id,ioStorInvDis.getIostorinvdis_id())
|
||||
);
|
||||
|
||||
//解锁库位
|
||||
JSONObject finish_map = new JSONObject();
|
||||
finish_map.put("struct_code",ioStorInvDis.getStruct_code());
|
||||
@@ -1198,7 +1200,6 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
finish_map.put("inv_id", null);
|
||||
finish_map.put("inv_code", null);
|
||||
iStructattrService.updateStatusByCode("1",finish_map);
|
||||
|
||||
//修改库存 恢复库存 手持进行减扣
|
||||
List<JSONObject> updateIvtList = new ArrayList<>();
|
||||
JSONObject jsonIvt = new JSONObject();
|
||||
@@ -1210,29 +1211,12 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
jsonIvt.put("qty_unit_name", ioStorInvDis.getQty_unit_name());
|
||||
jsonIvt.put("change_qty", ioStorInvDis.getPlan_qty());
|
||||
updateIvtList.add(jsonIvt);
|
||||
iMdPbStoragevehicleextService.updateIvt(updateIvtList);
|
||||
|
||||
//库存绑定到出库点。
|
||||
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())
|
||||
);
|
||||
|
||||
//更新组盘记录表
|
||||
mdPbGroupplateMapper.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())
|
||||
);
|
||||
|
||||
iMdPbGroupPlateService.updateIvt(updateIvtList);
|
||||
// 查询该明细下是否还有未完成的分配明细
|
||||
int countDis = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getIostorinvdtl_id,ioStorInvDis.getIostorinvdtl_id())
|
||||
.ne(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
||||
);
|
||||
|
||||
// 明细
|
||||
IOStorInvDtl ioStorInvDtl = ioStorInvDtlMapper.selectById(ioStorInvDis.getIostorinvdtl_id());
|
||||
if (ObjectUtil.isEmpty(ioStorInvDtl)){
|
||||
@@ -1243,13 +1227,11 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
// 更新明细表状态
|
||||
ioStorInvDtl.setBill_status(IOSEnum.BILL_STATUS.code("完成"));
|
||||
ioStorInvDtlMapper.updateById(ioStorInvDtl);
|
||||
|
||||
// 查看明细是否全部完成
|
||||
int countDtl = ioStorInvDtlMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDtl.class)
|
||||
.eq(IOStorInvDtl::getIostorinv_id,ioStorInvDtl.getIostorinv_id())
|
||||
.ne(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("完成"))
|
||||
);
|
||||
|
||||
// 如果明细全部完成则更新主表状态
|
||||
if (countDtl == 0){
|
||||
//更新主表状态
|
||||
|
||||
@@ -11,6 +11,9 @@ import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleextService;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleext;
|
||||
import org.nl.wms.warehouse_management.enums.IOSConstant;
|
||||
import org.nl.wms.warehouse_management.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_management.service.IMdPbGroupplateService;
|
||||
import org.nl.wms.warehouse_management.service.dao.GroupPlate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -31,6 +34,12 @@ public class UpdateIvtUtils {
|
||||
@Autowired
|
||||
private IMdPbStoragevehicleextService iMdPbStoragevehicleextService;
|
||||
|
||||
/**
|
||||
* 组盘信息服务
|
||||
*/
|
||||
@Autowired
|
||||
private IMdPbGroupplateService iMdPbGroupPlateService;
|
||||
|
||||
/**
|
||||
* 更新库存
|
||||
* @param where: {
|
||||
@@ -206,30 +215,35 @@ public class UpdateIvtUtils {
|
||||
*/
|
||||
private void updateSubFrozenAddIvt(JSONObject where) {
|
||||
// 找当前托盘物料库存
|
||||
MdPbStoragevehicleext extDao = iMdPbStoragevehicleextService.getOne(
|
||||
new QueryWrapper<MdPbStoragevehicleext>().lambda()
|
||||
.eq(MdPbStoragevehicleext::getStoragevehicle_code, where.getString("storagevehicle_code"))
|
||||
.eq(MdPbStoragevehicleext::getMaterial_id, where.getString("material_id"))
|
||||
.eq(MdPbStoragevehicleext::getPcsn, where.getString("pcsn"))
|
||||
// MdPbStoragevehicleext extDao = iMdPbStoragevehicleextService.getOne(
|
||||
// new QueryWrapper<MdPbStoragevehicleext>().lambda()
|
||||
// .eq(MdPbStoragevehicleext::getStoragevehicle_code, where.getString("storagevehicle_code"))
|
||||
// .eq(MdPbStoragevehicleext::getMaterial_id, where.getString("material_id"))
|
||||
// .eq(MdPbStoragevehicleext::getPcsn, where.getString("pcsn"))
|
||||
// );
|
||||
GroupPlate extDao = iMdPbGroupPlateService.getOne(
|
||||
new QueryWrapper<GroupPlate>().lambda()
|
||||
.eq(GroupPlate::getStoragevehicle_code, where.getString("storagevehicle_code"))
|
||||
.eq(GroupPlate::getMaterial_id, where.getString("material_id"))
|
||||
.eq(GroupPlate::getPcsn, where.getString("pcsn")).eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
|
||||
);
|
||||
if (ObjectUtil.isEmpty(extDao)) {
|
||||
throw new BadRequestException("当前载具【"+extDao.getStoragevehicle_code()+"】不存在相关物料批次库存,请检查数据!");
|
||||
throw new BadRequestException("当前载具【" + extDao.getStoragevehicle_code() + "】不存在相关物料批次库存,请检查数据!");
|
||||
}
|
||||
|
||||
// 减冻结
|
||||
double frozen_qty = NumberUtil.sub(extDao.getFrozen_qty(), where.getDoubleValue("change_qty")).doubleValue();
|
||||
if (frozen_qty < 0) {
|
||||
throw new BadRequestException("冻结数不能为负数,请检查变动数量!当前冻结数为【"+extDao.getFrozen_qty()+"】当前变动数为【"+where.getDoubleValue("change_qty")+"】");
|
||||
double qty = NumberUtil.sub(extDao.getQty(), extDao.getFrozen_qty()).doubleValue();
|
||||
if (qty < 0) {
|
||||
throw new BadRequestException("冻结数不能为负数,请检查变动数量!当前冻结数为【" + extDao.getFrozen_qty() + "】当前变动数为【" + where.getDoubleValue("change_qty") + "】");
|
||||
}
|
||||
// 加可用
|
||||
double canuse_qty = NumberUtil.add(extDao.getCanuse_qty(), where.getDoubleValue("change_qty")).doubleValue();
|
||||
extDao.setFrozen_qty(BigDecimal.valueOf(frozen_qty));
|
||||
extDao.setCanuse_qty(BigDecimal.valueOf(canuse_qty));
|
||||
// double canuse_qty = NumberUtil.add(extDao.getCanuse_qty(), where.getDoubleValue("change_qty")).doubleValue();
|
||||
extDao.setFrozen_qty(BigDecimal.ZERO);
|
||||
extDao.setQty(BigDecimal.valueOf(qty));
|
||||
extDao.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
extDao.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
extDao.setUpdate_time(DateUtil.now());
|
||||
extDao.setRemark(where.getString("remark"));
|
||||
iMdPbStoragevehicleextService.updateById(extDao);
|
||||
iMdPbGroupPlateService.updateById(extDao);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user