Version 1.3
This commit is contained in:
@@ -135,6 +135,14 @@ public class MaterialbaseServiceImpl implements MaterialbaseService {
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
JSONObject existMaterial = WQLObject
|
||||
.getWQLObject("md_me_materialbase")
|
||||
.query("material_code = '" + dto.getMaterial_code() + "'")
|
||||
.uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(existMaterial)) {
|
||||
throw new BadRequestException("该物料号已存在");
|
||||
}
|
||||
|
||||
dto.setMaterial_id(IdUtil.getSnowflake(1L, 1L).nextId());
|
||||
dto.setIs_used("1");
|
||||
dto.setCreate_id(currentUserId);
|
||||
|
||||
@@ -123,8 +123,8 @@ public class VehicleServiceImpl implements VehicleService {
|
||||
throw new BadRequestException("载具号" + vehicleCode + "存在组盘信息");
|
||||
}
|
||||
JSONObject point = new JSONObject();
|
||||
point.put("vehicle_code", null);
|
||||
pointTable.update(point, "vehicle_code = " + vehicleCode);
|
||||
point.put("vehicle_code", "");
|
||||
pointTable.update(point, "vehicle_code = '" + vehicleCode + "'");
|
||||
vehicleTable.delete("vehicle_id = " + vehicleId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ public class PdaController {
|
||||
@PostMapping("/queryInventory")
|
||||
@Log("查询可出库信息")
|
||||
@ApiOperation("查询可出库信息")
|
||||
public ResponseEntity<JSONObject> queryInventory(@RequestBody JSONObject param) {
|
||||
public ResponseEntity<JSONArray> queryInventory(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(pdaService.queryInventory(param.getString("material_code"), param.getString("vehicle_code")), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public interface PdaService {
|
||||
|
||||
JSONArray queryMaterial();
|
||||
|
||||
JSONObject queryInventory(String materialCode, String vehicleCode);
|
||||
JSONArray queryInventory(String materialCode, String vehicleCode);
|
||||
|
||||
void task(String type, String pointId, String startPointId, String nextPointId);
|
||||
}
|
||||
|
||||
@@ -16,17 +16,11 @@ import org.nl.wms.sch.base.point.LockType;
|
||||
import org.nl.wms.sch.base.point.PointStatus;
|
||||
import org.nl.wms.sch.base.point.PointType;
|
||||
import org.nl.wms.sch.base.region.RegionEnum;
|
||||
import org.nl.wms.sch.task.CallEmptyVehicleTask;
|
||||
import org.nl.wms.sch.task.CallMaterialTask;
|
||||
import org.nl.wms.sch.task.SendFullVehicleTask;
|
||||
import org.nl.wms.sch.task.SendResiduesMaterialTask;
|
||||
import org.nl.wms.sch.task.SendEmptyVehicleTask;
|
||||
import org.nl.wms.sch.task.*;
|
||||
import org.nl.wms.util.CommonUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.concurrent.locks.Lock;
|
||||
|
||||
/**
|
||||
* @author 张江玮
|
||||
* @date 2022/11/04 18:25
|
||||
@@ -65,12 +59,7 @@ public class PdaServiceImpl implements PdaService {
|
||||
point.put("status", "2");
|
||||
}
|
||||
}
|
||||
// for (Object o : points) {
|
||||
// JSONObject point = (JSONObject) o;
|
||||
// if (StrUtil.equals(point.getString("lock_type"), LockType.TASK_LOCKED.getCode())) {
|
||||
// point.put("status", "3");
|
||||
// }
|
||||
// }
|
||||
|
||||
return points;
|
||||
}
|
||||
|
||||
@@ -117,7 +106,7 @@ public class PdaServiceImpl implements PdaService {
|
||||
if (StrUtil.isNotEmpty(vehicleCode)) {
|
||||
JSONObject vehicle = WQLObject.getWQLObject("md_pb_vehicle").query("vehicle_code = '" + vehicleCode + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(vehicle)) {
|
||||
throw new BadRequestException("该载具号不存在,请从组盘功能添加");
|
||||
throw new BadRequestException("该载具号不存在");
|
||||
}
|
||||
|
||||
JSONObject existPoint = pointTable.query("vehicle_code = '" + vehicleCode + "'").uniqueResult(0);
|
||||
@@ -185,7 +174,7 @@ public class PdaServiceImpl implements PdaService {
|
||||
.query("material_code = '" + materialCode + "'")
|
||||
.uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(material)) {
|
||||
throw new BadRequestException("条码为" + code + "的物料信息不存在,请从后台管理界面添加");
|
||||
throw new BadRequestException("条码为" + code + "的物料信息不存在");
|
||||
}
|
||||
|
||||
JSONObject vm = new JSONObject();
|
||||
@@ -248,10 +237,6 @@ public class PdaServiceImpl implements PdaService {
|
||||
vm.put("create_time", oldVm.getString("create_time"));
|
||||
vmTable.insert(vm);
|
||||
}
|
||||
// for (Object o : materials) {
|
||||
// JSONObject material = (JSONObject) o;
|
||||
//
|
||||
// }
|
||||
|
||||
vehicle.put("vehicle_status", VehicleStatus.HAS_MATERIAL.getCode());
|
||||
} else {
|
||||
@@ -268,52 +253,56 @@ public class PdaServiceImpl implements PdaService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject queryInventory(String materialCode, String vehicleCode) {
|
||||
JSONObject vehicle = WQLObject
|
||||
.getWQLObject("md_pb_vehicle")
|
||||
.query("vehicle_code = '" + vehicleCode + "'")
|
||||
.uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(vehicle)) {
|
||||
throw new BadRequestException("该载具号不存在,请从组盘功能添加");
|
||||
}
|
||||
if (StrUtil.equals(vehicle.getString("vehicle_status"), VehicleStatus.EMPTY.getCode())) {
|
||||
throw new BadRequestException("该载具为空载具");
|
||||
public JSONArray queryInventory(String materialCode, String vehicleCode) {
|
||||
if (StrUtil.isNotEmpty(materialCode)) {
|
||||
JSONObject material = WQLObject
|
||||
.getWQLObject("md_me_materialbase")
|
||||
.query("material_code = '" + materialCode + "'")
|
||||
.uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isEmpty(material)) {
|
||||
throw new BadRequestException("该物料号不存在");
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject point = WQLObject
|
||||
.getWQLObject("sch_base_point")
|
||||
.query("vehicle_code = '" + vehicleCode + "'")
|
||||
.uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
throw new BadRequestException("该载具不存在于点位上");
|
||||
}
|
||||
if (!StrUtil.equals(point.getString("region_code"), RegionEnum.ZC.getCode())) {
|
||||
throw new BadRequestException("该载具不在暂存区");
|
||||
}
|
||||
if (StrUtil.equals(point.getString("is_used"), "0")) {
|
||||
throw new BadRequestException("该载具所在点位已被禁用");
|
||||
|
||||
if (StrUtil.isNotEmpty(vehicleCode)) {
|
||||
JSONObject vehicle = WQLObject
|
||||
.getWQLObject("md_pb_vehicle")
|
||||
.query("vehicle_code = '" + vehicleCode + "'")
|
||||
.uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(vehicle)) {
|
||||
throw new BadRequestException("该载具号不存在");
|
||||
}
|
||||
if (StrUtil.equals(vehicle.getString("vehicle_status"), VehicleStatus.EMPTY.getCode())) {
|
||||
throw new BadRequestException("该载具为空载具");
|
||||
}
|
||||
|
||||
JSONObject point = WQLObject
|
||||
.getWQLObject("sch_base_point")
|
||||
.query("vehicle_code = '" + vehicleCode + "'")
|
||||
.uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
throw new BadRequestException("该载具不存在于点位上");
|
||||
}
|
||||
if (!StrUtil.equals(point.getString("region_code"), RegionEnum.ZC.getCode())) {
|
||||
throw new BadRequestException("该载具不在暂存区");
|
||||
}
|
||||
if (StrUtil.equals(point.getString("is_used"), "0")) {
|
||||
throw new BadRequestException("该载具所在点位已被禁用");
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("point_id", point.getString("point_id"));
|
||||
result.put("point_name", point.getString("point_name"));
|
||||
|
||||
JSONObject material = WQLObject
|
||||
.getWQLObject("md_me_materialbase")
|
||||
.query("material_code = '" + materialCode + "'")
|
||||
.uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(material)) {
|
||||
throw new BadRequestException("该物料号不存在");
|
||||
}
|
||||
|
||||
JSONArray detail = WQL
|
||||
JSONArray result = WQL
|
||||
.getWO("PDA")
|
||||
.addParam("flag", "5")
|
||||
.addParam("vehicle_id", vehicle.getString("vehicle_id"))
|
||||
.addParam("material_id", material.getString("material_id"))
|
||||
.addParam("material_code", materialCode)
|
||||
.addParam("vehicle_code", vehicleCode)
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
result.put("detail", detail);
|
||||
if (ObjectUtil.isEmpty(result)) {
|
||||
throw new BadRequestException("未找到符合条件的暂存区点位");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -355,14 +344,11 @@ public class PdaServiceImpl implements PdaService {
|
||||
if (StrUtil.equals(point.getString("point_status"), PointStatus.EMPTY.getCode())) {
|
||||
throw new BadRequestException("该点位为空位");
|
||||
}
|
||||
if (StrUtil.equals(point.getString("region_id"), RegionEnum.ZC.getId())) {
|
||||
throw new BadRequestException("暂存区不能生成入库任务");
|
||||
}
|
||||
|
||||
String regionId = point.getString("region_id");
|
||||
if (StrUtil.equals(regionId, RegionEnum.JJ.getId())
|
||||
&& point.getString("point_code").startsWith("JJC")) {
|
||||
throw new BadRequestException("交接区出库位不能生成入库任务");
|
||||
if (StrUtil.equals(regionId, RegionEnum.ZC.getId())
|
||||
|| (StrUtil.equals(regionId, RegionEnum.JJ.getId())
|
||||
&& point.getString("point_code").startsWith("JJC"))) {
|
||||
throw new BadRequestException("只有交接区的入库位和接料区才能发起入库任务");
|
||||
}
|
||||
|
||||
JSONObject vehicle = WQLObject
|
||||
@@ -420,7 +406,7 @@ public class PdaServiceImpl implements PdaService {
|
||||
throw new BadRequestException("终点有载具");
|
||||
}
|
||||
if (!StrUtil.equals(nextPoint.getString("region_id"), RegionEnum.JJ.getId())
|
||||
&& nextPoint.getString("point_code").startsWith("JJC")) {
|
||||
&& nextPoint.getString("point_code").startsWith("JJC")) {
|
||||
throw new BadRequestException("只有终点为交接区的出库位才能生成出库任务");
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,7 @@
|
||||
输入.flag TYPEAS s_string
|
||||
输入.region_id TYPEAS s_string
|
||||
输入.vehicle_code TYPEAS s_string
|
||||
输入.vehicle_id TYPEAS s_string
|
||||
输入.material_id TYPEAS s_string
|
||||
输入.material_code TYPEAS s_string
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
@@ -99,16 +98,32 @@
|
||||
IF 输入.flag = "5"
|
||||
QUERY
|
||||
SELECT
|
||||
material.material_code,
|
||||
point.point_id,
|
||||
point.point_name,
|
||||
point.vehicle_code,
|
||||
material.material_code,
|
||||
material.material_name,
|
||||
vm.material_qty,
|
||||
vm.material_batch AS batch
|
||||
vm.material_batch,
|
||||
SUM( vm.material_qty ) AS material_qty
|
||||
FROM
|
||||
st_ivt_vehicle_material vm
|
||||
sch_base_point point
|
||||
LEFT JOIN md_pb_vehicle vehicle ON point.vehicle_code = vehicle.vehicle_code
|
||||
LEFT JOIN st_ivt_vehicle_material vm ON vehicle.vehicle_id = vm.vehicle_id
|
||||
LEFT JOIN md_me_materialbase material ON vm.material_id = material.material_id
|
||||
WHERE
|
||||
vm.vehicle_id = 输入.vehicle_id
|
||||
AND vm.material_id = 输入.material_id
|
||||
point.point_status = '1'
|
||||
AND point.is_used = '1'
|
||||
AND point.lock_type = '1'
|
||||
AND point.region_id = 1585921595338264576
|
||||
AND vehicle.vehicle_status = '2'
|
||||
OPTION 输入.material_code <> ""
|
||||
material.material_code = 输入.material_code
|
||||
ENDOPTION
|
||||
OPTION 输入.vehicle_code <> ""
|
||||
vehicle.vehicle_code = 输入.vehicle_code
|
||||
ENDOPTION
|
||||
GROUP BY
|
||||
point.point_id
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
@@ -47,12 +47,12 @@
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
ivt.stockrecord_id,
|
||||
ANY_VALUE( region.region_name ) AS region_name,
|
||||
ANY_VALUE( point.point_name ) AS point_name,
|
||||
ANY_VALUE( vehicle.vehicle_id ) AS vehicle_id,
|
||||
ANY_VALUE( vehicle.vehicle_code ) AS vehicle_code,
|
||||
region.region_name,
|
||||
point.point_name,
|
||||
vehicle.vehicle_id,
|
||||
vehicle.vehicle_code,
|
||||
SUM( vm.material_qty ) AS qty,
|
||||
ANY_VALUE( ivt.instorage_time ) AS instorage_time
|
||||
ivt.instorage_time
|
||||
FROM
|
||||
st_ivt_structivt ivt
|
||||
LEFT JOIN sch_base_point point ON ivt.point_id = point.point_id
|
||||
|
||||
@@ -41,4 +41,12 @@ public class VMController {
|
||||
public ResponseEntity<JSONArray> queryDetail(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(vmService.queryDetail(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除组盘信息")
|
||||
@ApiOperation("删除组盘信息")
|
||||
public ResponseEntity<Void> delete(@RequestBody Long[] ids) {
|
||||
vmService.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ public interface VMService {
|
||||
* 查询组盘信息
|
||||
*
|
||||
* @param param String search 载具编码
|
||||
* @param page 分页
|
||||
* @param page 分页
|
||||
* @return 组盘信息
|
||||
*/
|
||||
JSONObject query(Map<String, String> param, Pageable page);
|
||||
@@ -28,4 +28,11 @@ public interface VMService {
|
||||
* @return 所有组盘信息
|
||||
*/
|
||||
JSONArray queryDetail(JSONObject param);
|
||||
|
||||
/**
|
||||
* 删除组盘
|
||||
*
|
||||
* @param ids 载具id数组
|
||||
*/
|
||||
void delete(Long[] ids);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,9 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.nl.wms.md.pb.VehicleStatus;
|
||||
import org.nl.wms.st.vm.service.VMService;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -49,4 +51,20 @@ public class VMServiceImpl implements VMService {
|
||||
param.put("flag", "2");
|
||||
return WQL.getWO("ST_IVT_VEHICLE_MATERIAL").addParamMap(param).process().getResultJSONArray(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除组盘
|
||||
*
|
||||
* @param ids 载具id数组
|
||||
*/
|
||||
@Override
|
||||
public void delete(Long[] ids) {
|
||||
for (Long id : ids) {
|
||||
WQLObject.getWQLObject("st_ivt_vehicle_material").delete("vehicle_id = " + id);
|
||||
|
||||
JSONObject vehicleUpdate = new JSONObject();
|
||||
vehicleUpdate.put("vehicle_status", VehicleStatus.EMPTY);
|
||||
WQLObject.getWQLObject("md_pb_vehicle").update(vehicleUpdate, "vehicle_id = " + id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,16 +43,17 @@
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
vehicle.vehicle_id,
|
||||
ANY_VALUE( vm.vm_id ) AS vm_id,
|
||||
ANY_VALUE( vehicle.vehicle_code) AS vehicle_code,
|
||||
vm.vm_id,
|
||||
vehicle.vehicle_code,
|
||||
SUM( vm.material_qty ) AS qty,
|
||||
ANY_VALUE( vm.create_name ) AS create_name,
|
||||
ANY_VALUE( vm.create_time ) AS create_time
|
||||
vm.create_name,
|
||||
vm.create_time
|
||||
FROM
|
||||
md_pb_vehicle vehicle
|
||||
LEFT JOIN st_ivt_vehicle_material vm ON vehicle.vehicle_id = vm.vehicle_id
|
||||
WHERE
|
||||
vehicle.vehicle_status = '2'
|
||||
AND vm.vm_id IS NOT NULL
|
||||
OPTION 输入.vehicle_code <> ""
|
||||
vehicle.vehicle_code LIKE CONCAT( '%', 输入.vehicle_code, '%' )
|
||||
ENDOPTION
|
||||
|
||||
Reference in New Issue
Block a user