opt: 部分逻辑

This commit is contained in:
2025-09-11 10:05:05 +08:00
parent 55e721cd3e
commit c17e8e7e10
20 changed files with 422 additions and 263 deletions

View File

@@ -44,6 +44,13 @@
<version>3.0.13</version>
<type>pom</type>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.nl</groupId>-->
<!-- <artifactId>nl-verify-check-sdk</artifactId>-->
<!-- <version>1.0-SNAPSHOT</version>-->
<!-- <scope>system</scope>-->
<!-- <systemPath>${project.basedir}/lib/nl-verify-check-sdk-1.0-SNAPSHOT.jar</systemPath>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>

View File

@@ -648,7 +648,7 @@ public class PdaJBServiceImpl implements PdaJBService {
public PdaResponse jbGetLtInfo(JSONObject param) {
String vehicleCode = param.getString("vehicle_code");
String struct_code = param.getString("struct_code");
List<GroupInfoPdaVo> groups = pdaJBMapper.getGroupInfoByVehicle(vehicleCode, "01");
List<GroupInfoPdaVo> groups = pdaJBMapper.getGroupInfoByVehicle(vehicleCode, "02");
if (groups.size() > 1) {
throw new BadRequestException("组盘信息错误!");
}
@@ -833,9 +833,7 @@ public class PdaJBServiceImpl implements PdaJBService {
}
// 类型转换
ArrayList<LinkedHashMap> tables = new ArrayList<>();
ioStorInvDis.forEach(item -> {
tables.add(JSONObject.parseObject(JSONObject.toJSONString(item), LinkedHashMap.class));
});
ioStorInvDis.forEach(item -> tables.add(JSONObject.parseObject(JSONObject.toJSONString(item), LinkedHashMap.class)));
divObj.put("tableMater", tables);
return divObj;
}

View File

@@ -35,7 +35,8 @@
mg.*,
ss.struct_code,
mm.material_code,
mm.material_name
mm.material_name,
mm.material_spec
FROM
`md_pb_groupplate` mg
LEFT JOIN st_ivt_structattr ss ON ss.storagevehicle_code = mg.storagevehicle_code

View File

@@ -124,6 +124,7 @@ public interface ISchBasePointService extends IService<SchBasePoint> {
pointType, String pointCode, String vehicleIsNull, boolean isFourPoint);
SchBasePoint getNotTaskByRegionAndType(String regionCode, String s);
SchBasePoint getNotTaskByDeviceAndType(String regionCode, String s);
/**
* 获取可用的没任务的点位

View File

@@ -48,4 +48,6 @@ public interface SchBasePointMapper extends BaseMapper<SchBasePoint> {
SchBasePoint getNotTaskByRegionAndType(String regionCode, String type);
List<SchBasePoint> getCanUseCFGJs(SchBasePoint parentPoint, String pointStatus);
SchBasePoint getNotTaskByDeviceAndType(String device, String type);
}

View File

@@ -72,28 +72,21 @@
ORDER BY p.region_code, p.point_code, p.point_type
</select>
<select id="getNotTaskByRegionAndType" resultType="org.nl.wms.sch_manage.service.dao.SchBasePoint">
SELECT
*
FROM
`sch_base_point` p
WHERE
p.point_type = #{type}
AND p.region_code = #{regionCode}
SELECT *
FROM `sch_base_point` p
WHERE p.point_type = #{type}
AND p.region_code = #{regionCode}
AND p.is_used = true
AND 0 = (
SELECT
COUNT(*)
FROM
sch_base_task t
WHERE
t.is_delete = '0'
AND t.task_status <![CDATA[ < ]]> '5'
AND (
t.point_code1 = p.point_code
AND t.point_code2 = p.point_code
AND t.point_code3 = p.point_code
AND t.point_code4 = p.point_code
))
AND 0 = (SELECT COUNT(*)
FROM sch_base_task t
WHERE t.is_delete = '0'
AND t.task_status <![CDATA[ < ]]> '5'
AND (
t.point_code1 = p.point_code
AND t.point_code2 = p.point_code
AND t.point_code3 = p.point_code
AND t.point_code4 = p.point_code
))
</select>
<select id="getCanUseCFGJs" resultType="org.nl.wms.sch_manage.service.dao.SchBasePoint">
SELECT
@@ -119,4 +112,21 @@
OR t.point_code4 = p.point_code
))
</select>
<select id="getNotTaskByDeviceAndType" resultType="org.nl.wms.sch_manage.service.dao.SchBasePoint">
SELECT *
FROM `sch_base_point` p
WHERE p.point_type = #{type}
AND p.parent_point_code = #{device}
AND p.is_used = true
AND 0 = (SELECT COUNT(*)
FROM sch_base_task t
WHERE t.is_delete = '0'
AND t.task_status <![CDATA[ < ]]> '5'
AND (
t.point_code1 = p.point_code
AND t.point_code2 = p.point_code
AND t.point_code3 = p.point_code
AND t.point_code4 = p.point_code
))
</select>
</mapper>

View File

@@ -320,6 +320,10 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
public SchBasePoint getNotTaskByRegionAndType(String regionCode, String type) {
return this.baseMapper.getNotTaskByRegionAndType(regionCode, type);
}
@Override
public SchBasePoint getNotTaskByDeviceAndType(String device, String type) {
return this.baseMapper.getNotTaskByDeviceAndType(device, type);
}
@Override
public List<SchBasePoint> getCanUseCFGJs(SchBasePoint parentPoint, String pointStatus) {

View File

@@ -89,7 +89,7 @@ public abstract class AbstractTask {
(existing, replacement) -> existing
))
.values());
if (distinctRunningTasks.size() < 2) {
if (distinctRunningTasks.size() >= 2) {
return;
}
// 获取一组下发

View File

@@ -74,6 +74,8 @@ public class JbBackAgvTask extends AbstractTask {
task.setGroup_id(json.getString("group_id"));
task.setRequest_param(json.toString());
task.setPriority(priority);
task.setTask_group_id(json.getString("task_group_id"));
task.setTask_group_seq(json.getBigDecimal("task_group_seq"));
task.setCreate_id(SecurityUtils.getCurrentUserId());
task.setCreate_name(SecurityUtils.getCurrentNickName());
task.setCreate_time(DateUtil.now());

View File

@@ -196,19 +196,20 @@ public class JbDownAgvTask extends AbstractTask {
mhcPoint.setVehicle_type(null);
mhcPoint.setUpdate_time(DateUtil.now());
pointService.updateBatchById(Arrays.asList(khgPoint, mhcPoint));
taskObj.setRemark("任务执行完毕");
// 3条任务完成
SchBaseTask task = new SchBaseTask();
task.setTask_status(TaskStatus.FINISHED.getCode());
TaskUtils.setUpdateByType(task, taskFinishedType);
task.setRemark("任务执行完毕");
task.setFinished_type(taskFinishedType.getCode());
taskService.update(task, new LambdaQueryWrapper<SchBaseTask>()
.eq(SchBaseTask::getTask_group_id, taskObj.getTask_group_id()));
// SchBaseTask task = new SchBaseTask();
// task.setTask_status(TaskStatus.FINISHED.getCode());
// TaskUtils.setUpdateByType(task, taskFinishedType);
// task.setRemark("任务执行完毕");
// task.setFinished_type(taskFinishedType.getCode());
// taskService.update(task, new LambdaQueryWrapper<SchBaseTask>()
// .eq(SchBaseTask::getTask_group_id, taskObj.getTask_group_id()));
// 出库完成
inBillService.taskFinish(taskObj);
return;
// return;
}
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
taskService.updateById(taskObj);
}

View File

@@ -33,6 +33,7 @@ import org.nl.wms.warehouse_manage.service.dao.GroupPlate;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.math.BigDecimal;
/**
* 解包上料AGV任务
@@ -66,7 +67,7 @@ public class JbUpAgvTask extends AbstractTask {
SchBaseTask task = new SchBaseTask();
task.setTask_id(IdUtil.getStringId());
task.setTask_code(json.getString("TaskCode"));
task.setTask_status(TaskStatus.CREATE.getCode());
task.setTask_status(TaskStatus.CREATED.getCode());
task.setConfig_code(json.getString("task_type"));
task.setPoint_code1(json.getString("point_code1"));
task.setPoint_code2(json.getString("point_code2"));
@@ -76,7 +77,9 @@ public class JbUpAgvTask extends AbstractTask {
task.setVehicle_code2(json.getString("vehicle_code2"));
task.setGroup_id(json.getString("group_id"));
task.setRequest_param(json.toString());
task.setPriority(json.getString("Priority"));
task.setPriority(ObjectUtil.isNotEmpty(json.getString("Priority")) ? json.getString("Priority") : "1");
task.setTask_group_id(IdUtil.getStringId());
task.setTask_group_seq(BigDecimal.valueOf(1));
task.setCreate_id(SecurityUtils.getCurrentUserId());
task.setCreate_name(SecurityUtils.getCurrentNickName());
task.setCreate_time(DateUtil.now());

View File

@@ -5,7 +5,6 @@ import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@@ -39,19 +38,19 @@ import org.nl.wms.sch_manage.service.util.tasks.jb.JbDownAgvTask;
import org.nl.wms.sch_manage.service.util.tasks.zw.InBillTask;
import org.nl.wms.warehouse_manage.enums.IOSConstant;
import org.nl.wms.warehouse_manage.enums.IOSEnum;
import org.nl.wms.warehouse_manage.service.IMdPbGroupplateService;
import org.nl.wms.warehouse_manage.service.impl.MdPbGroupplateServiceImpl;
import org.nl.wms.warehouse_manage.inAndOut.service.IInBillService;
import org.nl.wms.warehouse_manage.service.dao.GroupPlate;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInv;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInvDis;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInvDtl;
import org.nl.wms.warehouse_manage.service.dto.GroupPlateDto;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvDisMapper;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvDtlMapper;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvMapper;
import org.nl.wms.warehouse_manage.inAndOut.service.dto.IOStorInvDisDto;
import org.nl.wms.warehouse_manage.inAndOut.service.dto.IOStorInvDtlDto;
import org.nl.wms.warehouse_manage.service.IMdPbGroupplateService;
import org.nl.wms.warehouse_manage.service.dao.GroupPlate;
import org.nl.wms.warehouse_manage.service.dto.GroupPlateDto;
import org.nl.wms.warehouse_manage.service.impl.MdPbGroupplateServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
@@ -127,7 +126,7 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
String[] s = pcsn.split(" ");
String pcsn_in = String.join("','", Arrays.asList(s));
map.put("pcsn_in", "('"+pcsn_in+"')");
map.put("pcsn_in", "('" + pcsn_in + "')");
} else {
map.put("pcsn", "%" + pcsn + "%");
}
@@ -142,12 +141,12 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
if (!StrUtil.isEmpty(end_time)) {
map.put("end_time", end_time);
}
return ioStorInvMapper.queryAllByPage(new Page<>(page.getPage()+1, page.getSize()), map);
return ioStorInvMapper.queryAllByPage(new Page<>(page.getPage() + 1, page.getSize()), map);
}
@Override
public IPage<GroupPlateDto> getBillDtl(Map whereJson, PageQuery page) {
return ioStorInvMapper.getGroupPlate(new Page<>(page.getPage()+1,page.getSize()),whereJson);
return ioStorInvMapper.getGroupPlate(new Page<>(page.getPage() + 1, page.getSize()), whereJson);
}
@Override
@@ -190,25 +189,25 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
HashMap<String, Object> row = rows.get(i);
JSONObject ioStorInvDtl = new JSONObject();
ioStorInvDtl.putAll(row);
ioStorInvDtl.put("iostorinvdtl_id",IdUtil.getStringId());
ioStorInvDtl.put("iostorinv_id",iostorinv_id);
ioStorInvDtl.put("seq_no",(i + 1)+"");
ioStorInvDtl.put("material_id",row.get("material_id"));
ioStorInvDtl.put("material_code",row.get("material_code"));
ioStorInvDtl.put("Pcsn",row.get("pcsn"));
ioStorInvDtl.put("bill_status",IOSEnum.BILL_STATUS.code("生成"));
ioStorInvDtl.put("qty_unit_id",row.get("qty_unit_id"));
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("unassign_qty",row.get("qty"));
ioStorInvDtl.put("plan_qty",row.get("qty"));
ioStorInvDtl.put("iostorinvdtl_id", IdUtil.getStringId());
ioStorInvDtl.put("iostorinv_id", iostorinv_id);
ioStorInvDtl.put("seq_no", (i + 1) + "");
ioStorInvDtl.put("material_id", row.get("material_id"));
ioStorInvDtl.put("material_code", row.get("material_code"));
ioStorInvDtl.put("Pcsn", row.get("pcsn"));
ioStorInvDtl.put("bill_status", IOSEnum.BILL_STATUS.code("生成"));
ioStorInvDtl.put("qty_unit_id", row.get("qty_unit_id"));
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("unassign_qty", row.get("qty"));
ioStorInvDtl.put("plan_qty", row.get("qty"));
Double qty = new Double(String.valueOf(row.get("qty")));
total_qty = total_qty.add(new BigDecimal(qty));
//判断该载具编号是否已经存在库内
Structattr structattr = iStructattrService.getOne(new LambdaQueryWrapper<>(Structattr.class).eq(Structattr::getStoragevehicle_code,row.get("storagevehicle_code")));
Structattr structattr = iStructattrService.getOne(new LambdaQueryWrapper<>(Structattr.class).eq(Structattr::getStoragevehicle_code, row.get("storagevehicle_code")));
if (ObjectUtil.isNotEmpty(structattr)) {
throw new BadRequestException("载具编码:" + row.get("storagevehicle_code") + "已存在库内,请对数据进行核实!");
}
@@ -270,45 +269,45 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
String now = DateUtil.now();
JSONObject iostorinv_json = new JSONObject();
iostorinv_json.put("iostorinv_id",iostorinv_id);
iostorinv_json.put("stor_id",whereJson.get("stor_id"));
iostorinv_json.put("stor_code",whereJson.get("stor_code"));
iostorinv_json.put("stor_name",whereJson.get("stor_name"));
iostorinv_json.put("total_qty",whereJson.get("total_qty"));
iostorinv_json.put("detail_count",whereJson.get("detail_count"));
iostorinv_json.put("biz_date",whereJson.get("biz_date"));
iostorinv_json.put("bill_type",whereJson.get("bill_type"));
iostorinv_json.put("remark",whereJson.get("remark"));
iostorinv_json.put("update_optid",currentUserId);
iostorinv_json.put("update_optname",nickName);
iostorinv_json.put("update_time",now);
iostorinv_json.put("iostorinv_id", iostorinv_id);
iostorinv_json.put("stor_id", whereJson.get("stor_id"));
iostorinv_json.put("stor_code", whereJson.get("stor_code"));
iostorinv_json.put("stor_name", whereJson.get("stor_name"));
iostorinv_json.put("total_qty", whereJson.get("total_qty"));
iostorinv_json.put("detail_count", whereJson.get("detail_count"));
iostorinv_json.put("biz_date", whereJson.get("biz_date"));
iostorinv_json.put("bill_type", whereJson.get("bill_type"));
iostorinv_json.put("remark", whereJson.get("remark"));
iostorinv_json.put("update_optid", currentUserId);
iostorinv_json.put("update_optname", nickName);
iostorinv_json.put("update_time", now);
ioStorInvMapper.updateById(iostorinv_json.toJavaObject(IOStorInv.class));
//先删除该单据下的所有明细
ioStorInvDtlMapper.delete(new LambdaQueryWrapper<>(IOStorInvDtl.class).eq(IOStorInvDtl::getIostorinv_id,iostorinv_id));
ioStorInvDtlMapper.delete(new LambdaQueryWrapper<>(IOStorInvDtl.class).eq(IOStorInvDtl::getIostorinv_id, iostorinv_id));
ioStorInvDisMapper.delete(new LambdaQueryWrapper<>(IOStorInvDis.class).eq(IOStorInvDis::getIostorinv_id,iostorinv_id));
ioStorInvDisMapper.delete(new LambdaQueryWrapper<>(IOStorInvDis.class).eq(IOStorInvDis::getIostorinv_id, iostorinv_id));
ArrayList<HashMap> rows = (ArrayList<HashMap>) whereJson.get("tableData");
for (int i = 0; i < rows.size(); i++) {
HashMap<String, Object> row = rows.get(i);
JSONObject ioStorInvDtl = new JSONObject();
ioStorInvDtl.putAll(row);
ioStorInvDtl.put("iostorinvdtl_id",IdUtil.getStringId());
ioStorInvDtl.put("iostorinv_id",iostorinv_id);
ioStorInvDtl.put("seq_no",(i + 1)+"");
ioStorInvDtl.put("material_id",row.get("material_id"));
ioStorInvDtl.put("Pcsn",row.get("pcsn"));
ioStorInvDtl.put("bill_status",IOSEnum.BILL_STATUS.code("生成"));
ioStorInvDtl.put("qty_unit_id",row.get("qty_unit_id"));
ioStorInvDtl.put("qty_unit_name",row.get("qty_unit_name"));
ioStorInvDtl.put("assign_qty",0);
ioStorInvDtl.put("plan_qty",row.get("plan_qty"));
ioStorInvDtl.put("unassign_qty",row.get("qty"));
ioStorInvDtl.put("iostorinvdtl_id", IdUtil.getStringId());
ioStorInvDtl.put("iostorinv_id", iostorinv_id);
ioStorInvDtl.put("seq_no", (i + 1) + "");
ioStorInvDtl.put("material_id", row.get("material_id"));
ioStorInvDtl.put("Pcsn", row.get("pcsn"));
ioStorInvDtl.put("bill_status", IOSEnum.BILL_STATUS.code("生成"));
ioStorInvDtl.put("qty_unit_id", row.get("qty_unit_id"));
ioStorInvDtl.put("qty_unit_name", row.get("qty_unit_name"));
ioStorInvDtl.put("assign_qty", 0);
ioStorInvDtl.put("plan_qty", row.get("plan_qty"));
ioStorInvDtl.put("unassign_qty", row.get("qty"));
//判断该载具编号是否已经存在库内
Structattr structattr = iStructattrService.getOne(new LambdaQueryWrapper<>(Structattr.class).eq(Structattr::getStoragevehicle_code,row.get("storagevehicle_code")));
Structattr structattr = iStructattrService.getOne(new LambdaQueryWrapper<>(Structattr.class).eq(Structattr::getStoragevehicle_code, row.get("storagevehicle_code")));
if (ObjectUtil.isNotEmpty(structattr)) {
throw new BadRequestException("载具编码:" + row.get("storagevehicle_code") + "已存在库内,请对数据进行核实!");
}
@@ -341,15 +340,15 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
@Override
@Transactional(rollbackFor = Exception.class)
public void divStruct(JSONObject param) {
Assert.noNullElements(new Object[]{param.getString("stor_code"),param.getString("sect_code")},"参数异常");
Assert.noNullElements(new Object[]{param.getString("stor_code"), param.getString("sect_code")}, "参数异常");
ArrayList<HashMap> rows = (ArrayList<HashMap>) param.get("tableMater");
JSONObject mst = JSONObject.parseObject(JSON.toJSONString(param));
HashMap<String, String> map = rows.get(0);
//判断该分配明细是否已经分配货位
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));
if (ioStorInvDis ==null){
if (ioStorInvDis == null) {
throw new BadRequestException("当前明细已经分配过库位");
}
String currentUserId = SecurityUtils.getCurrentUserId();
@@ -413,28 +412,28 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
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);
iStructattrService.updateStatusByCode("0", lock_map);
//更新组盘表状态
mdPbGroupplateService.update(new LambdaUpdateWrapper<GroupPlate>()
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
.eq(GroupPlate::getStoragevehicle_code, map.get("storagevehicle_code"))
.eq(GroupPlate::getStatus,IOSEnum.GROUP_PLATE_STATUS.code("组盘")));
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("组盘")));
// 更新分配明细表
ioStorInvDisMapper.update(dis_map.toJavaObject(IOStorInvDis.class),new LambdaUpdateWrapper<>(IOStorInvDis.class)
.set(IOStorInvDis::getSect_id,dis_map.getString("sect_id"))
.set(IOStorInvDis::getSect_code,dis_map.getString("sect_code"))
.set(IOStorInvDis::getSect_name,dis_map.getString("sect_name"))
.set(IOStorInvDis::getStruct_id,dis_map.getString("struct_id"))
.set(IOStorInvDis::getStruct_code,dis_map.getString("struct_code"))
.set(IOStorInvDis::getStruct_name,dis_map.getString("struct_name"))
.eq(IOStorInvDis::getIostorinvdis_id,map.get("iostorinvdis_id"))
ioStorInvDisMapper.update(dis_map.toJavaObject(IOStorInvDis.class), new LambdaUpdateWrapper<>(IOStorInvDis.class)
.set(IOStorInvDis::getSect_id, dis_map.getString("sect_id"))
.set(IOStorInvDis::getSect_code, dis_map.getString("sect_code"))
.set(IOStorInvDis::getSect_name, dis_map.getString("sect_name"))
.set(IOStorInvDis::getStruct_id, dis_map.getString("struct_id"))
.set(IOStorInvDis::getStruct_code, dis_map.getString("struct_code"))
.set(IOStorInvDis::getStruct_name, dis_map.getString("struct_name"))
.eq(IOStorInvDis::getIostorinvdis_id, map.get("iostorinvdis_id"))
);
//维护单据明细表里 分配数量
JSONObject jsonObject = new JSONObject();
jsonObject.put("iostorinvdtl_id",map.get("iostorinvdtl_id"));
jsonObject.put("bill_status",IOSEnum.BILL_STATUS.code("分配完"));
jsonObject.put("assign_qty",map.get("plan_qty"));
jsonObject.put("unassign_qty","0");
jsonObject.put("iostorinvdtl_id", map.get("iostorinvdtl_id"));
jsonObject.put("bill_status", IOSEnum.BILL_STATUS.code("分配完"));
jsonObject.put("assign_qty", map.get("plan_qty"));
jsonObject.put("unassign_qty", "0");
ioStorInvDtlMapper.updateById(jsonObject.toJavaObject(IOStorInvDtl.class));
//根据单据标识判断分配明细是否都已经分配完成
int disCount = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class)
@@ -453,15 +452,15 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
@Override
@Transactional(rollbackFor = Exception.class)
public void zwInDivStruct(JSONObject param) {
Assert.noNullElements(new Object[]{param.getString("stor_code"),param.getString("sect_code")},"参数异常");
Assert.noNullElements(new Object[]{param.getString("stor_code"), param.getString("sect_code")}, "参数异常");
ArrayList<HashMap> rows = (ArrayList<HashMap>) param.get("tableMater");
JSONObject mst = JSONObject.parseObject(JSON.toJSONString(param));
HashMap<String, String> map = rows.get(0);
//判断该分配明细是否已经分配货位
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));
if (ioStorInvDis ==null){
if (ioStorInvDis == null) {
throw new BadRequestException("当前明细已经分配过库位");
}
String currentUserId = SecurityUtils.getCurrentUserId();
@@ -529,29 +528,29 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
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);
iStructattrService.updateStatusByCode("0", lock_map);
//更新组盘表状态
mdPbGroupplateService.update(new LambdaUpdateWrapper<GroupPlate>()
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
.eq(GroupPlate::getStoragevehicle_code, map.get("storagevehicle_code"))
.eq(GroupPlate::getStatus,IOSEnum.GROUP_PLATE_STATUS.code("组盘")));
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("组盘")));
// 更新分配明细表
ioStorInvDisMapper.update(dis_map.toJavaObject(IOStorInvDis.class),new LambdaUpdateWrapper<>(IOStorInvDis.class)
.set(IOStorInvDis::getSect_id,dis_map.getString("sect_id"))
.set(IOStorInvDis::getSect_code,dis_map.getString("sect_code"))
.set(IOStorInvDis::getSect_name,dis_map.getString("sect_name"))
.set(IOStorInvDis::getStruct_id,dis_map.getString("struct_id"))
.set(IOStorInvDis::getStoragevehicle_code,dis_map.getString("storagevehicle_code"))
.set(IOStorInvDis::getStruct_code,dis_map.getString("struct_code"))
.set(IOStorInvDis::getStruct_name,dis_map.getString("struct_name"))
.eq(IOStorInvDis::getIostorinvdis_id,map.get("iostorinvdis_id"))
ioStorInvDisMapper.update(dis_map.toJavaObject(IOStorInvDis.class), new LambdaUpdateWrapper<>(IOStorInvDis.class)
.set(IOStorInvDis::getSect_id, dis_map.getString("sect_id"))
.set(IOStorInvDis::getSect_code, dis_map.getString("sect_code"))
.set(IOStorInvDis::getSect_name, dis_map.getString("sect_name"))
.set(IOStorInvDis::getStruct_id, dis_map.getString("struct_id"))
.set(IOStorInvDis::getStoragevehicle_code, dis_map.getString("storagevehicle_code"))
.set(IOStorInvDis::getStruct_code, dis_map.getString("struct_code"))
.set(IOStorInvDis::getStruct_name, dis_map.getString("struct_name"))
.eq(IOStorInvDis::getIostorinvdis_id, map.get("iostorinvdis_id"))
);
//维护单据明细表里 分配数量
JSONObject jsonObject = new JSONObject();
jsonObject.put("iostorinvdtl_id",map.get("iostorinvdtl_id"));
jsonObject.put("bill_status",IOSEnum.BILL_STATUS.code("分配完"));
jsonObject.put("assign_qty",map.get("plan_qty"));
jsonObject.put("unassign_qty","0");
jsonObject.put("iostorinvdtl_id", map.get("iostorinvdtl_id"));
jsonObject.put("bill_status", IOSEnum.BILL_STATUS.code("分配完"));
jsonObject.put("assign_qty", map.get("plan_qty"));
jsonObject.put("unassign_qty", "0");
ioStorInvDtlMapper.updateById(jsonObject.toJavaObject(IOStorInvDtl.class));
//根据单据标识判断分配明细是否都已经分配完成
int disCount = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class)
@@ -568,7 +567,6 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
}
/**
* 根据库区策略获取仓位
* ioType 出入库类型
@@ -580,21 +578,21 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
*/
@Override
public Structattr getStructattr(JSONObject param) {
List<Structattr> structattrs = iStructattrService.inBoundSectDiv(
StrategyStructParam.builder()
.ioType(param.getString("ioType"))
.sect_code(param.getString("sect_code"))
.stor_code(param.getString("stor_code"))
.material_code(param.getString("material_code"))
.qty(new BigDecimal(param.getString("qty")))
.pcsn(param.getString("pcsn"))
.stragegyType(param.getString("stragegy_type"))
.is_empty_vehicle(param.getBoolean("is_empty_vehicle"))
.build());
if (CollectionUtils.isEmpty(structattrs)) {
throw new BadRequestException("无可用货位");
}
return structattrs.get(0);
List<Structattr> structattrs = iStructattrService.inBoundSectDiv(
StrategyStructParam.builder()
.ioType(param.getString("ioType"))
.sect_code(param.getString("sect_code"))
.stor_code(param.getString("stor_code"))
.material_code(param.getString("material_code"))
.qty(new BigDecimal(param.getString("qty")))
.pcsn(param.getString("pcsn"))
.stragegyType(param.getString("stragegy_type"))
.is_empty_vehicle(param.getBoolean("is_empty_vehicle"))
.build());
if (CollectionUtils.isEmpty(structattrs)) {
throw new BadRequestException("无可用货位");
}
return structattrs.get(0);
}
@@ -615,31 +613,31 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
unlock_map.put("inv_type", null);
unlock_map.put("inv_id", null);
unlock_map.put("inv_code", null);
iStructattrService.updateStatusByCode("2",unlock_map);
iStructattrService.updateStatusByCode("2", unlock_map);
// 修改分配明细表
ioStorInvDisMapper.update(new IOStorInvDis(),new LambdaUpdateWrapper<>(IOStorInvDis.class)
.set(IOStorInvDis::getSect_id,null)
.set(IOStorInvDis::getSect_code,null)
.set(IOStorInvDis::getSect_name,null)
.set(IOStorInvDis::getStruct_id,null)
.set(IOStorInvDis::getStruct_code,null)
.set(IOStorInvDis::getStruct_name,null)
.eq(IOStorInvDis::getIostorinvdis_id,jo.get("iostorinvdis_id"))
ioStorInvDisMapper.update(new IOStorInvDis(), new LambdaUpdateWrapper<>(IOStorInvDis.class)
.set(IOStorInvDis::getSect_id, null)
.set(IOStorInvDis::getSect_code, null)
.set(IOStorInvDis::getSect_name, null)
.set(IOStorInvDis::getStruct_id, null)
.set(IOStorInvDis::getStruct_code, null)
.set(IOStorInvDis::getStruct_name, null)
.eq(IOStorInvDis::getIostorinvdis_id, jo.get("iostorinvdis_id"))
);
//维护单据明细表里 分配数量
JSONObject jsonObject = new JSONObject();
jsonObject.put("iostorinvdtl_id",jo.get("iostorinvdtl_id"));
jsonObject.put("bill_status",IOSEnum.BILL_STATUS.code("生成"));
jsonObject.put("assign_qty","0");
jsonObject.put("unassign_qty",jo.get("plan_qty"));
jsonObject.put("iostorinvdtl_id", jo.get("iostorinvdtl_id"));
jsonObject.put("bill_status", IOSEnum.BILL_STATUS.code("生成"));
jsonObject.put("assign_qty", "0");
jsonObject.put("unassign_qty", jo.get("plan_qty"));
ioStorInvDtlMapper.updateById(jsonObject.toJavaObject(IOStorInvDtl.class));
//根据单据标识判断分配明细是否都已经分配完成
int disCount = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class)
.eq(IOStorInvDis::getIostorinv_id,jo.get("iostorinv_id"))
.and(wrapper -> wrapper.isNotNull(IOStorInvDis::getStruct_code).or().ne(IOStorInvDis::getStruct_code,"")));
.eq(IOStorInvDis::getIostorinv_id, jo.get("iostorinv_id"))
.and(wrapper -> wrapper.isNotNull(IOStorInvDis::getStruct_code).or().ne(IOStorInvDis::getStruct_code, "")));
// 根据分配货位情况 更新主表单据状态
IOStorInv ios = new IOStorInv();
@@ -647,7 +645,7 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
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("生成"));
ios.setBill_status(disCount > 0 ? IOSEnum.BILL_STATUS.code("分配中") : IOSEnum.BILL_STATUS.code("生成"));
ioStorInvMapper.updateById(ios);
}
@@ -660,9 +658,9 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
//判断是否已经分配好货位
IOStorInvDis ioStorInvDis = ioStorInvDisMapper.selectOne(new LambdaQueryWrapper<>(IOStorInvDis.class)
.eq(IOStorInvDis::getIostorinvdis_id,map.get("iostorinvdis_id"))
.and(wrapper -> wrapper.isNotNull(IOStorInvDis::getStruct_code).or().ne(IOStorInvDis::getStruct_code,"")));
if (ObjectUtil.isEmpty(ioStorInvDis)){
.eq(IOStorInvDis::getIostorinvdis_id, map.get("iostorinvdis_id"))
.and(wrapper -> wrapper.isNotNull(IOStorInvDis::getStruct_code).or().ne(IOStorInvDis::getStruct_code, "")));
if (ObjectUtil.isEmpty(ioStorInvDis)) {
throw new BadRequestException("该明细还没分配货位,请先分配货位");
}
IOStorInv invObj = this.getById(map.get("iostorinv_id"));
@@ -684,9 +682,9 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
SchBasePoint parentPoint = pointService.getById(rkPoint.getParent_point_code());
// 2、创建任务4条任务、优先级需要获取所有的任务中的最小值并且-1默认8
// 获取工单对应的区域的出入点
SchBasePoint intoPoint = pointService.getNotTaskByRegionAndType(parentPoint.getRegion_code(), "2");
SchBasePoint emptyPoint = pointService.getNotTaskByRegionAndType(parentPoint.getRegion_code(), "5");
SchBasePoint fullPoint = pointService.getNotTaskByRegionAndType(parentPoint.getRegion_code(), "6");
SchBasePoint intoPoint = pointService.getNotTaskByDeviceAndType(parentPoint.getPoint_code(), "2");
SchBasePoint emptyPoint = pointService.getNotTaskByDeviceAndType(parentPoint.getPoint_code(), "5");
SchBasePoint fullPoint = pointService.getNotTaskByDeviceAndType(parentPoint.getPoint_code(), "6");
// 获取无盖子的对应的点位
List<SchBasePoint> canUseCFGJs = pointService.getCanUseCFGJs(parentPoint, "1");
if (canUseCFGJs.size() == 0) {
@@ -769,8 +767,8 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
SchBasePoint rkPoint = pointService.getById(point_code);
// 父点位
SchBasePoint parentPoint = pointService.getById(rkPoint.getParent_point_code());
SchBasePoint fullPoint = pointService.getNotTaskByRegionAndType(parentPoint.getRegion_code(), "3");
SchBasePoint emptyPoint = pointService.getNotTaskByRegionAndType(parentPoint.getRegion_code(), "4");
SchBasePoint fullPoint = pointService.getNotTaskByDeviceAndType(parentPoint.getPoint_code(), "3");
SchBasePoint emptyPoint = pointService.getNotTaskByDeviceAndType(parentPoint.getPoint_code(), "4");
JSONObject task = new JSONObject();
task.put("task_type", "JbBackAgvTask");
task.put("group_id", groupPlate.getGroup_id());
@@ -780,13 +778,15 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
task.put("point_code2", emptyPoint.getPoint_code());
task.put("point_code3", fullPoint.getPoint_code());
task.put("point_code4", structCode);
task.put("task_group_seq", whereJson.get("task_group_seq"));
task.put("task_group_id", whereJson.get("task_group_id"));
task.put("vehicle_code", fullPoint.getVehicle_code());
task.put("vehicle_code2", structattr.getStoragevehicle_code());
task_id = jbBackAgvTask.create(task);
} else if (StatusEnum.IOBILL_TYPE_IN.code("来料入库").equals(invObj.getBill_type())) {
// 获取组盘信息
GroupPlate groupPlate = mdPbGroupplateService.getOne(new LambdaQueryWrapper<GroupPlate>()
.eq(GroupPlate::getStoragevehicle_code, whereJson.get("vehicle_code"))
.eq(GroupPlate::getStoragevehicle_code, whereJson.get("vehicle_code"))
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库")));
if (ObjectUtil.isEmpty(groupPlate)) {
throw new BadRequestException("托盘[" + whereJson.get("vehicle_code") + "]状态为组盘的信息不存在!");
@@ -794,16 +794,16 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
JSONObject task = new JSONObject();
task.put("config_code", IOSConstant.IN_BILL_TASK);
task.put("group_id", groupPlate.getGroup_id());
task.put("priority",whereJson.get("priority"));
task.put("task_group_seq",whereJson.get("task_group_seq"));
task.put("task_group_id",whereJson.get("task_group_id"));
task.put("priority", whereJson.get("priority"));
task.put("task_group_seq", whereJson.get("task_group_seq"));
task.put("task_group_id", whereJson.get("task_group_id"));
task.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
task.put("point_code1",ioStorInvDis.getStruct_code());
task.put("point_code1", ioStorInvDis.getStruct_code());
task.put("point_code2", whereJson.get("point_code2"));
task.put("point_code3", whereJson.get("point_code3"));
task.put("point_code4", ioStorInvDis.getStruct_code());
task.put("form_data_code", whereJson.get("form_data_code"));
task.put("form_data_code", whereJson.get("form_data_code"));
//第一个载具为计算得到的,第二个载具为起始点载具
task.put("vehicle_code", ioStorInvDis.getStoragevehicle_code());
@@ -820,14 +820,14 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
JSONObject task = new JSONObject();
task.put("config_code", IOSConstant.BACK_IN_TASK);
task.put("group_id", groupPlate.getGroup_id());
task.put("priority",whereJson.get("priority"));
task.put("task_group_seq",whereJson.get("task_group_seq"));
task.put("task_group_id",whereJson.get("task_group_id"));
task.put("priority", whereJson.get("priority"));
task.put("task_group_seq", whereJson.get("task_group_seq"));
task.put("task_group_id", whereJson.get("task_group_id"));
task.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
task.put("point_code1",whereJson.get("point_code"));
task.put("point_code1", whereJson.get("point_code"));
task.put("point_code2", ioStorInvDis.getStruct_code());
task.put("form_data_code", whereJson.get("form_data_code"));
task.put("form_data_code", whereJson.get("form_data_code"));
//第一个载具为计算得到的,第二个载具为起始点载具
task.put("vehicle_code", ioStorInvDis.getStoragevehicle_code());
@@ -884,27 +884,27 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
String now = DateUtil.now();
IOStorInv ioStorInv = ioStorInvMapper.selectOne(new LambdaQueryWrapper<>(IOStorInv.class)
.eq(IOStorInv::getIostorinv_id,whereJson.get("iostorinv_id"))
.eq(IOStorInv::getIostorinv_id, whereJson.get("iostorinv_id"))
);
if (ObjectUtil.isNotEmpty(ioStorInv) && !IOSEnum.BILL_STATUS.code("分配完").equals(ioStorInv.getBill_status())){
if (ObjectUtil.isNotEmpty(ioStorInv) && !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"))
.eq(IOStorInvDis::getIostorinv_id, whereJson.get("iostorinv_id"))
);
for (IOStorInvDis ioStorInvDis: storInvDisList){
if (StrUtil.isNotBlank(ioStorInvDis.getStruct_code())){
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",ioStorInvDis.getStoragevehicle_code());
finish_map.put("struct_code", ioStorInvDis.getStruct_code());
finish_map.put("storagevehicle_code", ioStorInvDis.getStoragevehicle_code());
finish_map.put("inv_type", null);
finish_map.put("inv_id", null);
finish_map.put("inv_code", null);
iStructattrService.updateStatusByCode("1",finish_map);
iStructattrService.updateStatusByCode("1", finish_map);
//修改库存
List<JSONObject> updateIvtList = new ArrayList<>();
@@ -921,35 +921,35 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
}
//更新详情数据
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("完成"))
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("完成"))
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("完成"))
);
//更新组盘记录表
mdPbGroupplateService.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())
mdPbGroupplateService.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"))
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"))
);
}
@@ -963,37 +963,37 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
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("未找到任务对应的分配明细");
}
// 明细
IOStorInvDtl ioStorInvDtl = ioStorInvDtlMapper.selectById(ioStorInvDis.getIostorinvdtl_id());
if (ObjectUtil.isEmpty(ioStorInvDtl)){
if (ObjectUtil.isEmpty(ioStorInvDtl)) {
throw new BadRequestException("未找到明细");
}
// 明细
IOStorInv ioStorInv = ioStorInvMapper.selectById(ioStorInvDis.getIostorinv_id());
if (ObjectUtil.isEmpty(ioStorInv)){
if (ObjectUtil.isEmpty(ioStorInv)) {
throw new BadRequestException("未找到明细");
}
// 完成当前分配明细
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())
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())
);
//解锁库位
JSONObject finish_map = new JSONObject();
finish_map.put("struct_code",ioStorInvDis.getStruct_code());
finish_map.put("storagevehicle_code",ioStorInvDis.getStoragevehicle_code());
finish_map.put("struct_code", ioStorInvDis.getStruct_code());
finish_map.put("storagevehicle_code", ioStorInvDis.getStoragevehicle_code());
finish_map.put("inv_type", null);
finish_map.put("inv_id", null);
finish_map.put("inv_code", null);
finish_map.put("occupancy_state","3");
iStructattrService.updateStatusByCode("1",finish_map);
finish_map.put("occupancy_state", "3");
iStructattrService.updateStatusByCode("1", finish_map);
//库存变动
StructattrChangeDto changeDto = StructattrChangeDto.builder()
.inv(ioStorInv.getIostorinv_id())
@@ -1003,29 +1003,29 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
// 查询该明细下是否还有未完成的分配明细
int countDis = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class)
.eq(IOStorInvDis::getIostorinvdtl_id,ioStorInvDis.getIostorinvdtl_id())
.ne(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成"))
.eq(IOStorInvDis::getIostorinvdtl_id, ioStorInvDis.getIostorinvdtl_id())
.ne(IOStorInvDis::getWork_status, IOSEnum.INBILL_DIS_STATUS.code("完成"))
);
// 如果分配明细全部完成则更新明细表状态
if (countDis == 0){
if (countDis == 0) {
// 更新明细表状态
ioStorInvDtl.setReal_qty(ioStorInvDis.getPlan_qty());
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("完成"))
.eq(IOStorInvDtl::getIostorinv_id, ioStorInvDtl.getIostorinv_id())
.ne(IOStorInvDtl::getBill_status, IOSEnum.BILL_STATUS.code("完成"))
);
// 如果明细全部完成则更新主表状态
if (countDtl == 0){
if (countDtl == 0) {
//更新主表状态
ioStorInvMapper.update(new 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,ioStorInvDtl.getIostorinv_id())
ioStorInvMapper.update(new 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, ioStorInvDtl.getIostorinv_id())
);
}
}
@@ -1044,17 +1044,17 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
String storagevehicle_code = whereJson.getString("storagevehicle_code");
// 查询没有任务的仓位号
List<Structattr> structattrList = iStructattrService.list(new LambdaQueryWrapper<>(Structattr.class)
.eq(Structattr::getSect_id,sect_id)
.eq(Structattr::getLock_type,IOSEnum.LOCK_TYPE.code("未锁定"))
.and(wrapper -> wrapper.isNull(Structattr::getStoragevehicle_code).or().eq(Structattr::getStoragevehicle_code,""))
.eq(Structattr::getSect_id, sect_id)
.eq(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
.and(wrapper -> wrapper.isNull(Structattr::getStoragevehicle_code).or().eq(Structattr::getStoragevehicle_code, ""))
);
if (ObjectUtil.isEmpty(structattrList)){
if (ObjectUtil.isEmpty(structattrList)) {
throw new BadRequestException("该库区没有仓位");
}
MdPbStoragevehicleinfo mdPbStoragevehicleinfo = mdPbStoragevehicleinfoMapper.selectOne(new LambdaQueryWrapper<>(MdPbStoragevehicleinfo.class)
.eq(MdPbStoragevehicleinfo::getStoragevehicle_code,storagevehicle_code)
.eq(MdPbStoragevehicleinfo::getStoragevehicle_code, storagevehicle_code)
);
if (ObjectUtil.isEmpty(mdPbStoragevehicleinfo)){
if (ObjectUtil.isEmpty(mdPbStoragevehicleinfo)) {
throw new BadRequestException("没有该载具号信息");
}
// 过滤掉不满足载具长宽高的仓位
@@ -1064,7 +1064,7 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
st.getZdepth() >= 0
).findAny().get();
if (ObjectUtil.isEmpty(structattr)){
if (ObjectUtil.isEmpty(structattr)) {
throw new BadRequestException("未找到满足的仓位");
}

View File

@@ -975,8 +975,8 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
// 解包需要单独操作
SchBasePoint ckPoint = pointService.getById(point_code);
SchBasePoint outPointP = pointService.getById(ckPoint.getParent_point_code());
SchBasePoint inPoint = pointService.getNotTaskByRegionAndType(outPointP.getRegion_code(), "3");
SchBasePoint outPoint = pointService.getNotTaskByRegionAndType(outPointP.getRegion_code(), "4");
SchBasePoint inPoint = pointService.getNotTaskByDeviceAndType(outPointP.getPoint_code(), "3");
SchBasePoint outPoint = pointService.getNotTaskByDeviceAndType(outPointP.getPoint_code(), "4");
if (ObjectUtil.isEmpty(inPoint) || ObjectUtil.isEmpty(outPoint)) {
throw new BadRequestException("解包机输送线点位不存在或者存在任务!");
}

View File

@@ -123,5 +123,7 @@ public class GroupPlate implements Serializable {
private String material_code;
@TableField(exist = false)
private String material_name;
@TableField(exist = false)
private String material_spec;
}

View File

@@ -0,0 +1 @@
MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCBbWQ38mZdmOX379myX/NFn/qFIeP3kbogDiWlGtc1JNt6eDSsOEShUNj3o8Jo5Qaepyo6j4stP4WpmCAUFsdyOodzU0R60P7gFOR1OIdKyyQ2OS9J1MdNXRRuksfD1WVG+azoB+huQo2D52bcXSjnu1UDRDrXN3XXZgh1L2V/aDg+Gi9QAIsMDHtN62zKsHs4tlClHt0KORSdAxN9RjPzUFNYXfxW3dNTM9zfltoM2bgeUfG61F5EMipkAEVjDb4+Pu2BsNUamjy85eKDWA8NxDU6uuDkxLNiLx5KipLxOR+EM4/cOqRwHdEj8matpGlqBSOfOxXd6Sh5XmVStBjtAgMBAAECggEAQCbcme6IVrRGqJI2MXfluQkGv56AxGFzBBh/CEs5iJnwP8/9K6/oNJ1CLdz5q8x5b4IkKEqmDZOCyQEiRVLVIQVpxfvr4YReEOvKIWAXjzcJh+boTYwuDWapjfUrFyJaxMdUsN3ak2xhgJPeJDP45oOwK6JSGALhYhas8oi/olptl3leZs/5Z3h9UE69u80XRdhjtGyfS3AOOtT6dVcfKw6H8tmoKmx43ZfPvoV+a7hcwHO587mI1epAhYGOn81e5QoNBegiCEv9KutuZtauJuGHKcsvNh/FK8QujRJ1TFxOsMtxsJWZfxQxUuvJ0PulCpGpmkuHFNGDmV3ukJO1AQKBgQC8eiTaWgq8eCrIOi5fYtXQUmzv2e5BOhMrRyUWoB30N7GmKcdNGT5HJVXztidcBj53cNd8T6t5yTwYFrdZ5Lll7ItPAub25CSnGQU2nmceHK+46PNlQfLZRrlyeUuGYJTHVZanV+6Pneqn+6XifTa969HzpejpiJuG8iYVmcztfQKBgQCvy5ha6tBS+sIrjXL8/lrxXMDm4xT3CnCLmBqInppLwfFOgcQFzYWL6SQSJ7k3uC+xFT++VgsRLz/pQrVLsQzkY6mUF8sI7F0kevy/jAFzl9cgFn9BXu1ATyWloQIAX/UdSbzSWxIH3BW3BNOWZ0x91HUqBDAFzyLBkIns8LZ0MQKBgQCyg9oN+kS69/JFjV3IuLsdQkSt9LNGknP/hLYrNOLKIkofwOhlLOigyEsdt0SWU8+sn3Np6afXhPNnOXTWLt4vHJlh77TE2ZehsQAQGH5Athj1waZvHMSgaO1S8HHJSAcCuh0kSRPKcV8FVkNrPv+vaQGFjXoKX3o3mXja8r53nQKBgQCElQVj1GKnoo1csYJ+wgqurCikObFvG8WD0oR4cz2lUzD956qCQd2thnj45FKxbk0xvffkQhp4rG0ELJZ07qPtgCi+Ey/CnBknUUZb5GiX2HWbsrvo/oHqlYasIwFSbQx9OUaaU6sGmHscHBzD+0ZaRCjVNnFNgEoTOEJ9m5HPkQKBgQC0Kd29rQMIm5wXhIyW+bVdwmEyB/Xuq6Ch7lVVfZ6WMSoDbQZdYH3Mxw+yzjYpcS8jf/7x7mYH9Z0ggXwX7CAcRqhpjtKU800KzwQ2Cnd7Jmgq56Mn/e70J4btH73EZB6sm7vmhIuBZZlvc3oYGeJN/t/9vLwomFqrlXVw318J2A==