rev:刻字上料输送线任务顺序

This commit is contained in:
zhangzhiqiang
2023-08-11 16:36:16 +08:00
parent dc5031c9fa
commit b345ea5757
7 changed files with 72 additions and 31 deletions

View File

@@ -180,7 +180,7 @@ public class PdaWashController {
LIMIT_WEIGHT = Double.valueOf(one.getValue());
}
if (sum>LIMIT_WEIGHT){
throw new BadRequestException("选择的储料仓物料总重量大于"+LIMIT_WEIGHT+"公斤");
throw new BadRequestException("选择的储料仓物料总重量大于"+LIMIT_WEIGHT+"公斤");
}
return list;
}

View File

@@ -1,11 +1,9 @@
package org.nl.wms.product_manage.controller.workprocedure;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.TableDataInfo;
@@ -21,7 +19,6 @@ import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* <p>
@@ -76,8 +73,8 @@ public class PdmBiWorkprocedureController {
@GetMapping("/downSelect")
@Log("查询工序下拉列表")
//("查询工序下拉列表")
public ResponseEntity<Object> downSelect() {
return new ResponseEntity<>(pdmBiWorkprocedureService.downSelect(), HttpStatus.OK);
public ResponseEntity<Object> downSelect(String product_area) {
return new ResponseEntity<>(pdmBiWorkprocedureService.downSelect(product_area), HttpStatus.OK);
}
@GetMapping("/queryWorkprocedure")
@Log("查询生产工序")//仓储/清洗

View File

@@ -17,8 +17,9 @@ public interface IPdmBiWorkprocedureService extends IService<PdmBiWorkprocedure>
/**
* 查询工序
* @return
* @param product_area
*/
JSONArray downSelect();
JSONArray downSelect(String product_area);
void create(JSONObject form);

View File

@@ -2,13 +2,12 @@ package org.nl.wms.product_manage.service.workprocedure.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
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.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.wms.product_manage.service.workprocedure.IPdmBiWorkprocedureService;
@@ -30,8 +29,13 @@ import java.util.List;
public class PdmBiWorkprocedureServiceImpl extends ServiceImpl<PdmBiWorkprocedureMapper, PdmBiWorkprocedure> implements IPdmBiWorkprocedureService {
@Override
public JSONArray downSelect() {
List list = this.list(new QueryWrapper<PdmBiWorkprocedure>().eq("is_used", true).orderByDesc("workprocedure_code"));
public JSONArray downSelect(String product_area) {
QueryWrapper<PdmBiWorkprocedure> wrapper = new QueryWrapper<>();
if (!StringUtils.isEmpty(product_area)){
wrapper.eq("product_area",product_area);
}
wrapper.eq("is_used", true).orderByDesc("workprocedure_code");
List list = this.list(wrapper);
return new JSONArray(list);
}

View File

@@ -95,11 +95,12 @@ public class EngraveTranSportTask extends AbstractAcsTask {
String[] to_devices_array = {"0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"};
String[] to_weight_array = {"0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"};
int i=0;
for (Map.Entry<String, String> entry : qtyArr.entrySet()) {
to_sort_array[i] = String.valueOf(i+1);
to_devices_array[i] = String.valueOf(entry.getKey());
to_weight_array[i] = String.valueOf(new BigDecimal(entry.getValue()).intValue());
i++;
List<String> sort = qtyArr.keySet().stream().sorted(Comparator.comparingInt(key -> Integer.valueOf(key.substring(key.lastIndexOf("_") + 1)))).collect(Collectors.toList());
for (int i1 = 0; i1 < sort.size(); i1++) {
String key = sort.get(i1);
to_sort_array[i] = String.valueOf(i1+1);
to_devices_array[i] = String.valueOf(key);
to_weight_array[i] = String.valueOf(new BigDecimal(qtyArr.get(key)));
}
jo.put("to_sort_array", Arrays.stream(to_sort_array).collect(Collectors.joining(",")));
jo.put("to_devices_array",Arrays.stream(to_devices_array).collect(Collectors.joining(",")));
@@ -120,6 +121,14 @@ public class EngraveTranSportTask extends AbstractAcsTask {
return null;
}
public static void main(String[] args) {
String a="{\"A1_KZ_14\":\"10000\",\"A1_KZ_07\":\"110000\",\"A1_KZ_11\":\"110000\",\"A1_KZ_03\":\"110000\"}";
Map<String,String> map = JSONObject.parseObject(a, Map.class);
Set<String> set = map.keySet();
List<String> collect = set.stream().sorted(Comparator.comparingInt(key -> Integer.valueOf(key.substring(key.lastIndexOf("_") + 1)))).collect(Collectors.toList());
System.out.println(collect.toString());
}
private SchBaseTask packageTask(Integer canuse_qty, MdMeMaterialbase material, Map<String,String> taskMap) {
SchBaseTask baseTask = new SchBaseTask();
baseTask.setMaterial_id(material.getMaterial_id());