add:一体机包装机叫料功能
This commit is contained in:
@@ -222,12 +222,18 @@ public class PdaWashController {
|
||||
@PostMapping("/materialList")
|
||||
@Log("物料列表")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> materialList(@RequestBody JSONObject query, PageQuery page) {
|
||||
public ResponseEntity<Object> materialList(@RequestBody JSONObject query) {
|
||||
List<Map> list = new ArrayList<>();
|
||||
QueryWrapper<MdMeMaterialbase> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("material_type_id", "1528555445302726656");
|
||||
if (StringUtils.isNotEmpty(query.getString("material_code"))){
|
||||
queryWrapper.eq("material_code",query.getString("material_code"));
|
||||
queryWrapper.nested(a->a
|
||||
.eq("material_code",query.getString("material_code"))
|
||||
.or().like("material_spec",query.getString("material_code")));
|
||||
}
|
||||
PageQuery page = new PageQuery();
|
||||
page.setSize(query.getInteger("size"));
|
||||
page.setPage(query.getInteger("page"));
|
||||
Page<MdMeMaterialbase> result = materialbaseService.page(page.build(),queryWrapper);
|
||||
return new ResponseEntity<>(TableDataInfo.build(result),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -7,16 +7,20 @@ package org.nl.wms.pda_manage.pda.controller;
|
||||
*/
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
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;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.anno.Log;
|
||||
import org.nl.common.enums.AcsTaskEnum;
|
||||
import org.nl.common.enums.StatusEnum;
|
||||
import org.nl.common.enums.WorkerOrderEnum;
|
||||
import org.nl.common.utils.RedissonUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.wms.ext_manage.acs.service.WmsToAcsService;
|
||||
@@ -33,6 +37,7 @@ import org.nl.wms.scheduler_manage.service.task.dao.SchBaseTask;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@@ -57,45 +62,92 @@ public class TmpPackageController {
|
||||
private ISchBasePointService basePointService;
|
||||
@Autowired
|
||||
private IPdmProduceWorkorderService workorderService;
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
|
||||
|
||||
@PostMapping("packageList")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> packageList(){
|
||||
//workorderService.list(new QueryWrapper<PdmProduceWorkorder>().eq())
|
||||
return new ResponseEntity<>(TableDataInfo.build(),HttpStatus.OK);
|
||||
List<PdmProduceWorkorder> list = workorderService.list(new QueryWrapper<PdmProduceWorkorder>()
|
||||
.eq("workprocedure_id", "1535144822984282112")
|
||||
.eq("workorder_status", WorkerOrderEnum.PRODUCTING.getCode()));
|
||||
return new ResponseEntity<>(TableDataInfo.build(list),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("sendVechile")
|
||||
@PostMapping("sendMaterial")
|
||||
@SaIgnore
|
||||
@Transactional
|
||||
public ResponseEntity<Object> callVechile(@RequestBody JSONObject param){
|
||||
Assert.notNull(new Object[]{param.getString("device_code"),param.getString("point_code")},"请求参数不能为空");
|
||||
JSONObject moveTask =taskService.createMoveTask(param.getString("point_code"),param.getString("device_code") , AcsTaskEnum.TASK_POINT_TO_POINT, AcsTaskEnum.ACS_TASK_TYPE_NON_WEIGHING_TASK_OF_PS20);
|
||||
JSONArray data = new JSONArray();
|
||||
data.add(moveTask);
|
||||
Map<String, Object> result = wmsToAcsService.issueTaskToAcs2(data);
|
||||
if (StrUtil.equals((String)result.get("status"), "400")) {
|
||||
throw new BadRequestException((String)result.get("message"));
|
||||
}
|
||||
moveTask.put("task_status",StatusEnum.TASK_FINISH.getCode());
|
||||
taskService.save(moveTask.toJavaObject(SchBaseTask.class));
|
||||
basePointService.update(new UpdateWrapper<SchBasePoint>().set("lock_type",StatusEnum.LOCK_OFF.getCode())
|
||||
.set("point_status",StatusEnum.POINT_STATUS_EMPTY.getCode())
|
||||
.set("material_id","").set("qty",0)
|
||||
.set("task_id","")
|
||||
.set("point_status", StatusEnum.POINT_STATUS_EMPTY.getCode())
|
||||
.eq("point_code",param.getString("point_code")));
|
||||
return new ResponseEntity<>(TableDataInfo.build(),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("cachepoint")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> kzpoint(@RequestBody JSONObject param) {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_code", "A1_KZ_SL");
|
||||
JSONObject result = wmsToAcsService.request(jo, "api/wms/startDischarge");
|
||||
if (!StrUtil.equals(result.getString("status"), "200")) {
|
||||
throw new BadRequestException((String)result.get("message"));
|
||||
}
|
||||
return new ResponseEntity<>(TableDataInfo.build(),HttpStatus.OK);
|
||||
///api/point/queryVehicle?page=0&size=20&sort=id%2Cdesc&product_area=A1®ion_code=A1_KZHC
|
||||
param.put("region_code","A1_KZHC");
|
||||
param.put("product_area","A1");
|
||||
List<Map<String, String>> list = basePointService.queryPointMaterial(param);
|
||||
return new ResponseEntity<>(TableDataInfo.build(list),HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("callVechile")
|
||||
@PostMapping("sendVechile")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> kzresidue(@RequestBody JSONObject param){
|
||||
RedissonUtils.lock(()->{
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("next_point_code", param.getString("device_code"));
|
||||
jo.put("start_point_code", "A1_KZ_SL");
|
||||
jo.put("weight", param.getString("qty"));
|
||||
JSONObject result = wmsToAcsService.request(jo, "api/wms/putOver");
|
||||
if (!StrUtil.equals(result.getString("status"), "200")) {
|
||||
throw new BadRequestException((String)result.get("message"));
|
||||
}
|
||||
},"kzresidue",null);
|
||||
Assert.notNull(param.getString("device_code"),"请求参数不能为空");
|
||||
// 判断当前点是否有未完成的任务
|
||||
List<SchBaseTask> list = taskService.list(new QueryWrapper<SchBaseTask>()
|
||||
.nested(i -> i
|
||||
.eq("point_code1", param.getString("device_code")).or()
|
||||
.eq("point_code3", param.getString("device_code")))
|
||||
.lt("task_status", StatusEnum.TASK_FINISH.getCode())
|
||||
);
|
||||
if (ObjectUtil.isNotEmpty(list)) {
|
||||
throw new BadRequestException("当前点位" + param.getString("device_code") + "存在未完成的任务");
|
||||
}
|
||||
// 去刻字缓存区寻找空位
|
||||
List<SchBasePoint> points = basePointService.list(new QueryWrapper<SchBasePoint>()
|
||||
.eq("is_used", "1")
|
||||
.eq("region_code","A1_KZHC")
|
||||
.eq("point_status", StatusEnum.POINT_STATUS_EMPTY.getCode())
|
||||
.eq("lock_type", StatusEnum.LOCK_OFF.getCode())
|
||||
.last("and (material_id is null or material_id = '')")
|
||||
);
|
||||
if (CollectionUtils.isEmpty(points)){
|
||||
throw new BadRequestException("刻字缓存位无可用空点位");
|
||||
}
|
||||
JSONObject moveTask =taskService.createMoveTask(param.getString("device_code"), points.get(0).getPoint_code(), AcsTaskEnum.TASK_POINT_TO_POINT, AcsTaskEnum.ACS_TASK_TYPE_NON_WEIGHING_TASK_OF_PS20);
|
||||
JSONArray data = new JSONArray();
|
||||
data.add(moveTask);
|
||||
Map<String, Object> result = wmsToAcsService.issueTaskToAcs2(data);
|
||||
if (StrUtil.equals((String)result.get("status"), "400")) {
|
||||
throw new BadRequestException((String)result.get("message"));
|
||||
}
|
||||
moveTask.put("task_status",StatusEnum.TASK_FINISH.getCode());
|
||||
taskService.save(moveTask.toJavaObject(SchBaseTask.class));
|
||||
// 完成
|
||||
basePointService.update(new UpdateWrapper<SchBasePoint>().set("lock_type",StatusEnum.LOCK_OFF.getCode())
|
||||
.set("point_status",StatusEnum.POINT_STATUS_EMPTY_VEHICLE.getCode())
|
||||
.set("material_id","")
|
||||
.set("task_id","")
|
||||
.set("qty",0)
|
||||
.eq("point_code",points.get(0).getPoint_code()));
|
||||
return new ResponseEntity<>(TableDataInfo.build(),HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,7 +203,9 @@ public class WashCallEmptyTask extends AbstractAcsTask {
|
||||
.eq(StIvtStructattr::getIs_emptyvehicle,IOSEnum.IS_USED.code("是"))
|
||||
.eq(StIvtStructattr::getSect_code, PDAEnum.SECT_CODE.code("半成品库区"))
|
||||
.eq(StIvtStructattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
.eq(StIvtStructattr::getIs_used,true),false
|
||||
.eq(StIvtStructattr::getIs_used,true)
|
||||
.orderByDesc(StIvtStructattr::getXqty)
|
||||
.orderByAsc(StIvtStructattr::getYqty),false
|
||||
);
|
||||
if (ObjectUtil.isEmpty(attrDao)) throw new BadRequestException("未找到空载具!");
|
||||
|
||||
|
||||
@@ -67,6 +67,9 @@ public class WashSendMaterialTask extends AbstractAcsTask {
|
||||
if (StringUtils.isEmpty(param.getString("wegiht"))||StringUtils.isEmpty(param.getString("vechile_code"))){
|
||||
throw new BadRequestException("请求参数不能为空");
|
||||
}
|
||||
if (param.getString("vechile_code").equals("99999")){
|
||||
throw new BadRequestException("料框码不正确,请手动处理");
|
||||
}
|
||||
String start_point_code = "A1_CPQXJ_01_X";
|
||||
//?刻字满料请求:可以存在多个任务?
|
||||
List<SchBaseTask> list = taskService.list(new QueryWrapper<SchBaseTask>()
|
||||
@@ -94,7 +97,8 @@ public class WashSendMaterialTask extends AbstractAcsTask {
|
||||
JSONObject req = new JSONObject();
|
||||
req.put("from",form);
|
||||
pdaStBcpInService.createIn(req);
|
||||
|
||||
taskService.update(new UpdateWrapper<SchBaseTask>().set("task_step",3)
|
||||
.eq("task_id",order.getTask_id()));
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
@@ -272,7 +272,7 @@ public class StIvtIostorinvCpOutServiceImpl extends ServiceImpl<StIvtIostorinvCp
|
||||
if (CollectionUtils.isEmpty(cps)){
|
||||
throw new BadRequestException("库存不足");
|
||||
}
|
||||
for (StIvtStructivtCp ivtDao : cps) {//分配规则需要考虑托盘跟数量
|
||||
for (StIvtStructivtCp ivtDao : cps) {//分配规则需要考虑托盘跟数量 100 200 500 --200
|
||||
if (unassign_qty<=0){
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -66,7 +66,8 @@ public class DivRuleCpServiceImpl implements DivRuleCpService {
|
||||
.or().isNull(StIvtStructattr::getStoragevehicle_code)
|
||||
)
|
||||
.ne(StIvtStructattr::getIs_emptyvehicle, true)
|
||||
.orderByAsc(StIvtStructattr::getStruct_code)
|
||||
.orderByDesc(StIvtStructattr::getXqty)
|
||||
.orderByAsc(StIvtStructattr::getYqty)
|
||||
, false);
|
||||
break;
|
||||
case RuleUtil.PRODUCTION_IN_2 :
|
||||
|
||||
Reference in New Issue
Block a user