Browse Source

销售出库

psh
psh 1 year ago
parent
commit
fdeb374265
  1. 9
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/BPSLTask.java
  2. 129
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/XSCKTask.java
  3. 5
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ghs/GHSQHTask.java
  4. 4
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/mapper/PointMapper.java
  5. 10
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/mapper/PointMapper.xml
  6. 6
      lms/nladmin-system/nlsso-server/src/test/java/org/nl/ApplicationTest.java

9
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/BPSLTask.java

@ -73,9 +73,6 @@ public class BPSLTask extends AbstractTask {
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE));
for (SchBaseTask task : tasks) {
// 找起点
SchBasePoint nextPoint = pointService.getOne(new LambdaQueryWrapper<SchBasePoint>()
.eq(SchBasePoint::getPoint_code, task.getPoint_code2()));
String extGroupData = task.getExt_group_data();
JSONObject jsonObject = JSONObject.parseObject(extGroupData);
String materialType = jsonObject.getString("material_type");
@ -117,7 +114,7 @@ public class BPSLTask extends AbstractTask {
List<SchBasePoint> schBasePointList = pointMapper.findPointByRegion(regionCode,"2");
for(int i=schBasePointList.size()-1;i>=0;i--){
SchBasePoint schBasePoint=schBasePointList.get(i);
if (schBasePoint.getVehicle_qty()!=0
if (!"2".equals(schBasePoint.getPoint_type())&&schBasePoint.getVehicle_qty()!=0
&&ObjectUtil.isEmpty(schBasePoint.getIng_task_code())
&&(ObjectUtil.isEmpty(schBasePoint.getVehicle_type())||materialType.equals(schBasePoint.getVehicle_type()))){
log.info("包片上料任务找到当前符合条件的缓存区位置{}",schBasePoint.getPoint_code());
@ -128,7 +125,7 @@ public class BPSLTask extends AbstractTask {
}
/**
* 1.取货完毕后起点减少最后一份组盘并且该组盘视为已结束
* 1.取货完毕后起点减少最后一份组盘并且该组盘视为已结束
* 2.包片机LMS不记录点位信息由人工对组盘进行操作
*/
@Override
@ -183,6 +180,8 @@ public class BPSLTask extends AbstractTask {
startPointObj.setIng_task_code("");
startPointObj.setUpdate_time(DateUtil.now());
pointService.updateById(startPointObj);
//包片上料完毕后,整排打上记号只允许包片上料
pointMapper.updatePointType(endPointObj.getPoint_code().substring(0,endPointObj.getPoint_code().length()-2),"1");
// 任务完成
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
taskObj.setGroup_id(one.getGroup_id());

129
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/XSCKTask.java

@ -20,6 +20,7 @@ import org.nl.wms.sch.task.service.ISchBaseTaskconfigService;
import org.nl.wms.sch.task.service.dao.SchBaseTask;
import org.nl.wms.sch.task.service.dao.SchBaseTaskconfig;
import org.nl.wms.sch.task_manage.AbstractTask;
import org.nl.wms.sch.task_manage.GeneralDefinition;
import org.nl.wms.sch.task_manage.enums.GroupBindMaterialStatusEnum;
import org.nl.wms.sch.task_manage.enums.GroupStatusEnum;
import org.nl.wms.sch.task_manage.task.TaskType;
@ -66,17 +67,143 @@ public class XSCKTask extends AbstractTask {
@Override
// @Transactional(rollbackFor = Exception.class)
protected void create() throws BadRequestException {
// 获取任务
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
// 配置信息
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE));
for (SchBaseTask task : tasks) {
String extGroupData = task.getExt_group_data();
JSONObject jsonObject = JSONObject.parseObject(extGroupData);
String materialType = jsonObject.getString("material_type");
SchBasePoint point = findNextPoint(jsonObject);
if (ObjectUtil.isEmpty(point)) {
task.setRemark("未找到所需点位!");
taskService.update(task);
// 消息通知
log.info("销售出库未找到当前符合条件的点位materialType:{},", materialType);
continue;
}
// 设置起点并修改创建成功状态
task.setPoint_code1(point.getPoint_code());
task.setTask_status(TaskStatus.CREATED.getCode());
task.setRemark("");
taskService.update(task);
//发起任务时先把点位占用,防止发起重复任务
point.setIng_task_code(task.getTask_code());
point.setVehicle_qty(point.getVehicle_qty() - 1);
point.setVehicle_type(materialType);
pointService.update(point);
//下发
this.renotifyAcs(task);
}
}
private SchBasePoint findNextPoint(SchBasePoint startPoint) {
/**
* 判断目标点位
* 从10-1查找可以物料一致且有货的点位
*
* @param extGroupData
* @return
*/
private SchBasePoint findNextPoint(JSONObject extGroupData) {
String regionCode = "HCQ1";
String materialType = extGroupData.getString("material_type");
List<SchBasePoint> schBasePointList = pointMapper.findPointByRegion(regionCode,"2");
for(int i=schBasePointList.size()-1;i>=0;i--){
SchBasePoint schBasePoint=schBasePointList.get(i);
if (!"1".equals(schBasePoint.getPoint_type())&&schBasePoint.getVehicle_qty()!=0
&&ObjectUtil.isEmpty(schBasePoint.getIng_task_code())
&&(ObjectUtil.isEmpty(schBasePoint.getVehicle_type())||materialType.equals(schBasePoint.getVehicle_type()))){
log.info("销售出库任务找到当前符合条件的缓存区位置{}",schBasePoint.getPoint_code());
return schBasePoint;
}
}
return null;
}
/**
* 1.取货完毕后起点减少最后一份组盘并且该组盘视为已结束
* 2.销售出库LMS不记录点位信息由人工对组盘进行操作
*/
@Override
// @Transactional(rollbackFor = Exception.class)
protected void updateStatus(String task_code, TaskStatus status) {
// 校验任务
SchBaseTask taskObj = taskService.getById(task_code);
if (taskObj.getTask_status().equals(TaskStatus.FINISHED.getCode())) {
throw new BadRequestException("该任务已完成!");
}
if (taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) {
throw new BadRequestException("该任务已取消!");
}
String startPoint = taskObj.getPoint_code1(); // 获取起点
String endPoint = taskObj.getPoint_code2(); // 获取终点
SchBasePoint startPointObj = pointService.getById(startPoint);
SchBasePoint endPointObj = pointService.getById(endPoint);
// 根据传来的类型去对任务进行操作
if (status.equals(TaskStatus.EXECUTING)) { // 执行中
taskObj.setTask_status(TaskStatus.EXECUTING.getCode());
taskObj.setRemark("执行中");
}
if (status.equals(TaskStatus.FINISHED)) { // 完成
List<String> vehicleCodeList = Arrays.stream(startPointObj.getVehicle_code().split(",")).collect(Collectors.toList());
String vehicleCode=vehicleCodeList.get(vehicleCodeList.size()-1);
SchBaseVehiclematerialgroup one = vehiclematerialgroupService.getOne(new LambdaQueryWrapper<SchBaseVehiclematerialgroup>()
.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicleCode)
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status,
GroupBindMaterialStatusEnum.BOUND.getValue()));
if (ObjectUtil.isEmpty(one)) {
throw new BadRequestException(vehicleCode + " => " + startPointObj.getVehicle_type() + "的组盘信息未找到");
}
one.setTask_code(taskObj.getTask_code());
one.setPoint_code(endPointObj.getPoint_code()); // 当前位置
one.setPoint_name(endPointObj.getPoint_name());
one.setMove_way(one.getMove_way()==null?"":(one.getMove_way() + " -> ") + endPointObj.getPoint_code());
one.setGroup_bind_material_status(GroupBindMaterialStatusEnum.UNBOUND.getValue());
one.setUpdate_id(GeneralDefinition.ACS_ID);
one.setUpdate_name(GeneralDefinition.ACS_NAME);
one.setUpdate_time(DateUtil.now());
vehiclematerialgroupService.updateById(one);
// 起点清空
if (vehicleCodeList.size()==1) {
startPointObj.setVehicle_code("");
}else{
StringBuilder vehicle_code=new StringBuilder();
for(int i=0;i<=vehicleCodeList.size()-2;i++){
vehicle_code.append(vehicleCodeList.get(i)).append(',');
}
startPointObj.setVehicle_code(vehicle_code.toString());
}
startPointObj.setIng_task_code("");
startPointObj.setUpdate_time(DateUtil.now());
pointService.updateById(startPointObj);
//销售出库完毕后,整排打上记号只允许销售出库
pointMapper.updatePointType(endPointObj.getPoint_code().substring(0,endPointObj.getPoint_code().length()-2),"2");
// 任务完成
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
taskObj.setGroup_id(one.getGroup_id());
taskObj.setRemark("任务完成");
}
if (status.equals(TaskStatus.CANCELED)) { // 取消
// 终点解锁
if (ObjectUtil.isNotEmpty(endPointObj)) {
endPointObj.setIng_task_code("");
pointService.update(endPointObj);
}
// 起点解锁
if (ObjectUtil.isNotEmpty(startPointObj)) {
startPointObj.setIng_task_code("");
startPointObj.setVehicle_qty(startPointObj.getVehicle_qty()+1);
pointService.update(endPointObj);
}
taskObj.setRemark("任务取消");
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
}
taskService.update(taskObj);
}
@Override

5
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ghs/GHSQHTask.java

@ -186,6 +186,9 @@ public class GHSQHTask extends AbstractTask {
temp=tempPoint;
}
}
if(temp==null){
continue;
}
log.info("固化室取货任务找到当前符合条件的缓存区位置{}",schBasePoint.getPoint_code());
return temp;
}
@ -226,6 +229,8 @@ public class GHSQHTask extends AbstractTask {
endPointObj.setVehicle_qty(startPointObj.getVehicle_qty());
endPointObj.setUpdate_time(DateUtil.now());
pointService.update(endPointObj);
//固化室放料完毕后,将当前一整排都标记上物料信息,防止出现混放情况
pointMapper.updateVehicleType(endPointObj.getPoint_code().substring(0,endPointObj.getPoint_code().length()-2),endPointObj.getVehicle_type());
List<String> vehicleCodeList = Arrays.stream(startPointObj.getVehicle_code().split(",")).collect(Collectors.toList());
for(String vehicleCode:vehicleCodeList) {
SchBaseVehiclematerialgroup one = vehiclematerialgroupService.getOne(new LambdaQueryWrapper<SchBaseVehiclematerialgroup>()

4
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/mapper/PointMapper.java

@ -16,5 +16,7 @@ public interface PointMapper {
List<SchBasePoint> findPointByParentPoint(String pointCode);
void updatePointStatus(String device_code,String state);
List<SchBasePoint> findPointForYZSL(JSONObject param);
void updateVehicleType(String device_code,String vehicle_type);
void updatePointType(String device_code,String point_type);
}

10
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/mapper/PointMapper.xml

@ -24,4 +24,14 @@
update sch_base_point set point_status = #{state}
where point_code like CONCAT('%', #{device_code}, '%')
</update>
<update id="updateVehicleType">
update sch_base_point set vehicle_type = #{vehicle_type}
where point_code like CONCAT('%', #{device_code}, '%')
</update>
<update id="updatePointType">
update sch_base_point set point_type = #{point_type}
where point_code like CONCAT('%', #{device_code}, '%')
</update>
</mapper>

6
lms/nladmin-system/nlsso-server/src/test/java/org/nl/ApplicationTest.java

@ -28,8 +28,8 @@ public class ApplicationTest {
}
@Test
void yzMapperTest() {
List<SchBasePoint> pointForYZSL = yzMapper.findPointForYZSL(new JSONObject(
MapOf.of("regionCode", "HCSSX", "pointType", "1")));
System.out.println(pointForYZSL);
// List<SchBasePoint> pointForYZSL = yzMapper.findPointForYZSL(new JSONObject(
// MapOf.of("regionCode", "HCSSX", "pointType", "1")));
// System.out.println(pointForYZSL);
}
}

Loading…
Cancel
Save