rev: 代码错乱修改
This commit is contained in:
@@ -72,10 +72,10 @@ public class SectattrController {
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getSect")
|
||||
@PostMapping("/getSect")
|
||||
@Log("查询库区下拉框")
|
||||
@ApiOperation("查询库区下拉框")
|
||||
public ResponseEntity<Object> querySect(@RequestBody(required = false) JSONObject query) {
|
||||
public ResponseEntity<Object> querySect(@RequestBody JSONObject query) {
|
||||
List<Map> list = isectattrService.getSect(query);
|
||||
return new ResponseEntity<>(TableDataInfo.build(list), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
@@ -18,6 +19,7 @@ import java.util.Date;
|
||||
* @since 2023-05-04
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("st_ivt_structattr")
|
||||
public class StIvtStructattr implements Serializable {
|
||||
|
||||
@@ -120,7 +120,7 @@ public class StIvtSectattrServiceImpl extends ServiceImpl<StIvtSectattrMapper, S
|
||||
List sect_ja = new ArrayList<>();
|
||||
for (Map<String, String> map : sectList) {
|
||||
Map sect_cas = new HashMap<>();
|
||||
sect_cas.put("value", map.get("sect_id"));
|
||||
sect_cas.put("value", String.valueOf(map.get("sect_id")));
|
||||
sect_cas.put("label", map.get("sect_name"));
|
||||
sect_ja.add(sect_cas);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.Date;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -17,6 +18,7 @@ import lombok.EqualsAndHashCode;
|
||||
* @since 2023-05-11
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("sch_base_task")
|
||||
public class SchBaseTask implements Serializable {
|
||||
|
||||
@@ -98,4 +98,28 @@ public class IStivtlostorivnCpInController {
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/unDivStruct")
|
||||
@Log("取消分配")
|
||||
@ApiOperation("取消分配")
|
||||
public ResponseEntity<Object> unDivStruct(@RequestBody JSONObject whereJson){
|
||||
iStIvtIostorinvCpService.unDivStruct(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/setPoint")
|
||||
@Log("设置起点")
|
||||
@ApiOperation("设置起点")
|
||||
public ResponseEntity<Object> setPoint(@RequestBody JSONObject whereJson){
|
||||
iStIvtIostorinvCpService.setPoint(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/confirm")
|
||||
@Log("强制确认")
|
||||
@ApiOperation("强制确认")
|
||||
public ResponseEntity<Object> confirm(@RequestBody JSONObject whereJson){
|
||||
iStIvtIostorinvCpService.confirm(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -117,4 +117,31 @@ public interface IStIvtIostorinvCpService extends IService<StIvtIostorinvCp> {
|
||||
* }
|
||||
*/
|
||||
void divStruct(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 取消分配
|
||||
* @param whereJson
|
||||
* {
|
||||
* 分配明细
|
||||
* }
|
||||
*/
|
||||
void unDivStruct(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 设置起点
|
||||
* @param whereJson
|
||||
* {
|
||||
* 分配明细
|
||||
* }
|
||||
*/
|
||||
void setPoint(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 强制确认
|
||||
* @param whereJson
|
||||
* {
|
||||
* "iostorinv_id": 主表标识
|
||||
* }
|
||||
*/
|
||||
void confirm(JSONObject whereJson);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.storage_manage.productmanage.service.iostorInv.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -27,6 +28,7 @@ public class StIvtIostorinvdisCp implements Serializable {
|
||||
/**
|
||||
* 出入单分配标识
|
||||
*/
|
||||
@TableId
|
||||
private String iostorinvdis_id;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.storage_manage.productmanage.service.iostorInv.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
import lombok.experimental.Accessors;
|
||||
@@ -25,6 +26,7 @@ public class StIvtIostorinvdtlCp implements Serializable {
|
||||
/**
|
||||
* 出入单明细标识
|
||||
*/
|
||||
@TableId
|
||||
private String iostorinvdtl_id;
|
||||
|
||||
/**
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
AND mst.bill_code =#{bill_code}
|
||||
</if>
|
||||
<if test="iostorinv_id != null and iostorinv_id != ''">
|
||||
AND mst.bill_code =#{iostorinv_id}
|
||||
AND mst.iostorinv_id =#{iostorinv_id}
|
||||
</if>
|
||||
order by dtl.seq_no ASC
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package org.nl.wms.storage_manage.productmanage.service.iostorInv.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -11,6 +13,8 @@ import io.jsonwebtoken.lang.Assert;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.publish.BussEventMulticaster;
|
||||
import org.nl.common.publish.event.PointEvent;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
@@ -23,7 +27,15 @@ import org.nl.wms.masterdata_manage.storage.service.storage.IStIvtBsrealstorattr
|
||||
import org.nl.wms.masterdata_manage.storage.service.storage.IStIvtStructattrService;
|
||||
import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtBsrealstorattr;
|
||||
import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtStructattr;
|
||||
import org.nl.wms.product_manage.sch.manage.TaskStatusEnum;
|
||||
import org.nl.wms.scheduler_manage.service.point.ISchBasePointService;
|
||||
import org.nl.wms.scheduler_manage.service.point.dao.SchBasePoint;
|
||||
import org.nl.wms.scheduler_manage.service.task.ISchBaseTaskService;
|
||||
import org.nl.wms.scheduler_manage.service.task.dao.SchBaseTask;
|
||||
import org.nl.wms.storage_manage.CHANGE_BILL_TYPE_ENUM;
|
||||
import org.nl.wms.storage_manage.IOSEnum;
|
||||
import org.nl.wms.storage_manage.basedata.service.record.dto.StIvtStructivtflowDto;
|
||||
import org.nl.wms.storage_manage.basedata.service.record.service.IStIvtStructivtflowService;
|
||||
import org.nl.wms.storage_manage.productmanage.service.iostorInv.IStIvtIostorinvCpService;
|
||||
import org.nl.wms.storage_manage.productmanage.service.iostorInv.IStIvtIostorinvdisCpService;
|
||||
import org.nl.wms.storage_manage.productmanage.service.iostorInv.IStIvtIostorinvdisdtlCpService;
|
||||
@@ -41,7 +53,10 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -79,6 +94,14 @@ public class StIvtIostorinvCpServiceImpl extends ServiceImpl<StIvtIostorinvCpMap
|
||||
@Autowired
|
||||
protected IStIvtStructattrService iStIvtStructattrService; // 仓位属性服务
|
||||
|
||||
@Autowired
|
||||
private IStIvtStructivtflowService structivtflowService; // 仓位变动记录服务
|
||||
|
||||
@Autowired
|
||||
private ISchBaseTaskService iSchBaseTaskService; // 任务表服务
|
||||
|
||||
@Autowired
|
||||
private ISchBasePointService iSchBasePointService; // 点位服务
|
||||
|
||||
@Override
|
||||
public Object pageQuery(IostorInvQuery query, PageQuery page) {
|
||||
@@ -321,6 +344,10 @@ public class StIvtIostorinvCpServiceImpl extends ServiceImpl<StIvtIostorinvCpMap
|
||||
6.更新库存、日物流表等、
|
||||
*/
|
||||
|
||||
// 判断是否已分配
|
||||
StIvtIostorinvdisCp disDao = iostorinvdisCpService.getOne(new QueryWrapper<StIvtIostorinvdisCp>().lambda()
|
||||
.eq(StIvtIostorinvdisCp::getIostorinvdis_id, whereJson.getString("iostorinvdis_id")));
|
||||
if (ObjectUtil.isNotEmpty(disDao.getStruct_code())) throw new BadRequestException("此明细已分配");
|
||||
|
||||
String struct_id = whereJson.getString("struct_id");
|
||||
StIvtStructattr attrDao = new StIvtStructattr();
|
||||
@@ -359,6 +386,196 @@ public class StIvtIostorinvCpServiceImpl extends ServiceImpl<StIvtIostorinvCpMap
|
||||
// TODO 更新库存、物流等
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void unDivStruct(JSONObject whereJson) {
|
||||
/*
|
||||
将分配下的所有分配明细取消
|
||||
*/
|
||||
// 1.校验是否已生成任务并已经下发
|
||||
StIvtIostorinvdisCp disDao = iostorinvdisCpService.getOne(
|
||||
new QueryWrapper<StIvtIostorinvdisCp>().lambda()
|
||||
.eq(StIvtIostorinvdisCp::getIostorinvdis_id, whereJson.getString("iostorinvdis_id"))
|
||||
);
|
||||
if (ObjectUtil.isEmpty(disDao)) throw new BadRequestException("分配明细不存在!");
|
||||
|
||||
|
||||
SchBaseTask taskDao = iSchBaseTaskService.getOne(
|
||||
new QueryWrapper<SchBaseTask>().lambda()
|
||||
.eq(SchBaseTask::getTask_id, disDao.getTask_id())
|
||||
.gt(SchBaseTask::getTask_status, TaskStatusEnum.START_AND_POINT.getCode())
|
||||
);
|
||||
if (ObjectUtil.isNotEmpty(taskDao)) throw new BadRequestException("任务已下发,不可取消!");
|
||||
|
||||
// 2.更新分配明细
|
||||
iStIvtIostorinvdisdtlCpService.update(
|
||||
new StIvtIostorinvdisdtlCp()
|
||||
.setStruct_name("")
|
||||
.setStruct_code("")
|
||||
.setStruct_id("")
|
||||
.setSect_id("")
|
||||
.setSect_code("")
|
||||
.setSect_name(""),
|
||||
new QueryWrapper<StIvtIostorinvdisdtlCp>().lambda()
|
||||
.eq(StIvtIostorinvdisdtlCp::getIostorinvdis_id,disDao.getIostorinvdis_id())
|
||||
);
|
||||
|
||||
// 3.更新任务
|
||||
iSchBaseTaskService.update(
|
||||
new SchBaseTask().setIs_delete(true),
|
||||
new QueryWrapper<SchBaseTask>().lambda()
|
||||
.eq(SchBaseTask::getTask_id, disDao.getTask_id())
|
||||
.lt(SchBaseTask::getTask_status, TaskStatusEnum.ISSUE.getCode())
|
||||
);
|
||||
|
||||
// 解锁货位
|
||||
iStIvtStructattrService.update(
|
||||
new StIvtStructattr()
|
||||
.setLock_type("1") // TODO 暂时写死
|
||||
.setInv_code("")
|
||||
.setInv_type("")
|
||||
.setInv_id(""),
|
||||
new QueryWrapper<StIvtStructattr>().lambda()
|
||||
.eq(StIvtStructattr::getStruct_code, disDao.getStruct_code())
|
||||
);
|
||||
|
||||
// 4.更新分配
|
||||
iostorinvdisCpService.updateById(
|
||||
disDao.setStruct_name("").setStruct_code("")
|
||||
.setStruct_id("").setSect_id("")
|
||||
.setSect_code("").setSect_name("")
|
||||
.setPoint_id("").setPoint_code("")
|
||||
.setPoint_name("")
|
||||
);
|
||||
|
||||
// 5.更新明细
|
||||
StIvtIostorinvdtlCp dtlDao = iostorinvdtlCpService.getOne(
|
||||
new QueryWrapper<StIvtIostorinvdtlCp>().lambda()
|
||||
.eq(StIvtIostorinvdtlCp::getIostorinvdtl_id, disDao.getIostorinvdtl_id())
|
||||
);
|
||||
|
||||
if (StrUtil.equals(dtlDao.getBill_status(), IOSEnum.BILL_STATUS.code("生成"))) {
|
||||
throw new BadRequestException("没有可取消的分配明细!");
|
||||
}
|
||||
|
||||
dtlDao.setAssign_qty(NumberUtil.sub(dtlDao.getAssign_qty(),disDao.getReal_qty()));
|
||||
dtlDao.setUnassign_qty(disDao.getReal_qty());
|
||||
|
||||
if (dtlDao.getAssign_qty().doubleValue() == 0) {
|
||||
dtlDao.setBill_status(IOSEnum.BILL_STATUS.code("生成"));
|
||||
} else if (dtlDao.getAssign_qty().doubleValue() > 0) {
|
||||
dtlDao.setBill_status(IOSEnum.BILL_STATUS.code("分配中"));
|
||||
}
|
||||
|
||||
iostorinvdtlCpService.updateById(dtlDao);
|
||||
|
||||
// 6.更新主表
|
||||
updateMst(dtlDao.getIostorinv_id());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void setPoint(JSONObject whereJson) {
|
||||
StIvtIostorinvdisCp disDao = iostorinvdisCpService.getById(whereJson.getString("iostorinvdis_id"));
|
||||
|
||||
// 1.校验是否设置过起点
|
||||
if (ObjectUtil.isNotEmpty(disDao.getPoint_id())) throw new BadRequestException("此明细已生成任务!");
|
||||
|
||||
// 2.下发任务
|
||||
SchBasePoint pointDao = iSchBasePointService.getOne(
|
||||
new QueryWrapper<SchBasePoint>().lambda()
|
||||
.eq(SchBasePoint::getPoint_code, whereJson.getString("point_code"))
|
||||
);
|
||||
|
||||
PointEvent event = PointEvent.builder()
|
||||
.type(CHANGE_BILL_TYPE_ENUM.IOSTORINV_IN_SEND.getCode())
|
||||
.point_code1(disDao.getStruct_code())
|
||||
.point_code2(pointDao.getPoint_code())
|
||||
.callback((Consumer<String>) disDao::setTask_id)
|
||||
.build();
|
||||
BussEventMulticaster.Publish(event);
|
||||
|
||||
// 3.更新分配表
|
||||
iostorinvdisCpService.updateById(
|
||||
disDao.setPoint_id(pointDao.getPoint_id())
|
||||
.setPoint_code(pointDao.getPoint_code())
|
||||
.setPoint_name(pointDao.getPoint_name())
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void confirm(JSONObject whereJson) {
|
||||
|
||||
// 1.更新主表为完成
|
||||
StIvtIostorinvCp mstDao = this.getById(whereJson.getString("iostorinv_id"));
|
||||
mstDao.setBill_status(IOSEnum.BILL_STATUS.code("完成"));
|
||||
mstDao.setConfirm_id(SecurityUtils.getCurrentUserId());
|
||||
mstDao.setConfirm_name(SecurityUtils.getCurrentNickName());
|
||||
mstDao.setConfirm_time(DateUtil.now());
|
||||
this.updateById(mstDao);
|
||||
|
||||
// 2.判断所有明细是否为分配完
|
||||
List<StIvtIostorinvdtlCp> dtlDaoList = iostorinvdtlCpService.list(
|
||||
new QueryWrapper<StIvtIostorinvdtlCp>().lambda()
|
||||
.eq(StIvtIostorinvdtlCp::getIostorinv_id, whereJson.getString("iostorinv_id"))
|
||||
);
|
||||
|
||||
boolean is_dis = dtlDaoList.stream()
|
||||
.anyMatch(row -> row.getBill_status().equals(IOSEnum.BILL_STATUS.code("分配完")));
|
||||
|
||||
if (!is_dis) throw new BadRequestException("请先分配单据!");
|
||||
|
||||
// 3.更新明细表为完成
|
||||
iostorinvdtlCpService.update(
|
||||
new StIvtIostorinvdtlCp()
|
||||
.setBill_status(IOSEnum.BILL_STATUS.code("完成")),
|
||||
new QueryWrapper<StIvtIostorinvdtlCp>().lambda()
|
||||
.eq(StIvtIostorinvdtlCp::getIostorinv_id, whereJson.getString("iostorinv_id"))
|
||||
);
|
||||
|
||||
// 3.更新任务为完成、更新库存
|
||||
List<StIvtIostorinvdisCp> disDaoList = iostorinvdisCpService.list(
|
||||
new QueryWrapper<StIvtIostorinvdisCp>().lambda()
|
||||
.eq(StIvtIostorinvdisCp::getIostorinv_id, whereJson.getString("iostorinv_id"))
|
||||
);
|
||||
|
||||
Map<String, List<StIvtIostorinvdisCp>> collect = disDaoList.stream()
|
||||
.collect(Collectors.groupingBy(StIvtIostorinvdisCp::getTask_id));
|
||||
|
||||
for (String task_id : collect.keySet()) {
|
||||
// 1)更新任务为完成
|
||||
SchBaseTask taskDao = iSchBaseTaskService.getById(task_id);
|
||||
// 已完成则不更新
|
||||
if (StrUtil.equals(taskDao.getTask_id(), TaskStatusEnum.FINISHED.getCode())) continue;
|
||||
|
||||
taskDao.setTask_status(TaskStatusEnum.FINISHED.getCode());
|
||||
iSchBaseTaskService.updateById(taskDao);
|
||||
|
||||
// 2)更新库存
|
||||
List<StIvtIostorinvdisCp> disList = collect.get(task_id);
|
||||
for (StIvtIostorinvdisCp dao : disList) {
|
||||
// 根据托盘对应货位更新
|
||||
structivtflowService.recordStructivtFlow(
|
||||
StIvtStructivtflowDto.builder()
|
||||
.bill_code(mstDao.getBill_code())
|
||||
.change_type_scode(CHANGE_BILL_TYPE_ENUM.IOSTORINV_IN_SEND)
|
||||
.bill_table("st_ivt_iostorinv_cp")
|
||||
.material_id(dao.getMaterial_id())
|
||||
.pcsn(dao.getPcsn())
|
||||
.struct_code(dao.getStruct_code())
|
||||
.result_qty(dao.getReal_qty())
|
||||
.change_qty(dao.getReal_qty())
|
||||
.task_id(dao.getTask_id())
|
||||
.storagevehicle_code(dao.getStoragevehicle_code())
|
||||
.build()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private StIvtIostorinvCp packageMstForm(StIvtIostorinvCp stIvtIostorinvCp,JSONObject whereJson,Boolean isUpdate) {
|
||||
JSONArray rows = whereJson.getJSONArray("tableData");
|
||||
@@ -493,6 +710,13 @@ public class StIvtIostorinvCpServiceImpl extends ServiceImpl<StIvtIostorinvCpMap
|
||||
mstDao.setBill_status(IOSEnum.BILL_STATUS.code("分配中"));
|
||||
}
|
||||
|
||||
// 判断是否为生成
|
||||
boolean is_create = dtlDaoList
|
||||
.stream()
|
||||
.allMatch(row -> row.getBill_status().equals(IOSEnum.BILL_STATUS.code("生成")));
|
||||
|
||||
if (is_create) mstDao.setBill_status(IOSEnum.BILL_STATUS.code("生成"));
|
||||
|
||||
this.updateById(mstDao);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,8 @@ public class DivRuleCpServiceImpl implements DivRuleCpService {
|
||||
.isNull(StIvtStructattr::getStoragevehicle_code)
|
||||
.eq(StIvtStructattr::getIs_used, "1") //TODO 暂时写死
|
||||
.eq(StIvtStructattr::getLock_type, "1") //TODO 暂时写死
|
||||
);
|
||||
.orderByAsc(StIvtStructattr::getStruct_code)
|
||||
,false);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user