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.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@@ -94,6 +96,8 @@ public class PdmWorkTaskServiceImpl implements PdmWorkTaskService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Map<String, Object> needPFVehicle(Map jsonObject) {
|
||||
WQLObject task_wql = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||
|
||||
if (ObjectUtil.isEmpty(jsonObject)) {
|
||||
throw new PdaRequestException("传入参数不能为空!");
|
||||
}
|
||||
@@ -137,16 +141,32 @@ public class PdmWorkTaskServiceImpl implements PdmWorkTaskService {
|
||||
map.put("product_series_id", product_series_id);
|
||||
map.put("workprocedure_id", workprocedure_id);
|
||||
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");
|
||||
vehicle = WQL.getWO("QPDM_WORK_TASK").addParamMap(map).process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(vehicle)) {
|
||||
vehicles = WQL.getWO("QPDM_WORK_TASK").addParamMap(map).process().getResultJSONArray(0);
|
||||
if (vehicles.size() == 0) {
|
||||
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 point_code = vehicle.getString("point_code");
|
||||
@@ -166,23 +186,26 @@ public class PdmWorkTaskServiceImpl implements PdmWorkTaskService {
|
||||
String next_point_code = device_point.getString("point_code");
|
||||
|
||||
//判断起点或者终点是否锁定
|
||||
JSONObject out_point = WQLObject.getWQLObject("sch_base_point").query("point_code = '" + point_code + "'").uniqueResult(0);
|
||||
if (!out_point.getString("lock_type").equals("00")) {
|
||||
throw new PdaRequestException("点位:" + point_code + "锁定!");
|
||||
}
|
||||
check_point_lock:{
|
||||
JSONObject out_point = WQLObject.getWQLObject("sch_base_point").query("point_code = '" + point_code + "'").uniqueResult(0);
|
||||
if (!out_point.getString("lock_type").equals("00")) {
|
||||
throw new PdaRequestException("点位:" + point_code + "锁定!");
|
||||
}
|
||||
|
||||
if (out_point.getString("is_used").equals("0")) {
|
||||
throw new PdaRequestException("点位:" + point_code + "未启用!");
|
||||
}
|
||||
if (out_point.getString("is_used").equals("0")) {
|
||||
throw new PdaRequestException("点位:" + point_code + "未启用!");
|
||||
}
|
||||
|
||||
//判断起点或者终点是否锁定
|
||||
JSONObject next_point = WQLObject.getWQLObject("sch_base_point").query("point_code = '" + next_point_code + "'").uniqueResult(0);
|
||||
if (!next_point.getString("lock_type").equals("00") || StrUtil.isNotEmpty(next_point.getString("vehicle_code"))) {
|
||||
throw new PdaRequestException("点位:" + next_point_code + "锁定或点位上存在载具!");
|
||||
}
|
||||
//判断起点或者终点是否锁定
|
||||
JSONObject next_point = WQLObject.getWQLObject("sch_base_point").query("point_code = '" + next_point_code + "'").uniqueResult(0);
|
||||
if (!next_point.getString("lock_type").equals("00") || StrUtil.isNotEmpty(next_point.getString("vehicle_code"))) {
|
||||
throw new PdaRequestException("点位:" + next_point_code + "锁定或点位上存在载具!");
|
||||
}
|
||||
|
||||
if (next_point.getString("is_used").equals("0")) {
|
||||
throw new PdaRequestException("点位:" + next_point_code + "未启用!");
|
||||
}
|
||||
|
||||
if (next_point.getString("is_used").equals("0")) {
|
||||
throw new PdaRequestException("点位:" + next_point_code + "未启用!");
|
||||
}
|
||||
|
||||
//生成搬运任务
|
||||
|
||||
@@ -370,11 +370,12 @@ public class FactorywarrantymstServiceImpl implements FactorywarrantymstService
|
||||
for (int i = 0; i < itemArr.size(); i++) {
|
||||
JSONObject jsonObject = itemArr.getJSONObject(i);
|
||||
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);
|
||||
if (ObjectUtil.isNotEmpty(JsonValue)) {
|
||||
num = num + 1;
|
||||
}else {
|
||||
throw new BadRequestException("产品检验方案标准表项点:"+inspection_item_id+"没有对应厂家质保书明细");
|
||||
throw new BadRequestException("产品检验方案标准表项点:"+inspection_item_code+"没有对应厂家质保书明细");
|
||||
}
|
||||
}
|
||||
if (itemArr.size() != num) throw new BadRequestException("所有项点必须有值");
|
||||
|
||||
@@ -166,7 +166,7 @@
|
||||
PURCHASE.ITEM_ID in 输入.mater_ids
|
||||
ENDOPTION
|
||||
OPTION 输入.source_name <> ""
|
||||
PURCHASE.NAME like "%" 输入.source_name "%"
|
||||
PURCHASE.NAME like 输入.source_name
|
||||
ENDOPTION
|
||||
OPTION 输入.hide <> ""
|
||||
1=1 HAVING sum( PURCHASE.QTY_ZT ) > 0
|
||||
|
||||
@@ -579,7 +579,7 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
|
||||
.setDbname("dataSource1")
|
||||
.addParam("flag", "6")
|
||||
.addParam("material_id", ext_id)
|
||||
.addParam("source_name", sourceName)
|
||||
.addParam("source_name", "%" + sourceName + "%")
|
||||
.addParam("hide", hide)
|
||||
.addParam("mater_ids", allmaterialId)
|
||||
.process().getResultJSONArray(0);
|
||||
|
||||
Reference in New Issue
Block a user