feat: 点位取货、剩料回库
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package org.nl.wms.decision_manage.service.decisioner.impl.base;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.wms.basedata_manage.service.dto.MdPbStoragevehicleextDto;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyStructParam;
|
||||
import org.nl.wms.decision_manage.service.decisioner.Decisioner;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 托盘最小批号、拆包入库的组盘时间默认
|
||||
* @Author: lyd
|
||||
* @Date: 2025/12/2
|
||||
*/
|
||||
//@Service("minPcsn")
|
||||
//@Slf4j
|
||||
//public class MinPcsnRuleHandler extends Decisioner<MdPbStoragevehicleextDto, StrategyStructParam> {
|
||||
// @Override
|
||||
// public List<MdPbStoragevehicleextDto> handler(List<MdPbStoragevehicleextDto> list, StrategyStructParam param) {
|
||||
// log.info("---------执行托盘最小批号出库分配规则---------");
|
||||
// list.sort(Comparator.comparing(
|
||||
// MdPbStoragevehicleextDto::getPcsn,
|
||||
// Comparator.nullsFirst(Comparator.naturalOrder())
|
||||
// ));
|
||||
// return list;
|
||||
// }
|
||||
//}
|
||||
@@ -41,10 +41,37 @@ public class PdaProductionController {
|
||||
public ResponseEntity<Object> confirmCallMaterial(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(pdaProductionService.confirmCallMaterial(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getPalletAssemblyOK")
|
||||
@Log("点位取货-获取组盘完成的袋号数据")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> getPalletAssemblyOK(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(pdaProductionService.getPalletAssemblyOK(whereJson), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/takePalletMaterial")
|
||||
@Log("点位取货-取物料")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> takePalletMaterial(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(pdaProductionService.takePalletMaterial(whereJson), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/takeTheVehicle")
|
||||
@Log("点位取货-取载具")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> takeTheVehicle(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(pdaProductionService.takeTheVehicle(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getGroupInfo")
|
||||
@Log("剩料回库-获取物料信息")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> getGroupInfo(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(pdaProductionService.getGroupInfo(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/leftoverMaterialBack")
|
||||
@Log("剩料回库-回库")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> leftoverMaterialBack(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(pdaProductionService.leftoverMaterialBack(whereJson), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,4 +23,32 @@ public interface PdaProductionService {
|
||||
PdaResponse getStockGroupInfo(JSONObject param);
|
||||
|
||||
PdaResponse confirmCallMaterial(JSONObject param);
|
||||
|
||||
/**
|
||||
* 获取组盘完成的袋号数据
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
PdaResponse getPalletAssemblyOK(JSONObject param);
|
||||
|
||||
/**
|
||||
* 取料
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
PdaResponse takePalletMaterial(JSONObject param);
|
||||
|
||||
/**
|
||||
* 取托盘
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
PdaResponse takeTheVehicle(JSONObject param);
|
||||
|
||||
/**
|
||||
* 剩料回库
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
PdaResponse leftoverMaterialBack(JSONObject param);
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ public class PdaCommonServiceImpl implements PdaCommonService {
|
||||
|
||||
@Override
|
||||
public PdaResponse confirmPalletAssembly(AssemblyPalletParam param) {
|
||||
// storagevehicleinfoService.getByCode(param.getVehicle_code());
|
||||
storagevehicleinfoService.getByCode(param.getVehicle_code());
|
||||
List<GroupPlate> groupPlates = param.getGroup_plates();
|
||||
for (GroupPlate groupPlate : groupPlates) {
|
||||
groupPlate.setVehicle_code(param.getVehicle_code());
|
||||
|
||||
@@ -54,7 +54,7 @@ public class PdaPreTreatmentServiceImpl implements PdaPreTreatmentService {
|
||||
if (ObjectUtil.isEmpty(search)) {
|
||||
throw new BadRequestException("请输入袋号编码!");
|
||||
}
|
||||
List<JSONObject> groups = groupplateService.getPalletView(search);
|
||||
List<JSONObject> groups = groupplateService.getPalletView(search, "0");
|
||||
if (groups.size() != 1) {
|
||||
throw new BadRequestException(groups.size() == 0 ? "组袋记录不存在,请先组袋!" : "组袋记录信息有误,请查询并清理后重试!");
|
||||
}
|
||||
|
||||
@@ -1,10 +1,21 @@
|
||||
package org.nl.wms.pda.general_management.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
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;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleextService;
|
||||
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleinfoService;
|
||||
import org.nl.wms.basedata_manage.service.ISectattrService;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleext;
|
||||
import org.nl.wms.basedata_manage.service.dao.Sectattr;
|
||||
import org.nl.wms.pda.general_management.service.PdaBuildParamService;
|
||||
import org.nl.wms.pda.general_management.service.PdaPreTreatmentService;
|
||||
@@ -15,11 +26,17 @@ import org.nl.wms.sch_manage.service.dao.SchBasePoint;
|
||||
import org.nl.wms.warehouse_management.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_management.service.IMdPbGroupplateService;
|
||||
import org.nl.wms.warehouse_management.service.IOutBillService;
|
||||
import org.nl.wms.warehouse_management.service.IRawAssistIStorService;
|
||||
import org.nl.wms.warehouse_management.service.VehicleInService;
|
||||
import org.nl.wms.warehouse_management.service.dao.GroupPlate;
|
||||
import org.springframework.stereotype.Service;
|
||||
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.Map;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
@@ -40,6 +57,14 @@ public class PdaProductionServiceImpl implements PdaProductionService {
|
||||
private IOutBillService outBillService;
|
||||
@Resource
|
||||
private PdaBuildParamService defaultPdaBuildParam;
|
||||
@Resource
|
||||
private IMdPbStoragevehicleinfoService storagevehicleinfoService;
|
||||
@Resource
|
||||
private IMdPbStoragevehicleextService storagevehicleextService;
|
||||
@Resource
|
||||
private VehicleInService vehicleInService;
|
||||
@Resource
|
||||
private IRawAssistIStorService rawAssistIStorService;
|
||||
@Override
|
||||
public PdaResponse getGroupInfo(JSONObject param) {
|
||||
// search;
|
||||
@@ -101,4 +126,129 @@ public class PdaProductionServiceImpl implements PdaProductionService {
|
||||
outBillService.allSetPoint(jsonMst);
|
||||
return PdaResponse.requestOk("呼叫成功!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdaResponse getPalletAssemblyOK(JSONObject param) {
|
||||
String search = param.getString("search");
|
||||
if (ObjectUtil.isEmpty(search)) {
|
||||
throw new BadRequestException("请输入袋号编码!");
|
||||
}
|
||||
List<JSONObject> groups = groupplateService.getPalletView(search, "1");
|
||||
if (groups.size() != 1) {
|
||||
throw new BadRequestException(groups.size() == 0 ? "组袋记录不存在,请先组袋!" : "组袋记录信息有误,请查询并清理后重试!");
|
||||
}
|
||||
JSONObject object = groups.get(0);
|
||||
if (ObjectUtil.isEmpty(object.getString("vehicle_code"))) {
|
||||
throw new BadRequestException("该袋未组盘,请先组盘!");
|
||||
}
|
||||
return PdaResponse.requestParamOk(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public PdaResponse takePalletMaterial(JSONObject param) {
|
||||
log.info("手持取物料: {}", param);
|
||||
// search、rows
|
||||
String search = param.getString("search");
|
||||
// SchBasePoint point = pointService.getByPointCode(search, false);
|
||||
// if (ObjectUtil.isNotEmpty(point)) {
|
||||
// search = point.getVehicle_code();
|
||||
// }
|
||||
if (ObjectUtil.isEmpty(search)) {
|
||||
throw new BadRequestException("载具号不能为空!");
|
||||
}
|
||||
storagevehicleinfoService.getByCode(search);
|
||||
JSONArray rows = param.getJSONArray("rows");
|
||||
List<GroupPlate> needAddOrUpdGroups = new ArrayList<>();
|
||||
List<String> needDelGroups = new ArrayList<>();
|
||||
BigDecimal whileSub = new BigDecimal("0");
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject row = rows.getJSONObject(i);
|
||||
GroupPlate delGroup = groupplateService.getById(row.getString("group_id"));
|
||||
GroupPlate groupPlate = JSON.parseObject(row.toJSONString(), GroupPlate.class);
|
||||
// groupPlate.setGroup_id(IdUtil.getStringId());
|
||||
// groupPlate.setVehicle_code("");
|
||||
// groupPlate.setStatus("0");
|
||||
// groupPlate.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
// groupPlate.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
// groupPlate.setCreate_time(DateUtil.now());
|
||||
// needAddOrUpdGroups.add(groupPlate);
|
||||
// 其他需要删除
|
||||
delGroup.setQty(delGroup.getQty().subtract(groupPlate.getQty()));
|
||||
if (delGroup.getQty().equals(new BigDecimal("0"))) {
|
||||
needDelGroups.add(delGroup.getGroup_id());
|
||||
} else {
|
||||
needAddOrUpdGroups.add(delGroup);
|
||||
}
|
||||
whileSub.add(groupPlate.getQty());
|
||||
}
|
||||
groupplateService.saveOrUpdateBatch(needAddOrUpdGroups);
|
||||
groupplateService.removeByIds(needDelGroups);
|
||||
// 托盘数量修改
|
||||
MdPbStoragevehicleext vehicleObj = storagevehicleextService.getOne(new LambdaQueryWrapper<MdPbStoragevehicleext>()
|
||||
.eq(MdPbStoragevehicleext::getStoragevehicle_code, rows.getJSONObject(0).getString("vehicle_code")));
|
||||
vehicleObj.setCanuse_qty(vehicleObj.getCanuse_qty().subtract(whileSub));
|
||||
vehicleObj.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
vehicleObj.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
vehicleObj.setUpdate_time(DateUtil.now());
|
||||
storagevehicleextService.updateById(vehicleObj);
|
||||
return PdaResponse.requestOk("取料成功!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdaResponse takeTheVehicle(JSONObject param) {
|
||||
// search
|
||||
String search = param.getString("search");
|
||||
SchBasePoint point = pointService.getByPointCode(search, false);
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
throw new BadRequestException("请扫点位!");
|
||||
}
|
||||
point.setVehicle_code("");
|
||||
point.setPoint_status(IOSEnum.POINT_STATUS.code("空位"));
|
||||
point.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
point.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
point.setUpdate_time(DateUtil.now());
|
||||
pointService.updateById(point);
|
||||
return PdaResponse.requestOk("取载具成功!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdaResponse leftoverMaterialBack(JSONObject param) {
|
||||
// search, rows
|
||||
String search = param.getString("search");
|
||||
SchBasePoint startPoint = pointService.getByPointCode(search, false);
|
||||
if (ObjectUtil.isEmpty(startPoint)) {
|
||||
throw new BadRequestException("请扫点位!");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(startPoint.getVehicle_code())) {
|
||||
throw new BadRequestException("该点位没有载具信息!");
|
||||
}
|
||||
List<GroupPlate> list = groupplateService.list(new LambdaQueryWrapper<GroupPlate>()
|
||||
.eq(GroupPlate::getVehicle_code, search)
|
||||
.ne(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库")));
|
||||
if (list.size() > 0) {
|
||||
log.info("剩料回库");
|
||||
// 剩料回库
|
||||
Sectattr sectattr = sectattrService.findByCode(startPoint.getIn_sect(), false);
|
||||
param.put("bill_type", IOSEnum.IN_BILL_TYPE.code("剩料回库"));
|
||||
// 1 创建入库单、明细、分配明细
|
||||
Map<String, Object> invObj = defaultPdaBuildParam.doBuildInvObj(param, startPoint, sectattr);
|
||||
String invId = rawAssistIStorService.insertDtl(invObj);
|
||||
// 2 调用分配
|
||||
Map<String, Object> divObj = defaultPdaBuildParam.buildDivStructData(param, sectattr, invId);
|
||||
rawAssistIStorService.divStruct(divObj);
|
||||
// 3 创建任务
|
||||
Map<String, Object> jsonMst = defaultPdaBuildParam.buildTaskData(startPoint, invId);
|
||||
rawAssistIStorService.divPoint(jsonMst);
|
||||
} else {
|
||||
log.info("空载具回库");
|
||||
// 空载具回库
|
||||
JSONObject vin = new JSONObject();
|
||||
vin.put("storagevehicle_code", search);
|
||||
vin.put("sect_code", startPoint.getIn_sect());
|
||||
vin.put("point_code", startPoint.getPoint_code());
|
||||
vehicleInService.create(vin);
|
||||
}
|
||||
return PdaResponse.requestOk();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,8 @@ public enum IOSEnum {
|
||||
|
||||
// 入库业务类型
|
||||
IN_BILL_TYPE(MapOf.of( "手工入库", "0009",
|
||||
"原辅料入库", "0001"
|
||||
"原辅料入库", "0001",
|
||||
"剩料回库", "0002"
|
||||
)),
|
||||
|
||||
// 出库业务类型
|
||||
@@ -48,7 +49,7 @@ public enum IOSEnum {
|
||||
|
||||
// 入库任务配置类编码
|
||||
IN_CONFIG_CODE(MapOf.of("0009", "HandInTask",
|
||||
"0001", "RawInTask"
|
||||
"0001", "RawInTask", "0002", "RawInTask"
|
||||
)),
|
||||
|
||||
// 出库任务配置类编码
|
||||
|
||||
@@ -95,7 +95,7 @@ public interface IMdPbGroupplateService extends IService<GroupPlate> {
|
||||
*/
|
||||
List<GroupPlate> getByBagNo(String bagNo, String status);
|
||||
|
||||
List<JSONObject> getPalletView(String search);
|
||||
List<JSONObject> getPalletView(String search, String status);
|
||||
|
||||
List<JSONObject> getPalletViewByVehicleCode(String search);
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ public interface MdPbGroupplateMapper extends BaseMapper<GroupPlate> {
|
||||
*/
|
||||
List<JSONObject> pdaGetPointDtl(@Param("param") JSONObject whereJson);
|
||||
|
||||
List<JSONObject> getPalletView(String search);
|
||||
List<JSONObject> getPalletView(String search, String status);
|
||||
|
||||
List<JSONObject> getPalletViewByVehicleCode(String search);
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@
|
||||
`md_pb_groupplate` g
|
||||
LEFT JOIN md_me_materialbase m ON m.material_id = g.material_id
|
||||
LEFT JOIN md_cs_supplierbase s ON s.supp_code = g.supp_code
|
||||
WHERE g.bag_code = #{search} AND g.`status` = '0'
|
||||
WHERE g.bag_code = #{search} AND g.`status` = #{status}
|
||||
</select>
|
||||
<select id="getPalletViewByVehicleCode" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
|
||||
@@ -190,8 +190,8 @@ public class MdPbGroupplateServiceImpl extends ServiceImpl<MdPbGroupplateMapper,
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> getPalletView(String search) {
|
||||
return this.baseMapper.getPalletView(search);
|
||||
public List<JSONObject> getPalletView(String search, String status) {
|
||||
return this.baseMapper.getPalletView(search, status);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user