add:成品出库分配页面新增一键设置功能
This commit is contained in:
@@ -97,6 +97,14 @@ public class IStivtlostorivnCpOutController {
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/setPointAll")
|
||||
@Log("一键设置")
|
||||
//("设置站点")
|
||||
public ResponseEntity<Object> setPointAll(@RequestBody JSONObject whereJson){
|
||||
iStIvtIostorinvCpOutService.setPointAll(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/confirm")
|
||||
@Log("强制确认")
|
||||
//("强制确认")
|
||||
|
||||
@@ -118,6 +118,15 @@ public interface IStIvtIostorinvCpOutService extends IService<StIvtIostorinvCp>
|
||||
*/
|
||||
void setPoint(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 一键设置
|
||||
* @param whereJson
|
||||
* {
|
||||
* mst : 出入库主表
|
||||
* }
|
||||
*/
|
||||
void setPointAll(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 强制确认
|
||||
* @param whereJson
|
||||
@@ -196,4 +205,5 @@ public interface IStIvtIostorinvCpOutService extends IService<StIvtIostorinvCp>
|
||||
* }
|
||||
*/
|
||||
JSONArray queryStructAll(Map whereJson);
|
||||
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ import org.nl.wms.storage_manage.productmanage.service.iostorInv.IStIvtIostorinv
|
||||
import org.nl.wms.storage_manage.productmanage.service.iostorInv.IStIvtIostorinvdtlCpService;
|
||||
import org.nl.wms.storage_manage.productmanage.service.iostorInv.dao.StIvtIostorinvCp;
|
||||
import org.nl.wms.storage_manage.productmanage.service.iostorInv.dao.StIvtIostorinvdisCp;
|
||||
import org.nl.wms.storage_manage.productmanage.service.iostorInv.dao.StIvtIostorinvdisdtlCp;
|
||||
import org.nl.wms.storage_manage.productmanage.service.iostorInv.dao.StIvtIostorinvdtlCp;
|
||||
import org.nl.wms.storage_manage.productmanage.service.iostorInv.dao.mapper.StIvtIostorinvCpMapper;
|
||||
import org.nl.wms.storage_manage.productmanage.service.iostorInv.dto.IostorInvQuery;
|
||||
@@ -494,6 +495,99 @@ public class StIvtIostorinvCpOutServiceImpl extends ServiceImpl<StIvtIostorinvCp
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void setPointAll(JSONObject whereJson) {
|
||||
/*
|
||||
* 1.校验明细是否都为分配完
|
||||
* 2.找出库点位
|
||||
* 3.生成任务
|
||||
* 4.下发任务
|
||||
* 5.更新分配状态
|
||||
*/
|
||||
|
||||
// 1.校验明细是否都为分配完
|
||||
List<StIvtIostorinvdtlCp> dtlDao = iostorinvdtlCpService.list(
|
||||
new QueryWrapper<StIvtIostorinvdtlCp>().lambda()
|
||||
.eq(StIvtIostorinvdtlCp::getIostorinv_id, whereJson.getString("iostorinv_id"))
|
||||
);
|
||||
|
||||
boolean is_true = dtlDao.stream()
|
||||
.allMatch(row -> row.getBill_status().equals(IOSEnum.BILL_STATUS.code("分配完")));
|
||||
|
||||
if (!is_true) throw new BadRequestException("请先分配完所有明细!");
|
||||
|
||||
// 2.找出库点
|
||||
// 根据托盘进行分组
|
||||
Map<String, List<StIvtIostorinvdisCp>> disMapList = iostorinvdisCpService.list(
|
||||
new QueryWrapper<StIvtIostorinvdisCp>().lambda()
|
||||
.eq(StIvtIostorinvdisCp::getIostorinv_id, whereJson.getString("iostorinv_id"))
|
||||
.and(qr -> qr.eq(StIvtIostorinvdisCp::getPoint_id,"")
|
||||
.or().isNull(StIvtIostorinvdisCp::getPoint_id)
|
||||
)
|
||||
).stream()
|
||||
.collect(Collectors.groupingBy(StIvtIostorinvdisCp::getStruct_code));
|
||||
|
||||
// 出库点位集合
|
||||
List<SchBasePoint> pointList = iSchBasePointService.list(
|
||||
new QueryWrapper<SchBasePoint>().lambda()
|
||||
.eq(SchBasePoint::getIs_delete, IOSEnum.IS_USED.code("否"))
|
||||
.eq(SchBasePoint::getIs_used, IOSEnum.IS_USED.code("是"))
|
||||
.eq(SchBasePoint::getRegion_code, PDAEnum.REGION_CODE.code("发货区域"))
|
||||
.orderByAsc(SchBasePoint::getPoint_code)
|
||||
|
||||
);
|
||||
|
||||
for (String struct_code : disMapList.keySet()) {
|
||||
StIvtIostorinvdisCp disDao = disMapList.get(struct_code).get(0);
|
||||
|
||||
for (SchBasePoint dao : pointList) {
|
||||
// 校验此点位是否有未完成的任务
|
||||
SchBaseTask taskDao = iSchBaseTaskService.getOne(
|
||||
new QueryWrapper<SchBaseTask>().lambda()
|
||||
.eq(SchBaseTask::getPoint_code3, dao.getPoint_code())
|
||||
.eq(SchBaseTask::getIs_delete, IOSEnum.IS_USED.code("否"))
|
||||
.notIn(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode(), TaskStatusEnum.CANCEL.getCode())
|
||||
, false
|
||||
);
|
||||
|
||||
if (ObjectUtil.isEmpty(taskDao)) {
|
||||
// 3.生成任务
|
||||
PointEvent event = PointEvent.builder()
|
||||
.type(AcsTaskEnum.TASK_STRUCT_CP_OUT)
|
||||
.acs_task_type("8")
|
||||
.task_group_id(IdUtil.getStringId())
|
||||
.point_code1(struct_code)
|
||||
.point_code3(dao.getPoint_code())
|
||||
.vehicle_code(disDao.getStoragevehicle_code())
|
||||
.product_area("A1") // 暂时写死
|
||||
.callback((Consumer<String>) disDao::setTask_id)
|
||||
.build();
|
||||
BussEventMulticaster.Publish(event);
|
||||
|
||||
// 4.下发任务
|
||||
whereJson.put("task_id", disDao.getTask_id());
|
||||
sendTask(whereJson);
|
||||
|
||||
// 5.更新分配状态
|
||||
iostorinvdisCpService.update(
|
||||
new UpdateWrapper<StIvtIostorinvdisCp>().lambda()
|
||||
.set(StIvtIostorinvdisCp::getPoint_id, dao.getPoint_id())
|
||||
.set(StIvtIostorinvdisCp::getPoint_code, dao.getPoint_code())
|
||||
.set(StIvtIostorinvdisCp::getPoint_name, dao.getPoint_name())
|
||||
.set(StIvtIostorinvdisCp::getWork_status, IOSEnum.WORK_STATUS.code("生成"))
|
||||
.set(StIvtIostorinvdisCp::getTask_id, disDao.getTask_id())
|
||||
.eq(StIvtIostorinvdisCp::getIostorinv_id, disDao.getIostorinv_id())
|
||||
.eq(StIvtIostorinvdisCp::getStoragevehicle_code, disDao.getStoragevehicle_code())
|
||||
);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void confirm(JSONObject whereJson) {
|
||||
|
||||
@@ -90,6 +90,17 @@
|
||||
>
|
||||
手工分配
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="left"
|
||||
class="filter-item"
|
||||
:loading="loadingSetAllPoint"
|
||||
type="warning"
|
||||
icon="el-icon-check"
|
||||
size="mini"
|
||||
@click="setPointAll"
|
||||
>
|
||||
一键设置
|
||||
</el-button>
|
||||
</span>
|
||||
</div>
|
||||
<el-card class="box-card" shadow="never" :body-style="{padding:'0'}">
|
||||
@@ -466,6 +477,17 @@ export default {
|
||||
this.loadingSetAllPoint = false
|
||||
})
|
||||
},
|
||||
setPointAll() {
|
||||
this.loadingSetAllPoint = true
|
||||
productOut.setPointAll(this.mstrow).then(res => {
|
||||
this.crud.notify('设置成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.queryTableDtl()
|
||||
this.tabledis = []
|
||||
this.form2.point_code = ''
|
||||
}).finally(() => {
|
||||
this.loadingSetAllPoint = false
|
||||
})
|
||||
},
|
||||
cellStyle({ row, column, rowIndex, columnIndex }) {
|
||||
const assign_qty = parseFloat(row.assign_qty)
|
||||
const plan_qty = parseFloat(row.plan_qty)
|
||||
|
||||
@@ -64,6 +64,14 @@ export function setPoint(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export function setPointAll(data) {
|
||||
return request({
|
||||
url: 'api/productOut/setPointAll',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function confirm(data) {
|
||||
return request({
|
||||
url: 'api/productOut/confirm',
|
||||
@@ -129,6 +137,7 @@ export default {
|
||||
allDivIvt,
|
||||
allCancel,
|
||||
setPoint,
|
||||
setPointAll,
|
||||
confirm,
|
||||
getStructIvt,
|
||||
manualDiv,
|
||||
|
||||
Reference in New Issue
Block a user