fix:1.配粉槽分配重复2.合同在途供应商查询sql
This commit is contained in:
@@ -30,7 +30,9 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@@ -94,6 +96,8 @@ public class PdmWorkTaskServiceImpl implements PdmWorkTaskService {
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Map<String, Object> needPFVehicle(Map jsonObject) {
|
public Map<String, Object> needPFVehicle(Map jsonObject) {
|
||||||
|
WQLObject task_wql = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||||
|
|
||||||
if (ObjectUtil.isEmpty(jsonObject)) {
|
if (ObjectUtil.isEmpty(jsonObject)) {
|
||||||
throw new PdaRequestException("传入参数不能为空!");
|
throw new PdaRequestException("传入参数不能为空!");
|
||||||
}
|
}
|
||||||
@@ -137,16 +141,32 @@ public class PdmWorkTaskServiceImpl implements PdmWorkTaskService {
|
|||||||
map.put("product_series_id", product_series_id);
|
map.put("product_series_id", product_series_id);
|
||||||
map.put("workprocedure_id", workprocedure_id);
|
map.put("workprocedure_id", workprocedure_id);
|
||||||
map.put("flag", "3");
|
map.put("flag", "3");
|
||||||
JSONObject vehicle = WQL.getWO("QPDM_WORK_TASK").addParamMap(map).process().uniqueResult(0);
|
JSONArray vehicles = WQL.getWO("QPDM_WORK_TASK").addParamMap(map).process().getResultJSONArray(0);
|
||||||
|
|
||||||
//如果查询不到,就查物料属性为空的
|
//如果查询不到,就查物料属性为空的
|
||||||
if (ObjectUtil.isEmpty(vehicle)) {
|
if (vehicles.size() == 0) {
|
||||||
map.put("flag", "4");
|
map.put("flag", "4");
|
||||||
vehicle = WQL.getWO("QPDM_WORK_TASK").addParamMap(map).process().uniqueResult(0);
|
vehicles = WQL.getWO("QPDM_WORK_TASK").addParamMap(map).process().getResultJSONArray(0);
|
||||||
if (ObjectUtil.isEmpty(vehicle)) {
|
if (vehicles.size() == 0) {
|
||||||
throw new PdaRequestException("当前设备没有可用的配粉槽或配粉槽不在配粉暂存区!");
|
throw new PdaRequestException("当前设备没有可用的配粉槽或配粉槽不在配粉暂存区!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
String sql = vehicles.stream().map(a -> ((JSONObject) a).getString("storagevehicle_code")).collect(Collectors.joining(","));
|
||||||
|
//过滤当前配粉槽是否存在未完成任务po.point_code,
|
||||||
|
List<String> runVehicles = task_wql.query("vehicle_code in ('" + sql + "') AND task_status < '99' AND is_delete = '0'").getResultJSONArray(0).stream().map(a -> ((JSONObject) a).getString("vehicle_code")).collect(Collectors.toList());
|
||||||
|
JSONObject vehicle = null;
|
||||||
|
for (Object o : vehicles) {
|
||||||
|
JSONObject item = (JSONObject)o;
|
||||||
|
String vehicle_code = item.getString("storagevehicle_code");
|
||||||
|
if (!runVehicles.contains(vehicle_code)){
|
||||||
|
vehicle = item;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (vehicle == null) {
|
||||||
|
log.error("配粉槽列表:{},存在未完成任务:{}",sql,runVehicles);
|
||||||
|
throw new PdaRequestException("当前设备没有可用的配粉槽存在未完成的任务!");
|
||||||
|
}
|
||||||
|
|
||||||
String storagevehicle_code = vehicle.getString("storagevehicle_code");
|
String storagevehicle_code = vehicle.getString("storagevehicle_code");
|
||||||
String point_code = vehicle.getString("point_code");
|
String point_code = vehicle.getString("point_code");
|
||||||
@@ -166,6 +186,7 @@ public class PdmWorkTaskServiceImpl implements PdmWorkTaskService {
|
|||||||
String next_point_code = device_point.getString("point_code");
|
String next_point_code = device_point.getString("point_code");
|
||||||
|
|
||||||
//判断起点或者终点是否锁定
|
//判断起点或者终点是否锁定
|
||||||
|
check_point_lock:{
|
||||||
JSONObject out_point = WQLObject.getWQLObject("sch_base_point").query("point_code = '" + point_code + "'").uniqueResult(0);
|
JSONObject out_point = WQLObject.getWQLObject("sch_base_point").query("point_code = '" + point_code + "'").uniqueResult(0);
|
||||||
if (!out_point.getString("lock_type").equals("00")) {
|
if (!out_point.getString("lock_type").equals("00")) {
|
||||||
throw new PdaRequestException("点位:" + point_code + "锁定!");
|
throw new PdaRequestException("点位:" + point_code + "锁定!");
|
||||||
@@ -185,6 +206,8 @@ public class PdmWorkTaskServiceImpl implements PdmWorkTaskService {
|
|||||||
throw new PdaRequestException("点位:" + next_point_code + "未启用!");
|
throw new PdaRequestException("点位:" + next_point_code + "未启用!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//生成搬运任务
|
//生成搬运任务
|
||||||
JSONObject task_jo = new JSONObject();
|
JSONObject task_jo = new JSONObject();
|
||||||
task_jo.put("start_point_code", point_code);
|
task_jo.put("start_point_code", point_code);
|
||||||
|
|||||||
@@ -370,11 +370,12 @@ public class FactorywarrantymstServiceImpl implements FactorywarrantymstService
|
|||||||
for (int i = 0; i < itemArr.size(); i++) {
|
for (int i = 0; i < itemArr.size(); i++) {
|
||||||
JSONObject jsonObject = itemArr.getJSONObject(i);
|
JSONObject jsonObject = itemArr.getJSONObject(i);
|
||||||
String inspection_item_id = jsonObject.getString("inspection_item_id");
|
String inspection_item_id = jsonObject.getString("inspection_item_id");
|
||||||
|
String inspection_item_code = jsonObject.getString("inspection_item_code");
|
||||||
JSONObject JsonValue =factDtlTab.query("inspection_item_id = '" + inspection_item_id + "' and inspection_id = '" + whereJson.getString("inspection_id") + "'").uniqueResult(0);
|
JSONObject JsonValue =factDtlTab.query("inspection_item_id = '" + inspection_item_id + "' and inspection_id = '" + whereJson.getString("inspection_id") + "'").uniqueResult(0);
|
||||||
if (ObjectUtil.isNotEmpty(JsonValue)) {
|
if (ObjectUtil.isNotEmpty(JsonValue)) {
|
||||||
num = num + 1;
|
num = num + 1;
|
||||||
}else {
|
}else {
|
||||||
throw new BadRequestException("产品检验方案标准表项点:"+inspection_item_id+"没有对应厂家质保书明细");
|
throw new BadRequestException("产品检验方案标准表项点:"+inspection_item_code+"没有对应厂家质保书明细");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (itemArr.size() != num) throw new BadRequestException("所有项点必须有值");
|
if (itemArr.size() != num) throw new BadRequestException("所有项点必须有值");
|
||||||
|
|||||||
@@ -166,7 +166,7 @@
|
|||||||
PURCHASE.ITEM_ID in 输入.mater_ids
|
PURCHASE.ITEM_ID in 输入.mater_ids
|
||||||
ENDOPTION
|
ENDOPTION
|
||||||
OPTION 输入.source_name <> ""
|
OPTION 输入.source_name <> ""
|
||||||
PURCHASE.NAME like "%" 输入.source_name "%"
|
PURCHASE.NAME like 输入.source_name
|
||||||
ENDOPTION
|
ENDOPTION
|
||||||
OPTION 输入.hide <> ""
|
OPTION 输入.hide <> ""
|
||||||
1=1 HAVING sum( PURCHASE.QTY_ZT ) > 0
|
1=1 HAVING sum( PURCHASE.QTY_ZT ) > 0
|
||||||
|
|||||||
@@ -579,7 +579,7 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
|
|||||||
.setDbname("dataSource1")
|
.setDbname("dataSource1")
|
||||||
.addParam("flag", "6")
|
.addParam("flag", "6")
|
||||||
.addParam("material_id", ext_id)
|
.addParam("material_id", ext_id)
|
||||||
.addParam("source_name", sourceName)
|
.addParam("source_name", "%" + sourceName + "%")
|
||||||
.addParam("hide", hide)
|
.addParam("hide", hide)
|
||||||
.addParam("mater_ids", allmaterialId)
|
.addParam("mater_ids", allmaterialId)
|
||||||
.process().getResultJSONArray(0);
|
.process().getResultJSONArray(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user