add:托盘库物料混放功能;
add:铜管,两器,空托盘搬运; opt:优化出入库逻辑;
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package org.nl.wms.basedata_manage.service.dao;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -178,4 +180,17 @@ public class MdMeMaterialbase implements Serializable {
|
||||
private String ext_id;
|
||||
|
||||
|
||||
/**
|
||||
* 外部标识
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String qty="";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 外部标识
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String pcsn="";
|
||||
}
|
||||
|
||||
@@ -94,19 +94,23 @@
|
||||
|
||||
<if test="param.struct_code != null and param.struct_code != ''">
|
||||
AND
|
||||
(attr.struct_code LIKE #{param.struct_code} or
|
||||
attr.struct_name LIKE #{param.struct_code} )
|
||||
(attr.struct_code LIKE CONCAT('%', #{param.struct_code}, '%') or
|
||||
attr.struct_name LIKE CONCAT('%', #{param.struct_name}, '%') )
|
||||
</if>
|
||||
|
||||
<if test="param.material_code != null and param.material_code != ''">
|
||||
AND
|
||||
(mater.material_code LIKE #{param.material_code} or
|
||||
mater.material_name LIKE #{param.material_code} )
|
||||
(mater.material_code LIKE CONCAT('%', #{param.material_code}, '%') or
|
||||
mater.material_name LIKE CONCAT('%', #{param.material_name}, '%') )
|
||||
</if>
|
||||
|
||||
<if test="param.pcsn != null and param.pcsn != ''">
|
||||
AND
|
||||
ext.pcsn LIKE #{param.pcsn}
|
||||
ext.pcsn LIKE CONCAT('%', #{param.pcsn}, '%')
|
||||
</if>
|
||||
<if test="param.vehicle_code != null and param.vehicle_code != ''">
|
||||
AND
|
||||
attr.storagevehicle_code LIKE CONCAT('%', #{param.vehicle_code}, '%')
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY ext.create_time Desc
|
||||
|
||||
@@ -5,6 +5,7 @@ import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.poi.excel.ExcelReader;
|
||||
import cn.hutool.poi.excel.ExcelUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -25,6 +26,7 @@ import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdMeMaterialbaseMapper;
|
||||
import org.nl.wms.ext.service.WmsToErpService;
|
||||
import org.nl.wms.pda.ios_manage.service.PdaIosInService;
|
||||
import org.nl.wms.sch_manage.enums.StatusEnum;
|
||||
import org.nl.wms.sch_manage.service.ISchBasePointService;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBasePoint;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -240,6 +242,12 @@ public class MdMeMaterialbaseServiceImpl extends ServiceImpl<MdMeMaterialbaseMap
|
||||
//物料数量
|
||||
Integer m4 = Integer.parseInt(String.valueOf(list.get(6)).trim());
|
||||
JSONObject whereJson = new JSONObject();
|
||||
JSONArray dataArray = new JSONArray();
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("material_id",mdMeMaterialbase.getMaterial_id());
|
||||
item.put("qty", m4);
|
||||
dataArray.add(item);
|
||||
whereJson.put("data", dataArray);
|
||||
whereJson.put("store_id", structattr.getStor_id());
|
||||
whereJson.put("material_id", mdMeMaterialbase.getMaterial_id());
|
||||
whereJson.put("material_code", mdMeMaterialbase.getMaterial_code());
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.basedata_manage.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
package org.nl.wms.pda.ios_manage.controller;
|
||||
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -8,9 +6,20 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.common.utils.RedissonUtils;
|
||||
import org.nl.wms.basedata_manage.service.*;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdMeMaterialbase;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdMeMaterialbaseMapper;
|
||||
import org.nl.wms.pda.ios_manage.service.PdaIosInService;
|
||||
import org.nl.wms.pda.ios_manage.service.PdaIosOutService;
|
||||
import org.nl.wms.pda.util.PdaResponse;
|
||||
import org.nl.wms.sch_manage.service.ISchBasePointService;
|
||||
import org.nl.wms.sch_manage.service.ISchBaseRegionService;
|
||||
import org.nl.wms.sch_manage.service.util.AbstractTask;
|
||||
import org.nl.wms.warehouse_management.service.IMdPbGroupplateService;
|
||||
import org.nl.wms.warehouse_management.service.IRawAssistIStorService;
|
||||
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvDtlMapper;
|
||||
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.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -18,7 +27,8 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
import static org.nl.common.utils.ValidationUtil.assertNotBlankJson;
|
||||
|
||||
/**
|
||||
@@ -37,17 +47,18 @@ public class PdaIosInController {
|
||||
@Autowired
|
||||
private PdaIosInService pdaIosInService;
|
||||
|
||||
|
||||
@PostMapping("/groupPlate")
|
||||
@Log("物料组盘确认")
|
||||
public ResponseEntity<Object> groupPlate(@RequestBody JSONObject whereJson) {
|
||||
assertNotBlankJson(whereJson, "请求参数不能为空", "vehicle_code", "material_id", "qty");
|
||||
assertNotBlankJson(whereJson, "请求参数不能为空", "vehicle_code");
|
||||
RedissonUtils.lock(() -> {
|
||||
pdaIosInService.groupPlate(whereJson);
|
||||
}, "groupPlate" + whereJson.getString("vehicle_code"), null);
|
||||
return new ResponseEntity<>(PdaResponse.requestParamOk(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping("/getPlateDtl")
|
||||
@Log("查询明细")
|
||||
public ResponseEntity<Object> getPlateDtl(@RequestBody JSONObject whereJson) {
|
||||
@@ -130,7 +141,7 @@ public class PdaIosInController {
|
||||
JSONObject json = whereJson.getJSONObject("obj");
|
||||
json.put("sect_id", whereJson.getString("sect_id"));
|
||||
RedissonUtils.lock(() -> {
|
||||
pdaIosInService.confirmReturnMaterial(whereJson);
|
||||
pdaIosInService.confirmReturnMaterial(json);
|
||||
}, "confirmReturnMaterial" + json.getString("storagevehicle_code"), null);
|
||||
return new ResponseEntity<>(PdaResponse.requestParamOk(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ public class PdaIosOutController {
|
||||
if (StringUtils.isBlank(whereJson.getString("siteCode"))&&StringUtils.isBlank( whereJson.getString("shelfCode"))) {
|
||||
throw new BadRequestException("点位编号和载具编号需要扫其中一个,不能同时为空");
|
||||
}
|
||||
pdaIosOutService.bindOrUnbind(whereJson.getString("siteCode"), whereJson.getString("shelfCode"), whereJson.getString("mode"));
|
||||
pdaIosOutService.bindOrUnbind(whereJson.getString("siteCode"), whereJson.getString("shelfCode"), whereJson.getString("mode"),true);
|
||||
}, "bindOrUnbind" , null);
|
||||
return new ResponseEntity<>(PdaResponse.requestParamOk(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public interface PdaIosInService {
|
||||
*
|
||||
* @return PdaResponse
|
||||
*/
|
||||
JSONObject getVehicleMaterial(JSONObject whereJson);
|
||||
List<JSONObject> getVehicleMaterial(JSONObject whereJson);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -86,11 +86,12 @@ public interface PdaIosOutService {
|
||||
/**
|
||||
* 货架与站点绑定或解绑
|
||||
* siteCode: 点位
|
||||
*shelfCode: 货架编号
|
||||
*mode: 0解绑1绑定
|
||||
* shelfCode: 货架编号
|
||||
* mode: 0解绑1绑定
|
||||
*
|
||||
* @return PdaResponse
|
||||
*/
|
||||
PdaResponse bindOrUnbind(String siteCode, String shelfCode, String mode);
|
||||
PdaResponse bindOrUnbind(String siteCode, String shelfCode, String mode, boolean dealGroupPlate);
|
||||
|
||||
/**
|
||||
* 查询物料列表
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package org.nl.wms.pda.ios_manage.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -156,8 +158,7 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
||||
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public JSONObject groupPlate(JSONObject whereJson) {
|
||||
public JSONObject groupPlate1(JSONObject whereJson) {
|
||||
// 物料编码
|
||||
String materialId = whereJson.getString("material_id");
|
||||
// 数量
|
||||
@@ -217,11 +218,115 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
||||
if (StringUtils.isNotBlank(whereJson.getString("siteCode"))) {
|
||||
whereJson.put("mode", IOSEnum.BIND_OR_UNBIND.code("绑定"));
|
||||
//确定点位则绑定
|
||||
pdaIosOutService.bindOrUnbind(whereJson.getString("siteCode"), whereJson.getString("vehicle_code"), whereJson.getString("mode"));
|
||||
pdaIosOutService.bindOrUnbind(whereJson.getString("siteCode"), whereJson.getString("vehicle_code"), whereJson.getString("mode"),false);
|
||||
}
|
||||
return whereJson;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public JSONObject groupPlate(JSONObject whereJson) {
|
||||
JSONArray dataArray = whereJson.getJSONArray("data");
|
||||
String vehicleCode = whereJson.getString("vehicle_code");
|
||||
String extCode = whereJson.getString("ext_code");
|
||||
List<GroupPlate> groupList = new ArrayList<>();
|
||||
MdPbStoragevehicleinfo vehicleDao = iMdPbStoragevehicleinfoService.getByCode(vehicleCode);
|
||||
if (ObjectUtil.isEmpty(vehicleDao)) {
|
||||
throw new BadRequestException("载具信息有误!");
|
||||
}
|
||||
if ((!vehicleDao.getStoragevehicle_code().contains("T") && dataArray.size() > 1) || ObjectUtils.isEmpty(dataArray)) {
|
||||
throw new BadRequestException("请检查是否选中物料或一个载具只能存放一个物料。");
|
||||
}
|
||||
//校验qty
|
||||
boolean qtyIsEmpty = dataArray.stream()
|
||||
.anyMatch(r -> {
|
||||
if (r instanceof Map) {
|
||||
Object qty = ((Map<?, ?>) r).get("qty");
|
||||
return ObjectUtil.isEmpty(qty) || ObjectUtil.isEmpty(qty.toString().trim());
|
||||
}
|
||||
return true;
|
||||
});
|
||||
if (qtyIsEmpty) {
|
||||
throw new BadRequestException("物料数量不能为空");
|
||||
}
|
||||
// 判断该载具是否存在组盘信息(出库前清理)
|
||||
List<GroupPlate> groupPlateList = iMdPbGroupplateService.list(
|
||||
new LambdaQueryWrapper<GroupPlate>()
|
||||
.eq(GroupPlate::getStoragevehicle_code, vehicleDao.getStoragevehicle_code())
|
||||
.lt(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库"))
|
||||
);
|
||||
if (ObjectUtils.isNotEmpty(groupPlateList)) {
|
||||
mdPbGroupplateMapper.update(null, new LambdaUpdateWrapper<GroupPlate>()
|
||||
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库"))
|
||||
.set(GroupPlate::getQty, BigDecimal.ZERO)
|
||||
.set(GroupPlate::getFrozen_qty, BigDecimal.ZERO)
|
||||
.set(GroupPlate::getUpdate_time, DateUtil.now())
|
||||
.set(GroupPlate::getUpdate_optid, SecurityUtils.getCurrentUserId())
|
||||
.set(GroupPlate::getUpdate_optname, SecurityUtils.getCurrentNickName())
|
||||
.set(GroupPlate::getRemark, "载具:" + vehicleDao.getStoragevehicle_code() + "存在物料,于" + DateUtil.now() + "重新组盘,该物料强制清空出库。")
|
||||
.in(GroupPlate::getGroup_id, groupPlateList.stream().map(GroupPlate::getGroup_id).collect(Collectors.toSet()))
|
||||
);
|
||||
}
|
||||
for (int i = 0; i < dataArray.size(); i++) {
|
||||
JSONObject item = dataArray.getJSONObject(i);
|
||||
String materialId = item.getString("material_id");
|
||||
String qty = item.getString("qty");
|
||||
String pcsn = StringUtils.isBlank(item.getString("pcsn")) ?
|
||||
org.nl.common.utils.DateUtil.getDateTimeFormatyMd() : item.getString("pcsn");
|
||||
// 校验物料信息
|
||||
MdMeMaterialbase materDao = iMdMeMaterialbaseService.getByCode(materialId);
|
||||
if (ObjectUtil.isEmpty(materDao)) {
|
||||
throw new BadRequestException("物料信息错误:" + materialId);
|
||||
}
|
||||
// 校验单位信息
|
||||
MdPbMeasureunit unitDao = iMdPbMeasureunitService.getById(materDao.getBase_unit_id());
|
||||
if (ObjectUtil.isEmpty(unitDao)) {
|
||||
throw new BadRequestException("单位信息错误:" + materialId);
|
||||
}
|
||||
GroupPlate groupDao = GroupPlate.builder()
|
||||
.group_id(IdUtil.getStringId())
|
||||
.material_id(materDao.getMaterial_id())
|
||||
.storagevehicle_code(vehicleDao.getStoragevehicle_code())
|
||||
.pcsn(pcsn)
|
||||
.qty_unit_id(unitDao.getMeasure_unit_id())
|
||||
.qty_unit_name(unitDao.getUnit_name())
|
||||
.qty(new BigDecimal(qty))
|
||||
.status(StringUtils.defaultIfBlank(item.getString("groupStatus"),
|
||||
IOSEnum.GROUP_PLATE_STATUS.code("组盘")))
|
||||
.ext_code(extCode)
|
||||
.create_id(SecurityUtils.getCurrentUserId())
|
||||
.create_name(SecurityUtils.getCurrentNickName())
|
||||
.create_time(DateUtil.now())
|
||||
.remark(StringUtils.defaultIfBlank(item.getString("remark"), ""))
|
||||
.build();
|
||||
groupList.add(groupDao);
|
||||
}
|
||||
boolean hasSame = groupList.stream()
|
||||
.collect(Collectors.groupingBy(GroupPlate::getMaterial_id, Collectors.counting()))
|
||||
.values().stream()
|
||||
.anyMatch(r -> r > 1);
|
||||
if (hasSame) {
|
||||
throw new RuntimeException("存在重复物料明细,请检查!");
|
||||
}
|
||||
boolean count = groupList.stream()
|
||||
.collect(Collectors.groupingBy(GroupPlate::getMaterial_id,
|
||||
Collectors.mapping(GroupPlate::getPcsn, Collectors.toSet())))
|
||||
.entrySet().stream()
|
||||
.anyMatch(r -> r.getValue().size() > 1);
|
||||
if (count) {
|
||||
throw new BadRequestException("存在相同物料不同批次的数据,相同物料不同批次不符合混料组盘,请检查或分开组盘!");
|
||||
}
|
||||
if (CollUtil.isNotEmpty(groupList)) {
|
||||
iMdPbGroupplateService.saveBatch(groupList);
|
||||
}
|
||||
// 如果有点位,则进行绑定
|
||||
if (StringUtils.isNotBlank(whereJson.getString("siteCode"))) {
|
||||
whereJson.put("mode", IOSEnum.BIND_OR_UNBIND.code("绑定"));
|
||||
//确定点位则绑定
|
||||
pdaIosOutService.bindOrUnbind(whereJson.getString("siteCode"), whereJson.getString("vehicle_code"), whereJson.getString("mode"),false);
|
||||
}
|
||||
return whereJson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdaResponse getPlateDtl(JSONObject whereJson) {
|
||||
@@ -291,14 +396,14 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getVehicleMaterial(JSONObject whereJson) {
|
||||
public List<JSONObject> getVehicleMaterial(JSONObject whereJson) {
|
||||
whereJson.put("status", GROUP_PLATE_STATUS.code("组盘"));
|
||||
whereJson.put("vehicleCode", whereJson.getString("search"));
|
||||
List<JSONObject> list = mdPbGroupplateMapper.getVehicleMaterial(whereJson);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
throw new BadRequestException("此载具未组盘,请检查!");
|
||||
}
|
||||
return list.get(0);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -311,7 +416,7 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
||||
*/
|
||||
@Override
|
||||
public PdaResponse getReturnMaterial(JSONObject whereJson) {
|
||||
whereJson.put("status", IOSEnum.GROUP_PLATE_STATUS.code("入库"));
|
||||
whereJson.put("status", IOSEnum.GROUP_PLATE_STATUS.code("组盘"));
|
||||
whereJson.put("vehicleCode", whereJson.getString("search"));
|
||||
whereJson.put("qty", 0);
|
||||
List<JSONObject> list = mdPbGroupplateMapper.getVehicleMaterial(whereJson);
|
||||
@@ -431,7 +536,8 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
||||
SchBasePoint schBasePoint = iSchBasePointService
|
||||
.getOne(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getPoint_code, whereJson.getString("site_code")));
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) {
|
||||
throw new BadRequestException("未找到载具所在的点位信息,请检查该载具是否绑定点位");
|
||||
//自动绑定
|
||||
pdaIosOutService.bindOrUnbind(whereJson.getString("site_code"), whereJson.getString("vehicle_code"),IOSEnum.BIND_OR_UNBIND.code("绑定"),false);
|
||||
}
|
||||
whereJson.put("point_code", whereJson.getString("site_code"));
|
||||
// 预组织出入库单据实体
|
||||
@@ -440,9 +546,9 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
||||
String iostorinvId = iRawAssistIStorService.insertDtl(jsonMst);
|
||||
// 预组织出入库单据明细的分配数据
|
||||
whereJson.put("iostorinv_id", iostorinvId);
|
||||
Map<String, Object> jsonDtl = organizeDivData(whereJson);
|
||||
JSONObject jsonDtl = organizeDivData(whereJson);
|
||||
// 调用分配,默认自动分配库位
|
||||
iRawAssistIStorService.divStruct(new JSONObject(jsonDtl));
|
||||
iRawAssistIStorService.divStruct(jsonDtl);
|
||||
// 下发任务
|
||||
Map<String, Object> taskJson = new HashMap<>();
|
||||
taskJson.put("point_code", whereJson.getString("point_code"));
|
||||
@@ -471,7 +577,13 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
||||
//空载具入库
|
||||
whereJson.put("qty", 1);
|
||||
String materialCode = "1".equals(whereJson.getString("material_id")) ? StatusEnum.VEHICLE_TYPE.code("空托盘") : "2".equals(whereJson.getString("material_id")) ? StatusEnum.VEHICLE_TYPE.code("空料箱") : StatusEnum.VEHICLE_TYPE.code("空货架");
|
||||
whereJson.put("material_id", materialCode);
|
||||
JSONArray dataArray = new JSONArray();
|
||||
JSONObject item = new JSONObject();
|
||||
whereJson.put("material_code",materialCode);
|
||||
item.put("material_id",materialCode);
|
||||
item.put("qty", 1);
|
||||
dataArray.add(item);
|
||||
whereJson.put("data", dataArray);
|
||||
//组盘
|
||||
SpringContextHolder.getBean(PdaIosInServiceImpl.class).groupPlate(whereJson);
|
||||
//生成空载具入库任务
|
||||
@@ -546,18 +658,17 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
||||
* }
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
private Map<String, Object> organizeDivData(JSONObject whereJson) {
|
||||
private JSONObject organizeDivData(JSONObject whereJson) {
|
||||
// 查询库区
|
||||
Sectattr sectDao = iSectattrService.getById(whereJson.getString("sect_id"));
|
||||
// 查询仓库
|
||||
BsrealStorattr storeDao = iSrealStorattrService.findByCode(sectDao.getStor_code());
|
||||
// 组织主数据
|
||||
Map<String, Object> jsonMst = new HashMap<>();
|
||||
jsonMst.put("checked", true);
|
||||
jsonMst.put("sect_id", sectDao.getSect_id());
|
||||
jsonMst.put("sect_code", sectDao.getSect_code());
|
||||
jsonMst.put("stor_id", storeDao.getStor_id());
|
||||
jsonMst.put("stor_code", storeDao.getStor_code());
|
||||
whereJson.put("checked", true);
|
||||
whereJson.put("sect_id", sectDao.getSect_id());
|
||||
whereJson.put("sect_code", sectDao.getSect_code());
|
||||
whereJson.put("stor_id", storeDao.getStor_id());
|
||||
whereJson.put("stor_code", storeDao.getStor_code());
|
||||
// 组织明细数据
|
||||
IOStorInvDtl dtlDao = ioStorInvDtlMapper.selectOne(
|
||||
new QueryWrapper<IOStorInvDtl>().lambda()
|
||||
@@ -567,14 +678,10 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("iostorinvdtl_id", dtlDao.getIostorinvdtl_id());
|
||||
List<IOStorInvDisDto> disDtl = iRawAssistIStorService.getDisDtl(map);
|
||||
// 类型转换
|
||||
ArrayList<LinkedHashMap> tableMater = new ArrayList<>();
|
||||
disDtl.forEach(item -> {
|
||||
tableMater.add(JSONObject.parseObject(JSONObject.toJSONString(item), LinkedHashMap.class));
|
||||
});
|
||||
jsonMst.put("tableMater", tableMater);
|
||||
|
||||
return jsonMst;
|
||||
JSONObject disRow = JSONObject.parseObject(JSONObject.toJSONString(disDtl.get(0)));
|
||||
disRow.put("iostorinv_id", dtlDao.getIostorinv_id());
|
||||
whereJson.put("dis_row", disRow);
|
||||
return whereJson;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.nl.wms.pda.ios_manage.service.impl;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -261,8 +262,8 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
taskForm.put("point_code1", json.getString("struct_code"));
|
||||
taskForm.put("point_code2", whereJson.getString("siteCode"));
|
||||
taskForm.put("vehicle_code", json.getString("storagevehicle_code"));
|
||||
taskForm.put("is_auto_confirm",(BaseDataEnum.IS_YES_NOT.code("是")));
|
||||
taskForm.put("handle_status",(BaseDataEnum.IS_YES_NOT.code("是")));
|
||||
taskForm.put("is_auto_confirm", (BaseDataEnum.IS_YES_NOT.code("是")));
|
||||
taskForm.put("handle_status", (BaseDataEnum.IS_YES_NOT.code("是")));
|
||||
String taskId = applyTaskMap.get(IOSConstant.ST_OUT_TASK).create(whereJson);
|
||||
//更新任务id
|
||||
ioStorInvDisMapper.update(new IOStorInvDis(), new LambdaUpdateWrapper<IOStorInvDis>()
|
||||
@@ -502,7 +503,7 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public PdaResponse bindOrUnbind(String siteCode, String shelfCode, String mode) {
|
||||
public PdaResponse bindOrUnbind(String siteCode, String shelfCode, String mode, boolean dealGroupPlate) {
|
||||
SchBasePoint sitePoint = new SchBasePoint();
|
||||
// 校验站点是否存在、是否可用
|
||||
if (StringUtils.isNotBlank(siteCode)) {
|
||||
@@ -543,7 +544,10 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
}
|
||||
}
|
||||
if (IOSEnum.BIND_OR_UNBIND.code("绑定").equals(mode)) {
|
||||
checkGroupPlateStatus(shelfCode, sitePoint.getRegion_code());
|
||||
//点位或站点扫码绑定需要处理组盘信息
|
||||
if (dealGroupPlate) {
|
||||
dealGroupPlateStatus(shelfCode, sitePoint.getRegion_code());
|
||||
}
|
||||
doBind(siteCode, shelfCode);
|
||||
} else {
|
||||
doUnbind(siteCode, sitePoint.getParent_point_code());
|
||||
@@ -581,13 +585,13 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
/**
|
||||
* 校验组盘状态
|
||||
*/
|
||||
private void checkGroupPlateStatus(String shelfCode, String regionCode) {
|
||||
private void dealGroupPlateStatus(String shelfCode, String regionCode) {
|
||||
List<GroupPlate> plates = mdPbGroupplateMapper.selectList(
|
||||
new LambdaQueryWrapper<GroupPlate>()
|
||||
.eq(GroupPlate::getStoragevehicle_code, shelfCode)
|
||||
.lt(GroupPlate::getStatus, GROUP_PLATE_STATUS.code("出库"))
|
||||
);
|
||||
if (CollectionUtils.isNotEmpty(plates)) {
|
||||
if (CollectionUtils.isNotEmpty(plates) && StringUtils.isNotBlank(regionCode)) {
|
||||
LambdaUpdateWrapper<GroupPlate> update = new LambdaUpdateWrapper<>();
|
||||
Set<String> plateCodes = plates.stream().map(GroupPlate::getGroup_id).collect(Collectors.toSet());
|
||||
if (!regionCode.equals(StatusEnum.REGION_INFO.code("商用线5号线"))) {
|
||||
@@ -650,58 +654,17 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
if (ObjectUtil.isEmpty(pointDao)) {
|
||||
throw new BadRequestException("未找到载具所在的点位信息,请检查");
|
||||
}
|
||||
if (pointDao.getRegion_code().equals(StatusEnum.REGION_INFO.code("商用线5号线"))) {
|
||||
//默认整出,强制确认
|
||||
whereJson.put("type", "2");
|
||||
}
|
||||
//处理组盘信息
|
||||
handleGroupPlate(whereJson);
|
||||
//预装区与商用5号线点位需自动回空
|
||||
if (pointDao.getRegion_code().equals(StatusEnum.REGION_INFO.code("商用线5号线"))) {
|
||||
//物料组盘信息出库
|
||||
whereJson.put("type", "2");
|
||||
//处理组盘信息
|
||||
handleGroupPlate(whereJson);
|
||||
if (StringUtils.isNotBlank(pointDao.getIng_task_code())) {
|
||||
SchBaseTask schBaseTask = iSchBaseTaskService.getByCode(pointDao.getIng_task_code());
|
||||
SchBasePoint schBasePoint = iSchBasePointService.getOne(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getPoint_code, schBaseTask.getPoint_code1()));
|
||||
if (schBasePoint.getRegion_code().equals(StatusEnum.REGION_INFO.code("预装线货架区")) && StringUtils.isNotBlank(whereJson.getString("isAutoReturn"))) {
|
||||
String pointCode1 = whereJson.getString("startCode");
|
||||
String pointCode2 = whereJson.getString("siteCode");
|
||||
//自动获取终点回空载具
|
||||
if (BaseDataEnum.IS_YES_NOT.code("是").equals(whereJson.getString("isAutoReturn"))) {
|
||||
if (StringUtils.isBlank(pointCode1)) {
|
||||
SchBasePoint startPoint = iSchBasePointService.getOne(
|
||||
new LambdaQueryWrapper<SchBasePoint>()
|
||||
.eq(SchBasePoint::getVehicle_code, whereJson.getString("storagevehicle_code"))
|
||||
);
|
||||
pointCode1 = startPoint.getPoint_code();
|
||||
}
|
||||
List<SchBasePoint> cxPointLists = iSchBasePointService.checkEndPointTask(
|
||||
StatusEnum.REGION_INFO.code("预装线货架区"),
|
||||
IOSEnum.LOCK_TYPE.code("未锁定"),
|
||||
StatusEnum.SORT_TYPE.code("升序"), null, null, "true", false);
|
||||
//可放空料架位置
|
||||
cxPointLists = cxPointLists.stream().filter(r -> (StatusEnum.VEHICLE_TYPE.code("空载具").equals(r.getCan_vehicle_type()))).collect(Collectors.toList());
|
||||
if (ObjectUtils.isEmpty(cxPointLists)) {
|
||||
throw new BadRequestException("暂无可用放置空架的点位,请稍后再试。");
|
||||
}
|
||||
pointCode2 = cxPointLists.get(0).getPoint_code();
|
||||
}
|
||||
whereJson.put("pointCode", pointCode1);
|
||||
whereJson.put("siteCode", pointCode2);
|
||||
//生成任务
|
||||
SpringContextHolder.getBean(PdaIosOutServiceImpl.class).transferConfirm(whereJson);
|
||||
} else {
|
||||
//线边仓
|
||||
whereJson.put("qty", 1);
|
||||
String materialCode = StatusEnum.VEHICLE_TYPE.code("空货架");
|
||||
whereJson.put("material_id", materialCode);
|
||||
//组盘
|
||||
pdaIosInServiceImpl.groupPlate(whereJson);
|
||||
// 生成空载具入库任务
|
||||
whereJson.put("config_code", IOSConstant.VEHICLE_IN_TASK);
|
||||
whereJson.put("storagevehicle_code", whereJson.getString("storagevehicle_code"));
|
||||
//入库分配
|
||||
pdaIosInServiceImpl.divStructNoBills(whereJson);
|
||||
}
|
||||
}
|
||||
//自动送回空载具
|
||||
autoReturnEmptyVehicle(whereJson, pointDao);
|
||||
} else {
|
||||
handleGroupPlate(whereJson);
|
||||
//载具绑定到出库点
|
||||
iSchBasePointService.update(new SchBasePoint(), new LambdaUpdateWrapper<>(SchBasePoint.class)
|
||||
.set(SchBasePoint::getVehicle_code, whereJson.getString("storagevehicle_code"))
|
||||
@@ -712,6 +675,59 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
return PdaResponse.requestOk();
|
||||
}
|
||||
|
||||
private void autoReturnEmptyVehicle(JSONObject whereJson, SchBasePoint pointDao) {
|
||||
if (StringUtils.isNotBlank(pointDao.getIng_task_code())) {
|
||||
SchBaseTask schBaseTask = iSchBaseTaskService.getByCode(pointDao.getIng_task_code());
|
||||
SchBasePoint schBasePoint = iSchBasePointService.getOne(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getPoint_code, schBaseTask.getPoint_code1()));
|
||||
if (schBasePoint.getRegion_code().equals(StatusEnum.REGION_INFO.code("预装线货架区")) && StringUtils.isNotBlank(whereJson.getString("isAutoReturn"))) {
|
||||
String pointCode1 = whereJson.getString("startCode");
|
||||
String pointCode2 = whereJson.getString("siteCode");
|
||||
//自动获取终点回空载具
|
||||
if (BaseDataEnum.IS_YES_NOT.code("是").equals(whereJson.getString("isAutoReturn"))) {
|
||||
if (StringUtils.isBlank(pointCode1)) {
|
||||
SchBasePoint startPoint = iSchBasePointService.getOne(
|
||||
new LambdaQueryWrapper<SchBasePoint>()
|
||||
.eq(SchBasePoint::getVehicle_code, whereJson.getString("storagevehicle_code"))
|
||||
);
|
||||
pointCode1 = startPoint.getPoint_code();
|
||||
}
|
||||
List<SchBasePoint> cxPointLists = iSchBasePointService.checkEndPointTask(
|
||||
StatusEnum.REGION_INFO.code("预装线货架区"),
|
||||
IOSEnum.LOCK_TYPE.code("未锁定"),
|
||||
StatusEnum.SORT_TYPE.code("升序"), null, null, "true", false);
|
||||
//可放空料架位置
|
||||
cxPointLists = cxPointLists.stream().filter(r -> (StatusEnum.VEHICLE_TYPE.code("空载具").equals(r.getCan_vehicle_type()))).collect(Collectors.toList());
|
||||
if (ObjectUtils.isEmpty(cxPointLists)) {
|
||||
throw new BadRequestException("暂无可用放置空架的点位,请稍后再试。");
|
||||
}
|
||||
pointCode2 = cxPointLists.get(0).getPoint_code();
|
||||
}
|
||||
whereJson.put("pointCode", pointCode1);
|
||||
whereJson.put("siteCode", pointCode2);
|
||||
//生成任务
|
||||
SpringContextHolder.getBean(PdaIosOutServiceImpl.class).transferConfirm(whereJson);
|
||||
} else {
|
||||
//线边仓
|
||||
JSONArray dataArray = new JSONArray();
|
||||
JSONObject item = new JSONObject();
|
||||
String materialCode = StatusEnum.VEHICLE_TYPE.code("空货架");
|
||||
item.put("material_id", materialCode);
|
||||
item.put("qty", 1);
|
||||
dataArray.add(item);
|
||||
whereJson.put("data", dataArray);
|
||||
whereJson.put("qty", 1);
|
||||
whereJson.put("material_id", materialCode);
|
||||
//组盘
|
||||
pdaIosInServiceImpl.groupPlate(whereJson);
|
||||
// 生成空载具入库任务
|
||||
whereJson.put("config_code", IOSConstant.VEHICLE_IN_TASK);
|
||||
whereJson.put("storagevehicle_code", whereJson.getString("storagevehicle_code"));
|
||||
//入库分配
|
||||
pdaIosInServiceImpl.divStructNoBills(whereJson);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void handleGroupPlate(JSONObject whereJson) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
@@ -756,20 +772,54 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public PdaResponse transferConfirm(JSONObject whereJson) {
|
||||
String regionCode = whereJson.getString("region_code");
|
||||
//起点
|
||||
String pointCode1 = whereJson.getString("pointCode");
|
||||
String startPointCode = whereJson.getString("pointCode");
|
||||
//终点
|
||||
String endPointCode;
|
||||
//终点
|
||||
String pointCode2 = whereJson.getString("siteCode");
|
||||
//目标点位
|
||||
String regionCode = whereJson.getString("region_code");
|
||||
String vehicleCode = whereJson.getString("storagevehicle_code");
|
||||
if (StringUtils.isBlank(regionCode) && StringUtils.isBlank(pointCode2)) {
|
||||
throw new BadRequestException("请选择目标站点或区域!");
|
||||
//校验起点
|
||||
SchBasePoint point = iSchBasePointService.getOne(
|
||||
new LambdaQueryWrapper<SchBasePoint>()
|
||||
.eq(SchBasePoint::getPoint_code, startPointCode).eq(SchBasePoint::getIs_used, true));
|
||||
if (point == null) {
|
||||
throw new BadRequestException("起点点位:" + startPointCode + "不存在,请检查。");
|
||||
}
|
||||
//校验载具
|
||||
MdPbStoragevehicleinfo vehicleDao = iMdPbStoragevehicleinfoService.getByCode(vehicleCode);
|
||||
if (ObjectUtil.isEmpty(vehicleDao)) {
|
||||
throw new BadRequestException("不存在该载具号信息,请检查");
|
||||
}
|
||||
if (StringUtils.isBlank(regionCode) && StringUtils.isBlank(pointCode2)) {
|
||||
throw new BadRequestException("目标站点或区域请二选一!");
|
||||
}
|
||||
//库存校验
|
||||
if (whereJson.getString("isCheckIvt").equals(BaseDataEnum.IS_YES_NOT.code("是"))) {
|
||||
SchBasePoint vehiclePoint = iSchBasePointService.getOne(
|
||||
new LambdaQueryWrapper<SchBasePoint>()
|
||||
.eq(SchBasePoint::getVehicle_code, vehicleCode)
|
||||
);
|
||||
if (ObjectUtil.isEmpty(vehiclePoint)) {
|
||||
throw new BadRequestException("该点位不存在物料信息,请检查组盘信息");
|
||||
|
||||
}
|
||||
//自动解绑/绑定
|
||||
iSchBasePointService.update(new SchBasePoint(), new LambdaUpdateWrapper<>(SchBasePoint.class)
|
||||
.set(SchBasePoint::getVehicle_code, null)
|
||||
.set(SchBasePoint::getIng_task_code, null)
|
||||
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("无货"))
|
||||
.eq(SchBasePoint::getPoint_code, vehiclePoint.getPoint_code())
|
||||
);
|
||||
iSchBasePointService.update(new SchBasePoint(), new LambdaUpdateWrapper<>(SchBasePoint.class)
|
||||
.set(SchBasePoint::getVehicle_code, vehicleCode)
|
||||
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("有货"))
|
||||
.eq(SchBasePoint::getPoint_code, startPointCode)
|
||||
);
|
||||
}
|
||||
//终点为站点
|
||||
if (StringUtils.isNotBlank(pointCode2)) {
|
||||
SchBasePoint schBasePoint = iSchBasePointService.getOne(
|
||||
new LambdaQueryWrapper<SchBasePoint>()
|
||||
@@ -778,63 +828,25 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
if (schBasePoint == null) {
|
||||
throw new BadRequestException("输入终点点位有误或被禁用,请检查是否手动输入输错。");
|
||||
}
|
||||
}
|
||||
// 确定起点
|
||||
String startPointCode;
|
||||
SchBasePoint schBasePoint = iSchBasePointService.getOne(
|
||||
new LambdaQueryWrapper<SchBasePoint>()
|
||||
.eq(SchBasePoint::getVehicle_code, vehicleCode)
|
||||
);
|
||||
if (StringUtils.isBlank(pointCode1)) {
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) {
|
||||
throw new BadRequestException("未找到载具所在的点位信息,请检查");
|
||||
}
|
||||
startPointCode = schBasePoint.getPoint_code();
|
||||
endPointCode = pointCode2;
|
||||
} else {
|
||||
|
||||
SchBasePoint point = iSchBasePointService.getOne(
|
||||
new LambdaQueryWrapper<SchBasePoint>()
|
||||
.eq(SchBasePoint::getPoint_code, pointCode1).eq(SchBasePoint::getIs_used, true));
|
||||
if (point == null) {
|
||||
throw new BadRequestException("起点点位:" + pointCode1 + "不存在,请检查。");
|
||||
}
|
||||
//自动解绑/绑定
|
||||
if (schBasePoint != null) {
|
||||
iSchBasePointService.update(new SchBasePoint(), new LambdaUpdateWrapper<>(SchBasePoint.class)
|
||||
.set(SchBasePoint::getVehicle_code, null)
|
||||
.set(SchBasePoint::getIng_task_code, null)
|
||||
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("无货"))
|
||||
.eq(SchBasePoint::getPoint_code, schBasePoint.getPoint_code())
|
||||
);
|
||||
}
|
||||
iSchBasePointService.update(new SchBasePoint(), new LambdaUpdateWrapper<>(SchBasePoint.class)
|
||||
.set(SchBasePoint::getVehicle_code, vehicleCode)
|
||||
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("有货"))
|
||||
.eq(SchBasePoint::getPoint_code, pointCode1)
|
||||
);
|
||||
startPointCode = pointCode1;
|
||||
}
|
||||
// 确定终点
|
||||
String endPointCode = pointCode2;
|
||||
if (StringUtils.isBlank(endPointCode)) {
|
||||
List<SchBasePoint> pointList;
|
||||
//特殊分配规则
|
||||
if (regionCode.equals(StatusEnum.REGION_INFO.code("预装线货架区"))) {
|
||||
pointList = iSchBasePointService.checkEndPointTask(
|
||||
StatusEnum.REGION_INFO.code("预装线货架区"),
|
||||
IOSEnum.LOCK_TYPE.code("未锁定"),
|
||||
StatusEnum.SORT_TYPE.code("升序"), null, null, "true", false);
|
||||
//可放空料架位置
|
||||
pointList = pointList.stream().filter(r -> (StatusEnum.VEHICLE_TYPE.code("空载具").equals(r.getCan_vehicle_type()))).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(pointList)) {
|
||||
//入线边仓
|
||||
whereJson.put("stor_code",StatusEnum.STORE_INFO.code("料架线边库"));
|
||||
whereJson.put("sect_code","XB01");
|
||||
List<SchBasePoint> endPointList = getRegionPoint(regionCode);
|
||||
if (CollectionUtils.isEmpty(endPointList)) {
|
||||
//入线边仓
|
||||
if (regionCode.equals(StatusEnum.REGION_INFO.code("预装线货架区"))) {
|
||||
JSONArray dataArray = new JSONArray();
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("material_id", StatusEnum.VEHICLE_TYPE.code("空货架"));
|
||||
item.put("qty", 1);
|
||||
dataArray.add(item);
|
||||
whereJson.put("data", dataArray);
|
||||
whereJson.put("stor_code", StatusEnum.STORE_INFO.code("料架线边库"));
|
||||
whereJson.put("sect_code", "XB01");
|
||||
whereJson.put("material_id", StatusEnum.VEHICLE_TYPE.code("空货架"));
|
||||
whereJson.put("qty", 1);
|
||||
whereJson.put("site_code",startPointCode);
|
||||
whereJson.put("vehicle_code",vehicleCode);
|
||||
whereJson.put("is_auto_confirm",startPointCode);
|
||||
whereJson.put("site_code", startPointCode);
|
||||
whereJson.put("vehicle_code", vehicleCode);
|
||||
whereJson.put("is_auto_confirm", startPointCode);
|
||||
//组盘
|
||||
SpringContextHolder.getBean(PdaIosInServiceImpl.class).groupPlate(whereJson);
|
||||
//生成空载具入库任务
|
||||
@@ -842,21 +854,13 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
//入库分配
|
||||
SpringContextHolder.getBean(PdaIosInServiceImpl.class).divStructNoBills(whereJson);
|
||||
return PdaResponse.requestOk();
|
||||
}
|
||||
} else {
|
||||
pointList = iSchBasePointService.checkEndPointTask(
|
||||
regionCode,
|
||||
IOSEnum.LOCK_TYPE.code("未锁定"),
|
||||
StatusEnum.SORT_TYPE.code("升序"),
|
||||
null, null, "true", false
|
||||
);
|
||||
if (CollectionUtils.isEmpty(pointList)) {
|
||||
} else {
|
||||
throw new BadRequestException("暂无可用空位,请稍后再试。");
|
||||
}
|
||||
}
|
||||
endPointCode = pointList.get(0).getPoint_code();
|
||||
endPointCode = endPointList.get(0).getPoint_code();
|
||||
}
|
||||
// 生成转运任务
|
||||
//生成转运任务
|
||||
JSONObject task = new JSONObject();
|
||||
task.put("task_type", IOSConstant.PDA_POINT_TASK);
|
||||
task.put("config_code", IOSConstant.PDA_POINT_TASK);
|
||||
@@ -874,4 +878,30 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
);
|
||||
return PdaResponse.requestOk();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* regionCode 区域编号
|
||||
*/
|
||||
private List<SchBasePoint> getRegionPoint(String regionCode) {
|
||||
//终点为区域
|
||||
List<SchBasePoint> pointList;
|
||||
//特殊分配规则
|
||||
if (regionCode.equals(StatusEnum.REGION_INFO.code("预装线货架区"))) {
|
||||
pointList = iSchBasePointService.checkEndPointTask(
|
||||
StatusEnum.REGION_INFO.code("预装线货架区"),
|
||||
IOSEnum.LOCK_TYPE.code("未锁定"),
|
||||
StatusEnum.SORT_TYPE.code("升序"), null, null, "true", false);
|
||||
//可放空料架位置
|
||||
pointList = pointList.stream().filter(r -> (StatusEnum.VEHICLE_TYPE.code("空载具").equals(r.getCan_vehicle_type()))).collect(Collectors.toList());
|
||||
} else {
|
||||
pointList = iSchBasePointService.checkEndPointTask(
|
||||
regionCode,
|
||||
IOSEnum.LOCK_TYPE.code("未锁定"),
|
||||
StatusEnum.SORT_TYPE.code("降序"),
|
||||
null, null, "true", false
|
||||
);
|
||||
}
|
||||
return pointList;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,7 +4,11 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
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.conditions.update.UpdateWrapper;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
@@ -21,13 +25,22 @@ import org.nl.wms.sch_manage.service.util.AbstractTask;
|
||||
import org.nl.wms.sch_manage.service.util.AcsTaskDto;
|
||||
import org.nl.wms.sch_manage.service.util.TaskType;
|
||||
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.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.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.nl.wms.warehouse_management.enums.IOSEnum.GROUP_PLATE_STATUS;
|
||||
|
||||
/**
|
||||
* @Author: Liuxy
|
||||
@@ -43,6 +56,8 @@ public class BackInTask extends AbstractTask {
|
||||
*/
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
@Resource
|
||||
private IMdPbGroupplateService iMdPbGroupplateService;
|
||||
|
||||
/**
|
||||
* 点位服务
|
||||
@@ -55,7 +70,11 @@ public class BackInTask extends AbstractTask {
|
||||
*/
|
||||
@Autowired
|
||||
private IStructattrService iStructattrService;
|
||||
|
||||
/**
|
||||
* 组盘记录mapper
|
||||
*/
|
||||
@Autowired
|
||||
private MdPbGroupplateMapper mdPbGroupplateMapper;
|
||||
/**
|
||||
* 通用工具类
|
||||
*/
|
||||
@@ -168,6 +187,21 @@ public class BackInTask extends AbstractTask {
|
||||
.set(SchBasePoint::getVehicle_code, null)
|
||||
.set(SchBasePoint::getIos_id, null)
|
||||
);
|
||||
List<GroupPlate> plates = mdPbGroupplateMapper.selectList(
|
||||
new LambdaQueryWrapper<GroupPlate>()
|
||||
.eq(GroupPlate::getStoragevehicle_code, taskObj.getVehicle_code())
|
||||
.lt(GroupPlate::getStatus, GROUP_PLATE_STATUS.code("出库"))
|
||||
);
|
||||
//更新组盘信息
|
||||
if (CollectionUtils.isNotEmpty(plates)) {
|
||||
LambdaUpdateWrapper<GroupPlate> update = new LambdaUpdateWrapper<>();
|
||||
Set<String> plateCodes = plates.stream().map(GroupPlate::getGroup_id).collect(Collectors.toSet());
|
||||
update.set(GroupPlate::getStatus, GROUP_PLATE_STATUS.code("入库"))
|
||||
.set(GroupPlate::getUpdate_time,DateUtil.now())
|
||||
.set(GroupPlate::getCreate_time,DateUtil.now())
|
||||
.in(GroupPlate::getGroup_id, plateCodes);
|
||||
mdPbGroupplateMapper.update(null, update);
|
||||
}
|
||||
// 更新任务
|
||||
taskObj.setRemark("已完成");
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
|
||||
@@ -34,6 +34,8 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author: Liuxy
|
||||
@@ -99,7 +101,6 @@ public class PdaPointTask extends AbstractTask {
|
||||
@Override
|
||||
public AcsTaskDto sendAcsParam(String taskId) {
|
||||
SchBaseTask taskDao = taskService.getById(taskId);
|
||||
|
||||
// 组织下发给acs的数据
|
||||
AcsTaskDto acsTaskDto = new AcsTaskDto();
|
||||
acsTaskDto.setExt_task_uuid(taskDao.getTask_id());
|
||||
@@ -200,18 +201,18 @@ public class PdaPointTask extends AbstractTask {
|
||||
// .set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
// );
|
||||
//解冻
|
||||
GroupPlate plate = mdPbGroupplateMapper.selectOne(
|
||||
List<GroupPlate> plateList = mdPbGroupplateMapper.selectList(
|
||||
new LambdaQueryWrapper<GroupPlate>()
|
||||
.eq(GroupPlate::getStoragevehicle_code, taskObj.getVehicle_code())
|
||||
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
|
||||
);
|
||||
if (ObjectUtils.isNotEmpty(plate)) {
|
||||
if (ObjectUtils.isNotEmpty(plateList)) {
|
||||
mdPbGroupplateMapper.update(null, new LambdaUpdateWrapper<GroupPlate>()
|
||||
.set(GroupPlate::getFrozen_qty, BigDecimal.ZERO)
|
||||
.set(GroupPlate::getUpdate_time, DateUtil.now())
|
||||
.set(GroupPlate::getUpdate_optid, SecurityUtils.getCurrentUserId())
|
||||
.set(GroupPlate::getUpdate_optname, SecurityUtils.getCurrentNickName())
|
||||
.eq(GroupPlate::getGroup_id, plate.getGroup_id()));
|
||||
.in(GroupPlate::getGroup_id,plateList.stream().map(GroupPlate::getGroup_id).collect(Collectors.toSet())));
|
||||
}
|
||||
// 更新终点
|
||||
iSchBasePointService.update(new UpdateWrapper<SchBasePoint>().lambda()
|
||||
|
||||
@@ -24,7 +24,6 @@ import org.nl.wms.basedata_manage.enums.BaseDataEnum;
|
||||
import org.nl.wms.basedata_manage.service.IBsrealStorattrService;
|
||||
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.StructattrVechielDto;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper;
|
||||
import org.nl.wms.basedata_manage.service.dto.MdPbStoragevehicleextDto;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyStructMaterialVO;
|
||||
@@ -1219,6 +1218,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
|
||||
iStructattrService.updateStatusByCode("1", finish_map);
|
||||
//更新终点
|
||||
LambdaUpdateWrapper<SchBasePoint> wrapper = new LambdaUpdateWrapper<>();
|
||||
//针对非托盘物料,特殊场景需要自动出库确认并延迟解绑点位载具
|
||||
if (BaseDataEnum.IS_YES_NOT.code("是").equals(task.getIs_auto_confirm().toString())) {
|
||||
//整出
|
||||
GroupPlate plate = mdPbGroupplateMapper.selectOne(
|
||||
@@ -1236,12 +1236,14 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
|
||||
.set(GroupPlate::getUpdate_optname, SecurityUtils.getCurrentNickName())
|
||||
.eq(GroupPlate::getGroup_id, plate.getGroup_id()));
|
||||
}
|
||||
//延迟自动解绑点位载具
|
||||
wrapper.set(SchBasePoint::getIs_has_workder, BaseDataEnum.IS_YES_NOT.code("是"));
|
||||
} else {
|
||||
wrapper.set(SchBasePoint::getIs_has_workder, BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
}
|
||||
//绑定载具
|
||||
pdaIosOutService.bindOrUnbind(task.getPoint_code2(), task.getVehicle_code(), IOSEnum.BIND_OR_UNBIND.code("绑定"));
|
||||
pdaIosOutService.bindOrUnbind(task.getPoint_code2(), task.getVehicle_code(), IOSEnum.BIND_OR_UNBIND.code("绑定"),false);
|
||||
//是否处理单据及分配信息
|
||||
if (BaseDataEnum.IS_YES_NOT.code("是").equals(task.getHandle_status())) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
@@ -1263,7 +1265,6 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
|
||||
.storagevehicleCode(ioStorInvDis.getStoragevehicle_code())
|
||||
.structCode(ioStorInvDis.getStruct_code()).taskType(task.getConfig_code()).inBound(false).build();
|
||||
iStructattrService.changeStruct(changeDto);
|
||||
|
||||
int countDis = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getIostorinvdtl_id, ioStorInvDis.getIostorinvdtl_id())
|
||||
.ne(IOStorInvDis::getWork_status, IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
||||
|
||||
@@ -191,13 +191,11 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
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")));
|
||||
if (ObjectUtil.isNotEmpty(structattr)) {
|
||||
throw new BadRequestException("载具编码:" + row.get("storagevehicle_code") + "已存在库内,请对数据进行核实!");
|
||||
}
|
||||
|
||||
ioStorInvDtlMapper.insert(ioStorInvDtl.toJavaObject(IOStorInvDtl.class));
|
||||
JSONObject dis = new JSONObject();
|
||||
dis.put("iostorinvdis_id", IdUtil.getStringId());
|
||||
@@ -327,7 +325,7 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void divStruct(JSONObject param) {
|
||||
Assert.noNullElements(new Object[]{param.getString("stor_code"),param.getString("sect_code")},"参数异常");
|
||||
ArrayList<HashMap> rows = (ArrayList<HashMap>) param.get("tableMater");
|
||||
//ArrayList<HashMap> rows = (ArrayList<HashMap>) param.get("tableMater");
|
||||
JSONObject mst = JSONObject.parseObject(JSON.toJSONString(param));
|
||||
JSONObject map = param.getJSONObject("dis_row");
|
||||
String iostorinvId = map.getString("iostorinv_id");
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
height="100%"
|
||||
frameborder="0"
|
||||
allowfullscreen
|
||||
></iframe>
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -95,16 +95,16 @@ export default {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.init()
|
||||
this.monitor = window.setInterval(() => {
|
||||
setTimeout(() => {
|
||||
this.init()
|
||||
}, 2)
|
||||
}, 3500)
|
||||
},
|
||||
destroyed() {
|
||||
clearInterval(this.monitor)
|
||||
// this.init()
|
||||
// this.monitor = window.setInterval(() => {
|
||||
// setTimeout(() => {
|
||||
// this.init()
|
||||
// }, 2)
|
||||
// }, 3500)
|
||||
},
|
||||
// destroyed() {
|
||||
// clearInterval(this.monitor)
|
||||
// },
|
||||
methods: {
|
||||
init() {
|
||||
initData(this.url, {}).then(data => {
|
||||
|
||||
Reference in New Issue
Block a user