32 changed files with 665 additions and 1164 deletions
@ -1,39 +0,0 @@ |
|||
package org.nl.wms.pda.callmaterial.rest; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.modules.logging.annotation.Log; |
|||
import org.nl.wms.pda.callmaterial.service.CallMaterialService; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
@RestController |
|||
@RequiredArgsConstructor |
|||
@Api(tags = "手持叫料") |
|||
@RequestMapping("api/pda/callMaterial") |
|||
@Slf4j |
|||
public class CallMaterialController { |
|||
|
|||
private final CallMaterialService callMaterialService; |
|||
|
|||
@PostMapping("/queryPoint") |
|||
@Log("查询区域点位") |
|||
@ApiOperation("查询区域点位") |
|||
public ResponseEntity<Object> queryPoint() { |
|||
return new ResponseEntity<>(callMaterialService.queryPoint(), HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping("/confirm") |
|||
@Log("叫料确定") |
|||
@ApiOperation("叫料确定") |
|||
public ResponseEntity<Object> confirm(@RequestBody JSONObject whereJson) { |
|||
return new ResponseEntity<>(callMaterialService.confirm(whereJson), HttpStatus.OK); |
|||
} |
|||
} |
@ -1,19 +0,0 @@ |
|||
package org.nl.wms.pda.callmaterial.service; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
|
|||
public interface CallMaterialService { |
|||
|
|||
/** |
|||
* 查询区域点位 |
|||
* @return json |
|||
*/ |
|||
JSONObject queryPoint(); |
|||
|
|||
/** |
|||
* 叫料确定 |
|||
* @param whereJson / |
|||
* @return JSONObject |
|||
*/ |
|||
JSONObject confirm(JSONObject whereJson); |
|||
} |
@ -1,55 +0,0 @@ |
|||
package org.nl.wms.pda.callmaterial.service.impl; |
|||
|
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.modules.wql.WQL; |
|||
import org.nl.wms.ext.acs.service.AcsToWmsService; |
|||
import org.nl.wms.pda.callmaterial.service.CallMaterialService; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
@Service |
|||
@RequiredArgsConstructor |
|||
@Slf4j |
|||
public class CallMaterialServiceImpl implements CallMaterialService { |
|||
private final AcsToWmsService acsToWmsService; |
|||
|
|||
@Override |
|||
public JSONObject queryPoint() { |
|||
JSONObject resultJSON = new JSONObject(); |
|||
|
|||
// 查询压机 9 10 的料盅位
|
|||
JSONArray points = WQL.getWO("PDA_CALLMATERIAL").addParam("flag", "1").process().getResultJSONArray(0); |
|||
|
|||
resultJSON.put("code", "1"); |
|||
resultJSON.put("desc", "操作成功!"); |
|||
resultJSON.put("result", points); |
|||
return resultJSON; |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public JSONObject confirm(JSONObject whereJson) { |
|||
JSONObject result = new JSONObject(); |
|||
// 1、准备参数:point_code、type = 4
|
|||
JSONObject param = new JSONObject(); |
|||
param.put("type", "4"); |
|||
param.put("point_code", whereJson.getString("point_code")); |
|||
// 2、调用接口
|
|||
JSONObject json = acsToWmsService.apply(param); |
|||
if (ObjectUtil.isEmpty(json) || StrUtil.equals(json.getString("status"), "200")) { |
|||
result.put("result", ""); |
|||
result.put("code", "1"); |
|||
result.put("desc", "操作成功"); |
|||
} else { |
|||
result.put("result", ""); |
|||
result.put("code", "0"); |
|||
result.put("desc", "操作失败:" + json.getString("message")); |
|||
} |
|||
return result; |
|||
} |
|||
} |
@ -1,77 +0,0 @@ |
|||
[交易说明] |
|||
交易名: 手持叫料查询 |
|||
所属模块: |
|||
功能简述: |
|||
版权所有: |
|||
表引用: |
|||
版本经历: |
|||
|
|||
[数据库] |
|||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库 |
|||
|
|||
[IO定义] |
|||
################################################# |
|||
## 表字段对应输入参数 |
|||
################################################# |
|||
输入.flag TYPEAS s_string |
|||
输入.region_id TYPEAS s_string |
|||
|
|||
[临时表] |
|||
--这边列出来的临时表就会在运行期动态创建 |
|||
|
|||
[临时变量] |
|||
--所有中间过程变量均可在此处定义 |
|||
|
|||
[业务过程] |
|||
|
|||
########################################## |
|||
# 1、输入输出检查 # |
|||
########################################## |
|||
|
|||
|
|||
########################################## |
|||
# 2、主过程前处理 # |
|||
########################################## |
|||
|
|||
|
|||
########################################## |
|||
# 3、业务主过程 # |
|||
########################################## |
|||
|
|||
IF 输入.flag = "1" |
|||
QUERY |
|||
SELECT |
|||
point_id, |
|||
point_code, |
|||
point_name |
|||
FROM |
|||
sch_base_point |
|||
WHERE |
|||
is_used = '1' |
|||
AND is_delete = '0' |
|||
AND region_code = 'KLHJ' |
|||
AND point_type = '3' |
|||
ENDSELECT |
|||
ENDQUERY |
|||
ENDIF |
|||
|
|||
IF 输入.flag = "2" |
|||
QUERY |
|||
SELECT |
|||
point_id, |
|||
point_code, |
|||
point_name |
|||
FROM |
|||
sch_base_point |
|||
WHERE |
|||
is_used = '1' |
|||
AND is_delete = '0' |
|||
AND point_type = '3' |
|||
|
|||
OPTION 输入.region_id <> "" |
|||
region_id = 输入.region_id |
|||
ENDOPTION |
|||
|
|||
ENDSELECT |
|||
ENDQUERY |
|||
ENDIF |
@ -1,40 +0,0 @@ |
|||
package org.nl.wms.pda.callvehicle.rest; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.modules.logging.annotation.Log; |
|||
import org.nl.wms.pda.callvehicle.service.CallVehicleService; |
|||
import org.nl.wms.pda.sendmaterial.service.SendMaterialService; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
@RestController |
|||
@RequiredArgsConstructor |
|||
@Api(tags = "手持呼叫空托盘") |
|||
@RequestMapping("api/pda/callEmpty") |
|||
@Slf4j |
|||
public class CallVehicleController { |
|||
|
|||
private final CallVehicleService callVehicleService; |
|||
|
|||
@PostMapping("/queryPoint") |
|||
@Log("查询区域点位") |
|||
@ApiOperation("查询区域点位") |
|||
public ResponseEntity<Object> queryPoint() { |
|||
return new ResponseEntity<>(callVehicleService.queryPoint(), HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping("/confirm") |
|||
@Log("呼叫空托盘确定") |
|||
@ApiOperation("呼叫空托盘确定") |
|||
public ResponseEntity<Object> confirm(@RequestBody JSONObject whereJson) { |
|||
return new ResponseEntity<>(callVehicleService.confirm(whereJson), HttpStatus.OK); |
|||
} |
|||
} |
@ -1,19 +0,0 @@ |
|||
package org.nl.wms.pda.callvehicle.service; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
|
|||
public interface CallVehicleService { |
|||
|
|||
/** |
|||
* 查询区域点位 |
|||
* @return JSONObject |
|||
*/ |
|||
JSONObject queryPoint(); |
|||
|
|||
/** |
|||
* 呼叫空托盘确定 |
|||
* @param whereJson / |
|||
* @return JSONObject |
|||
*/ |
|||
JSONObject confirm(JSONObject whereJson); |
|||
} |
@ -1,70 +0,0 @@ |
|||
package org.nl.wms.pda.callvehicle.service.impl; |
|||
|
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.alibaba.fastjson.JSONArray; |
|||
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.wms.ext.acs.service.AcsToWmsService; |
|||
import org.nl.wms.pda.callvehicle.service.CallVehicleService; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
@Service |
|||
@RequiredArgsConstructor |
|||
@Slf4j |
|||
public class CallVehicleServiceImpl implements CallVehicleService { |
|||
|
|||
private final AcsToWmsService acsToWmsService; |
|||
|
|||
@Override |
|||
public JSONObject queryPoint() { |
|||
JSONObject result = new JSONObject(); |
|||
// 1.查询区域:油漆区域 YQQY01、共挤区域 GJQY01
|
|||
JSONArray regionArr = WQL.getWO("PDA_CALLVEHICLE_01").addParam("flag", "1").process().getResultJSONArray(0); |
|||
// 2.根据区域查询对应的物料上料位
|
|||
JSONObject resultJson = new JSONObject(); |
|||
for (int i = 0; i < regionArr.size(); i++) { |
|||
JSONObject jsonRegion = regionArr.getJSONObject(i); |
|||
JSONArray pointArr = WQL.getWO("PDA_CALLVEHICLE_01").addParam("flag", "2").addParam("region_id", jsonRegion.getString("region_id")).process().getResultJSONArray(0); |
|||
jsonRegion.put("pointArr", pointArr); |
|||
} |
|||
resultJson.put("regionja", regionArr); |
|||
result.put("result", resultJson); |
|||
result.put("code", "1"); |
|||
result.put("desc", "查询成功"); |
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public JSONObject confirm(JSONObject whereJson) { |
|||
JSONObject result = new JSONObject(); |
|||
// 1、准备参数:point_code、type:1为共挤区域,3为油漆区域
|
|||
JSONObject param = new JSONObject(); |
|||
|
|||
String region_id = whereJson.getString("region_id"); |
|||
JSONObject jsonObject = WQLObject.getWQLObject("sch_base_region").query("region_id ='" + region_id + "'").uniqueResult(0); |
|||
String region_code = jsonObject.getString("region_code"); |
|||
if (StrUtil.equals(region_code, "GJQY01")) param.put("type", "1"); |
|||
if (StrUtil.equals(region_code, "YQQY01")) param.put("type", "3"); |
|||
|
|||
param.put("point_code", whereJson.getString("point_code")); |
|||
param.put("vehicle_num", whereJson.getString("qty")); |
|||
// 2、调用接口
|
|||
JSONObject json = acsToWmsService.apply(param); |
|||
if (ObjectUtil.isEmpty(json) || StrUtil.equals(json.getString("status"), "200")) { |
|||
result.put("result", ""); |
|||
result.put("code", "1"); |
|||
result.put("desc", "操作成功"); |
|||
} else { |
|||
result.put("result", ""); |
|||
result.put("code", "0"); |
|||
result.put("desc", "操作失败:" + json.getString("message")); |
|||
} |
|||
return result; |
|||
} |
|||
} |
@ -1,89 +0,0 @@ |
|||
package org.nl.wms.pda.check.rest; |
|||
|
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.modules.logging.annotation.Log; |
|||
import org.nl.wms.pda.check.service.CheckService; |
|||
import org.nl.wms.pda.util.PdaUtils; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
/** |
|||
* 辽宁晟华盘点管理控制层 |
|||
* |
|||
* @author 张江玮 |
|||
* @date 2022/11/30 14:47 |
|||
*/ |
|||
@RestController |
|||
@RequiredArgsConstructor |
|||
@Api(tags = "盘点管理") |
|||
@RequestMapping("api/pda/check") |
|||
@Slf4j |
|||
public class CheckController { |
|||
|
|||
private final CheckService checkService; |
|||
|
|||
@PostMapping("/queryMaterial") |
|||
@Log("查询物料") |
|||
@ApiOperation("查询物料") |
|||
public ResponseEntity<JSONObject> queryMaterial() { |
|||
log.info("手持 [盘点管理]-[查询物料] 接口被访问"); |
|||
|
|||
return PdaUtils.buildSuccessResponseEntity(checkService.queryMaterial()); |
|||
} |
|||
|
|||
@PostMapping("/queryIvt") |
|||
@Log("查询盘点单据") |
|||
@ApiOperation("查询盘点单据") |
|||
public ResponseEntity<JSONObject> queryIvt() { |
|||
log.info("手持 [盘点管理]-[查询盘点单据] 接口被访问"); |
|||
|
|||
return PdaUtils.buildSuccessResponseEntity(checkService.queryIvt()); |
|||
} |
|||
|
|||
@PostMapping("/confirm") |
|||
@Log("盘点确定") |
|||
@ApiOperation("盘点确定") |
|||
public ResponseEntity<JSONObject> confirm(@RequestBody JSONObject param) { |
|||
log.info("手持 [盘点管理]-[盘点确定] 接口被访问, 请求参数-{}", param); |
|||
|
|||
JSONArray structs = param.getJSONArray("JSONarray"); |
|||
if (ObjectUtil.isEmpty(structs)) { |
|||
return PdaUtils.buildFailResponseEntity("请选择仓位"); |
|||
} |
|||
|
|||
return PdaUtils.buildSuccessResponseEntity(checkService.confirm(structs)); |
|||
} |
|||
|
|||
@PostMapping("/querySectCode") |
|||
@Log("查询库区") |
|||
@ApiOperation("查询库区") |
|||
public ResponseEntity<JSONObject> querySectCode() { |
|||
log.info("手持 [盘点管理]-[查询库区] 接口被访问"); |
|||
|
|||
return PdaUtils.buildSuccessResponseEntity(checkService.querySectCode()); |
|||
} |
|||
|
|||
@PostMapping("/queryStructCode") |
|||
@Log("查询仓位") |
|||
@ApiOperation("查询仓位") |
|||
public ResponseEntity<JSONObject> queryStructCode(@RequestBody JSONObject param) { |
|||
log.info("手持 [盘点管理]-[查询仓位] 接口被访问, 请求参数-{}", param); |
|||
|
|||
String region_id = param.getString("sect_uuid"); |
|||
if (StrUtil.isEmpty(region_id)) { |
|||
return PdaUtils.buildFailResponseEntity("库区不能为空"); |
|||
} |
|||
|
|||
return PdaUtils.buildSuccessResponseEntity(checkService.queryStructCode(region_id)); |
|||
} |
|||
} |
@ -1,50 +0,0 @@ |
|||
package org.nl.wms.pda.check.service; |
|||
|
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
|
|||
/** |
|||
* 辽宁晟华盘点管理服务层接口 |
|||
* |
|||
* @author 张江玮 |
|||
* @date 2022/11/30 14:50 |
|||
*/ |
|||
public interface CheckService { |
|||
|
|||
/** |
|||
* 查询物料 |
|||
* |
|||
* @return 物料信息 |
|||
*/ |
|||
JSONArray queryMaterial(); |
|||
|
|||
/** |
|||
* 查询盘点单据 |
|||
* |
|||
* @return 盘点单据信息 |
|||
*/ |
|||
JSONObject queryIvt(); |
|||
|
|||
/** |
|||
* 盘点确定 |
|||
* |
|||
* @param structs 选择的仓位 |
|||
* @return 操作提示 |
|||
*/ |
|||
JSONObject confirm(JSONArray structs); |
|||
|
|||
/** |
|||
* 查询库区 |
|||
* |
|||
* @return 库区信息 |
|||
*/ |
|||
JSONArray querySectCode(); |
|||
|
|||
/** |
|||
* 查询仓位 |
|||
* |
|||
* @param region_id 库区id |
|||
* @return 仓位信息 |
|||
*/ |
|||
JSONArray queryStructCode(String region_id); |
|||
} |
@ -1,80 +0,0 @@ |
|||
package org.nl.wms.pda.check.service.impl; |
|||
|
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.modules.wql.WQL; |
|||
import org.nl.wms.pda.check.service.CheckService; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
/** |
|||
* 辽宁晟华盘点管理服务层实现类 |
|||
* |
|||
* @author 张江玮 |
|||
* @date 2022/11/30 14:50 |
|||
*/ |
|||
@Service |
|||
@RequiredArgsConstructor |
|||
@Slf4j |
|||
public class CheckServiceImpl implements CheckService { |
|||
|
|||
@Override |
|||
public JSONArray queryMaterial() { |
|||
return WQL |
|||
.getWO("PDA_CHECK") |
|||
.addParam("flag", "1") |
|||
.process() |
|||
.getResultJSONArray(0); |
|||
} |
|||
|
|||
/** |
|||
* 查询盘点单据 |
|||
* |
|||
* @return 盘点单据信息 |
|||
*/ |
|||
@Override |
|||
public JSONObject queryIvt() { |
|||
return null; |
|||
} |
|||
|
|||
/** |
|||
* 盘点确定 |
|||
* |
|||
* @param structs 选择的仓位 |
|||
* @return 操作提示 |
|||
*/ |
|||
@Override |
|||
public JSONObject confirm(JSONArray structs) { |
|||
return null; |
|||
} |
|||
|
|||
/** |
|||
* 查询库区 |
|||
* |
|||
* @return 库区信息 |
|||
*/ |
|||
@Override |
|||
public JSONArray querySectCode() { |
|||
return WQL |
|||
.getWO("PDA_CHECK") |
|||
.addParam("flag", "4") |
|||
.process() |
|||
.getResultJSONArray(0); |
|||
} |
|||
|
|||
/** |
|||
* 查询仓位 |
|||
* |
|||
* @param region_id 库区id |
|||
* @return 仓位信息 |
|||
*/ |
|||
@Override |
|||
public JSONArray queryStructCode(String region_id) { |
|||
return WQL |
|||
.getWO("PDA_CHECK") |
|||
.addParam("flag", "5") |
|||
.process() |
|||
.getResultJSONArray(0); |
|||
} |
|||
} |
@ -1,91 +0,0 @@ |
|||
[交易说明] |
|||
交易名: 手持叫料查询 |
|||
所属模块: |
|||
功能简述: |
|||
版权所有: |
|||
表引用: |
|||
版本经历: |
|||
|
|||
[数据库] |
|||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库 |
|||
|
|||
[IO定义] |
|||
################################################# |
|||
## 表字段对应输入参数 |
|||
################################################# |
|||
输入.flag TYPEAS s_string |
|||
输入.region_id TYPEAS s_string |
|||
|
|||
[临时表] |
|||
--这边列出来的临时表就会在运行期动态创建 |
|||
|
|||
[临时变量] |
|||
--所有中间过程变量均可在此处定义 |
|||
|
|||
[业务过程] |
|||
|
|||
########################################## |
|||
# 1、输入输出检查 # |
|||
########################################## |
|||
|
|||
|
|||
########################################## |
|||
# 2、主过程前处理 # |
|||
########################################## |
|||
|
|||
|
|||
########################################## |
|||
# 3、业务主过程 # |
|||
########################################## |
|||
|
|||
IF 输入.flag = "1" |
|||
QUERY |
|||
SELECT |
|||
material_id AS 'material_uuid', |
|||
material_code, |
|||
material_name |
|||
FROM |
|||
md_me_materialbase |
|||
ENDSELECT |
|||
ENDQUERY |
|||
ENDIF |
|||
|
|||
IF 输入.flag = "2" |
|||
ENDIF |
|||
|
|||
IF 输入.flag = "3" |
|||
ENDIF |
|||
|
|||
IF 输入.flag = "4" |
|||
QUERY |
|||
SELECT |
|||
region_id AS 'sect_uuid', |
|||
region_code AS 'sect_code', |
|||
region_name AS 'sect_name' |
|||
FROM |
|||
sch_base_region |
|||
WHERE |
|||
region_code IN ( 'KLHJ', 'RYZCQ', 'CYZCQ', 'BZZCQ' ) |
|||
ENDSELECT |
|||
ENDQUERY |
|||
ENDIF |
|||
|
|||
IF 输入.flag = "5" |
|||
QUERY |
|||
SELECT |
|||
point_id AS 'struct_uuid', |
|||
point_code AS 'struct_code', |
|||
point_name AS 'struct_name' |
|||
FROM |
|||
sch_base_point |
|||
WHERE |
|||
is_used = '1' |
|||
AND is_delete = '0' |
|||
OPTION 输入.region_id <> "" |
|||
region_id = 输入.region_id |
|||
ENDOPTION |
|||
ORDER BY |
|||
point_code |
|||
ENDSELECT |
|||
ENDQUERY |
|||
ENDIF |
@ -0,0 +1,222 @@ |
|||
package org.nl.wms.pda.rest; |
|||
|
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.modules.logging.annotation.Log; |
|||
import org.nl.wms.pda.service.PdaService; |
|||
import org.nl.wms.pda.util.PdaUtils; |
|||
import org.nl.wms.sch.manage.RegionEnum; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
/** |
|||
* 辽宁晟华手持控制层 |
|||
* |
|||
* @author 张江玮 |
|||
* @date 2022/12/02 10:02 |
|||
*/ |
|||
@RestController |
|||
@RequiredArgsConstructor |
|||
@Api(tags = "辽宁晟华手持") |
|||
@RequestMapping("/api/pda") |
|||
@Slf4j |
|||
public class PdaController { |
|||
|
|||
private final PdaService pdaService; |
|||
|
|||
@PostMapping("/warehouse") |
|||
@Log("查询所有库区") |
|||
@ApiOperation("查询所有库区") |
|||
public ResponseEntity<JSONObject> warehouse() { |
|||
log.info("辽宁晟华手持 [查询所有库区] 接口被请求"); |
|||
|
|||
try { |
|||
return PdaUtils.buildSuccessResponseEntity(pdaService.warehouse()); |
|||
} catch (Exception e) { |
|||
return PdaUtils.buildFailResponseEntity(e.getMessage()); |
|||
} |
|||
} |
|||
|
|||
@PostMapping("/point") |
|||
@Log("根据区域查询点位") |
|||
@ApiOperation("根据区域查询点位") |
|||
public ResponseEntity<JSONObject> point(@RequestBody JSONObject param) { |
|||
log.info("辽宁晟华手持 [根据区域查询点位] 接口被请求, 请求参数-{}", param); |
|||
|
|||
String region_code = param.getString("region_code"); |
|||
if (StrUtil.isEmpty(region_code)) { |
|||
return PdaUtils.buildFailResponseEntity("区域不能为空"); |
|||
} |
|||
|
|||
try { |
|||
return PdaUtils.buildSuccessResponseEntity(pdaService.point(region_code)); |
|||
} catch (Exception e) { |
|||
return PdaUtils.buildFailResponseEntity(e.getMessage()); |
|||
} |
|||
} |
|||
|
|||
@PostMapping("/pointInfo") |
|||
@Log("查询点位详细信息") |
|||
@ApiOperation("查询点位详细信息") |
|||
public ResponseEntity<JSONObject> pointInfo(@RequestBody JSONObject param) { |
|||
log.info("辽宁晟华手持 [查询点位详细信息] 接口被请求, 请求参数-{}", param); |
|||
|
|||
String region_code = param.getString("region_code"); |
|||
if (StrUtil.isEmpty(region_code)) { |
|||
return PdaUtils.buildFailResponseEntity("区域不能为空"); |
|||
} |
|||
String point_code = param.getString("point_code"); |
|||
if (StrUtil.isEmpty(point_code)) { |
|||
return PdaUtils.buildFailResponseEntity("点位不能为空"); |
|||
} |
|||
|
|||
try { |
|||
return PdaUtils.buildSuccessResponseEntity(pdaService.pointInfo(region_code, point_code)); |
|||
} catch (Exception e) { |
|||
return PdaUtils.buildFailResponseEntity(e.getMessage()); |
|||
} |
|||
} |
|||
|
|||
@PostMapping("/material") |
|||
@Log("查询物料") |
|||
@ApiOperation("查询物料") |
|||
public ResponseEntity<JSONObject> material(@RequestBody JSONObject param) { |
|||
log.info("辽宁晟华手持 [查询物料] 接口被请求, 请求参数-{}", param); |
|||
|
|||
try { |
|||
return PdaUtils.buildSuccessResponseEntity(pdaService.material( |
|||
param.getString("condition") |
|||
)); |
|||
} catch (Exception e) { |
|||
return PdaUtils.buildFailResponseEntity(e.getMessage()); |
|||
} |
|||
} |
|||
|
|||
@PostMapping("/stockOperation") |
|||
@Log("库存操作") |
|||
@ApiOperation("库存操作") |
|||
public ResponseEntity<JSONObject> stockOperation(@RequestBody JSONObject param) { |
|||
log.info("辽宁晟华手持 [库存操作] 接口被请求, 请求参数-{}", param); |
|||
|
|||
try { |
|||
String type = param.getString("type"); |
|||
if (StrUtil.isEmpty(type)) { |
|||
return PdaUtils.buildFailResponseEntity("请点击确认或清空"); |
|||
} else { |
|||
String region_code = param.getString("region_code"); |
|||
if (StrUtil.isEmpty(region_code)) { |
|||
return PdaUtils.buildFailResponseEntity("区域不能为空"); |
|||
} |
|||
String point_code = param.getString("point_code"); |
|||
if (StrUtil.isEmpty(point_code)) { |
|||
return PdaUtils.buildFailResponseEntity("点位不能为空"); |
|||
} |
|||
|
|||
switch (type) { |
|||
case "1": |
|||
// 确认
|
|||
String vehicle_code = param.getString("vehicle_code"); |
|||
if (!StrUtil.equals(region_code, RegionEnum.RYZCQ.getCode()) && StrUtil.isEmpty(vehicle_code)) { |
|||
return PdaUtils.buildFailResponseEntity("载具编码不能为空"); |
|||
} |
|||
String qty = param.getString("qty"); |
|||
if (StrUtil.isEmpty(qty)) { |
|||
return PdaUtils.buildFailResponseEntity("物料数量/重量不能为空"); |
|||
} |
|||
String is_full = param.getString("is_full"); |
|||
if (StrUtil.isEmpty(is_full)) { |
|||
return PdaUtils.buildFailResponseEntity("是否满托不能为空"); |
|||
} |
|||
|
|||
pdaService.updateStock(region_code, point_code, vehicle_code, qty, is_full); |
|||
break; |
|||
case "2": |
|||
// 清空
|
|||
pdaService.emptyStock(point_code); |
|||
break; |
|||
default: |
|||
return PdaUtils.buildFailResponseEntity("操作错误"); |
|||
} |
|||
|
|||
return PdaUtils.buildSuccessResponseEntity(null); |
|||
} |
|||
} catch (Exception e) { |
|||
return PdaUtils.buildFailResponseEntity(e.getMessage()); |
|||
} |
|||
} |
|||
|
|||
@PostMapping("/queryYZCallMaterialPoint") |
|||
@Log("查询压制叫料点位") |
|||
@ApiOperation("查询压制叫料点位") |
|||
public ResponseEntity<JSONObject> queryYZCallMaterialPoint() { |
|||
log.info("辽宁晟华手持 [查询压制叫料点位] 接口被请求"); |
|||
|
|||
try { |
|||
return PdaUtils.buildSuccessResponseEntity(pdaService.queryYZCallMaterialPoint()); |
|||
} catch (Exception e) { |
|||
return PdaUtils.buildFailResponseEntity(e.getMessage()); |
|||
} |
|||
} |
|||
|
|||
@PostMapping("/yzCallMaterial") |
|||
@Log("压制叫料") |
|||
@ApiOperation("压制叫料") |
|||
public ResponseEntity<JSONObject> yzCallMaterial(@RequestBody JSONObject param) { |
|||
log.info("辽宁晟华手持 [压制叫料] 接口被请求, 请求参数-{}", param); |
|||
|
|||
String point_code = param.getString("point_code"); |
|||
if (StrUtil.isEmpty(point_code)) { |
|||
return PdaUtils.buildFailResponseEntity("点位不能为空"); |
|||
} |
|||
|
|||
try { |
|||
pdaService.yzCallMaterial(point_code); |
|||
return PdaUtils.buildSuccessResponseEntity(null); |
|||
} catch (Exception e) { |
|||
return PdaUtils.buildFailResponseEntity(e.getMessage()); |
|||
} |
|||
} |
|||
|
|||
@PostMapping("/queryEmptyCupPoint") |
|||
@Log("查询空盅点位") |
|||
@ApiOperation("查询空盅点位") |
|||
public ResponseEntity<JSONObject> queryEmptyCupPoint() { |
|||
log.info("辽宁晟华手持 [查询空盅点位] 接口被请求"); |
|||
|
|||
try { |
|||
return PdaUtils.buildSuccessResponseEntity(pdaService.queryEmptyCupPoint()); |
|||
} catch (Exception e) { |
|||
return PdaUtils.buildFailResponseEntity(e.getMessage()); |
|||
} |
|||
} |
|||
|
|||
@PostMapping("/sendEmptyCup") |
|||
@Log("送空盅") |
|||
@ApiOperation("送空盅") |
|||
public ResponseEntity<JSONObject> sendEmptyCup(@RequestBody JSONObject param) { |
|||
log.info("辽宁晟华手持 [送空盅] 接口被请求, 请求参数-{}", param); |
|||
|
|||
String point_code = param.getString("point_code"); |
|||
if (StrUtil.isEmpty(point_code)) { |
|||
return PdaUtils.buildFailResponseEntity("点位不能为空"); |
|||
} |
|||
String vehicle_code = param.getString("vehicle_code"); |
|||
if (StrUtil.isEmpty(vehicle_code)) { |
|||
return PdaUtils.buildFailResponseEntity("料盅编码不能为空"); |
|||
} |
|||
|
|||
try { |
|||
pdaService.sendEmptyCup(point_code, vehicle_code); |
|||
return PdaUtils.buildSuccessResponseEntity(null); |
|||
} catch (Exception e) { |
|||
return PdaUtils.buildFailResponseEntity(e.getMessage()); |
|||
} |
|||
} |
|||
} |
@ -1,88 +0,0 @@ |
|||
package org.nl.wms.pda.sendempty.rest; |
|||
|
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.modules.logging.annotation.Log; |
|||
import org.nl.wms.pda.sendempty.service.SendEmptyService; |
|||
import org.nl.wms.pda.util.PdaUtils; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
/** |
|||
* 辽宁晟华托盘点位绑定控制层 |
|||
* |
|||
* @author 张江玮 |
|||
* @date 2022/11/30 16:29 |
|||
*/ |
|||
@RestController |
|||
@RequiredArgsConstructor |
|||
@Api(tags = "托盘点位绑定") |
|||
@RequestMapping("api/pda") |
|||
@Slf4j |
|||
public class SendEmptyController { |
|||
|
|||
private final SendEmptyService sendEmptyService; |
|||
|
|||
@PostMapping("/sendEmpty/queryArea") |
|||
@Log("查询区域") |
|||
@ApiOperation("查询区域") |
|||
public ResponseEntity<JSONObject> queryArea() { |
|||
log.info("手持 [托盘点位绑定]-[查询区域] 接口被访问"); |
|||
|
|||
return PdaUtils.buildSuccessResponseEntity(sendEmptyService.queryArea()); |
|||
} |
|||
|
|||
@PostMapping("/sendEmpty/queryPointByArea") |
|||
@Log("根据区域查询点位") |
|||
@ApiOperation("根据区域查询点位") |
|||
public ResponseEntity<JSONObject> queryPointByArea(@RequestBody JSONObject param) { |
|||
log.info("手持 [托盘点位绑定]-[根据区域查询点位] 接口被访问, 请求参数-{}", param); |
|||
|
|||
String region_code = param.getString("area_code"); |
|||
if (StrUtil.isEmpty(region_code)) { |
|||
return PdaUtils.buildFailResponseEntity("区域不能为空"); |
|||
} |
|||
|
|||
return PdaUtils.buildSuccessResponseEntity(sendEmptyService.queryPointByArea(region_code)); |
|||
} |
|||
|
|||
@PostMapping("/binding/confirm") |
|||
@Log("托盘点位绑定确认") |
|||
@ApiOperation("托盘点位绑定确认") |
|||
public ResponseEntity<JSONObject> confirm(@RequestBody JSONObject param) { |
|||
log.info("手持 [托盘点位绑定]-[托盘点位绑定确认] 接口被访问, 请求参数-{}", param); |
|||
|
|||
String point_code = param.getString("point_code"); |
|||
if (StrUtil.isEmpty(point_code)) { |
|||
return PdaUtils.buildFailResponseEntity("点位不能为空"); |
|||
} |
|||
String vehicle_code = param.getString("vehicle_code"); |
|||
if (StrUtil.isEmpty(vehicle_code)) { |
|||
return PdaUtils.buildFailResponseEntity("托盘条码不能为空"); |
|||
} |
|||
String point_status = param.getString("point_status"); |
|||
if (StrUtil.isEmpty(point_status)) { |
|||
return PdaUtils.buildFailResponseEntity("点位状态不能为空"); |
|||
} |
|||
String lock_type = param.getString("is_lock"); |
|||
if (StrUtil.isEmpty(lock_type)) { |
|||
return PdaUtils.buildFailResponseEntity("是否锁定不能为空"); |
|||
} |
|||
|
|||
sendEmptyService.confirm( |
|||
point_code, |
|||
vehicle_code, |
|||
String.valueOf(Integer.parseInt(point_status.substring(1)) + 1), |
|||
lock_type |
|||
); |
|||
|
|||
return PdaUtils.buildSuccessResponseEntity(null); |
|||
} |
|||
} |
@ -1,38 +0,0 @@ |
|||
package org.nl.wms.pda.sendempty.service; |
|||
|
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
|
|||
/** |
|||
* 辽宁晟华托盘点位绑定服务层接口 |
|||
* |
|||
* @author 张江玮 |
|||
* @date 2022/11/30 16:51 |
|||
*/ |
|||
public interface SendEmptyService { |
|||
|
|||
/** |
|||
* 查询区域 |
|||
* |
|||
* @return 所有区域 |
|||
*/ |
|||
JSONArray queryArea(); |
|||
|
|||
/** |
|||
* 根据区域查询点位 |
|||
* |
|||
* @param region_code 区域编码 |
|||
* @return 该区域下的所有点位信息 |
|||
*/ |
|||
JSONArray queryPointByArea(String region_code); |
|||
|
|||
/** |
|||
* 托盘点位绑定确认 |
|||
* |
|||
* @param point_code 点位编码 |
|||
* @param vehicle_code 托盘编码 |
|||
* @param point_status 点位状态 |
|||
* @param lock_type 是否锁定 |
|||
*/ |
|||
void confirm(String point_code, String vehicle_code, String point_status, String lock_type); |
|||
} |
@ -1,63 +0,0 @@ |
|||
package org.nl.wms.pda.sendempty.service.impl; |
|||
|
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.modules.wql.WQL; |
|||
import org.nl.wms.pda.sendempty.service.SendEmptyService; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
/** |
|||
* 辽宁晟华托盘点位绑定服务层实现类 |
|||
* |
|||
* @author 张江玮 |
|||
* @date 2022/11/30 16:51 |
|||
*/ |
|||
@Service |
|||
@RequiredArgsConstructor |
|||
@Slf4j |
|||
public class SendEmptyServiceImpl implements SendEmptyService { |
|||
|
|||
/** |
|||
* 查询区域 |
|||
* |
|||
* @return 所有区域 |
|||
*/ |
|||
@Override |
|||
public JSONArray queryArea() { |
|||
return WQL |
|||
.getWO("PDA_SENDEMPTY") |
|||
.addParam("flag", "1") |
|||
.process() |
|||
.getResultJSONArray(0); |
|||
} |
|||
|
|||
/** |
|||
* 根据区域查询点位 |
|||
* |
|||
* @param region_code 区域编码 |
|||
* @return 该区域下的所有点位信息 |
|||
*/ |
|||
@Override |
|||
public JSONArray queryPointByArea(String region_code) { |
|||
return WQL |
|||
.getWO("PDA_SENDEMPTY") |
|||
.addParam("flag", "2") |
|||
.process() |
|||
.getResultJSONArray(0); |
|||
} |
|||
|
|||
/** |
|||
* 托盘点位绑定确认 |
|||
* |
|||
* @param point_code 点位编码 |
|||
* @param vehicle_code 托盘编码 |
|||
* @param point_status 点位状态 |
|||
* @param lock_type 是否锁定 |
|||
*/ |
|||
@Override |
|||
public void confirm(String point_code, String vehicle_code, String point_status, String lock_type) { |
|||
|
|||
} |
|||
} |
@ -1,67 +0,0 @@ |
|||
[交易说明] |
|||
交易名: 手持叫料查询 |
|||
所属模块: |
|||
功能简述: |
|||
版权所有: |
|||
表引用: |
|||
版本经历: |
|||
|
|||
[数据库] |
|||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库 |
|||
|
|||
[IO定义] |
|||
################################################# |
|||
## 表字段对应输入参数 |
|||
################################################# |
|||
输入.flag TYPEAS s_string |
|||
输入.region_code TYPEAS s_string |
|||
|
|||
[临时表] |
|||
--这边列出来的临时表就会在运行期动态创建 |
|||
|
|||
[临时变量] |
|||
--所有中间过程变量均可在此处定义 |
|||
|
|||
[业务过程] |
|||
|
|||
########################################## |
|||
# 1、输入输出检查 # |
|||
########################################## |
|||
|
|||
|
|||
########################################## |
|||
# 2、主过程前处理 # |
|||
########################################## |
|||
|
|||
|
|||
########################################## |
|||
# 3、业务主过程 # |
|||
########################################## |
|||
|
|||
IF 输入.flag = "1" |
|||
QUERY |
|||
SELECT |
|||
region_code AS 'area_code', |
|||
region_name AS 'area_name' |
|||
FROM |
|||
sch_base_region |
|||
ENDSELECT |
|||
ENDQUERY |
|||
ENDIF |
|||
|
|||
IF 输入.flag = "2" |
|||
QUERY |
|||
SELECT |
|||
point_id, |
|||
point_code, |
|||
point_name |
|||
FROM |
|||
sch_base_point |
|||
WHERE |
|||
is_used = '1' |
|||
AND is_delete = '0' |
|||
OPTION 输入.region_code <> "" |
|||
region_code = 输入.region_code |
|||
ENDOPTION |
|||
ENDQUERY |
|||
ENDIF |
@ -1,39 +0,0 @@ |
|||
package org.nl.wms.pda.sendmaterial.rest; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.modules.logging.annotation.Log; |
|||
import org.nl.wms.pda.sendmaterial.service.SendMaterialService; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
@RestController |
|||
@RequiredArgsConstructor |
|||
@Api(tags = "手持送料") |
|||
@RequestMapping("api/pda/sendMaterial") |
|||
@Slf4j |
|||
public class SendMaterialController { |
|||
|
|||
private final SendMaterialService sendMaterialService; |
|||
|
|||
@PostMapping("/queryPoint") |
|||
@Log("查询区域点位") |
|||
@ApiOperation("查询区域点位") |
|||
public ResponseEntity<Object> queryPoint() { |
|||
return new ResponseEntity<>(sendMaterialService.queryPoint(), HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping("/confirm") |
|||
@Log("送料确定") |
|||
@ApiOperation("送料确定") |
|||
public ResponseEntity<Object> confirm(@RequestBody JSONObject whereJson) { |
|||
return new ResponseEntity<>(sendMaterialService.confirm(whereJson), HttpStatus.OK); |
|||
} |
|||
} |
@ -1,19 +0,0 @@ |
|||
package org.nl.wms.pda.sendmaterial.service; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
|
|||
public interface SendMaterialService { |
|||
|
|||
/** |
|||
* 查询区域点位 |
|||
* @return JSONObject |
|||
*/ |
|||
JSONObject queryPoint(); |
|||
|
|||
/** |
|||
* 送料确定 |
|||
* @param whereJson / |
|||
* @return JSONObject |
|||
*/ |
|||
JSONObject confirm(JSONObject whereJson); |
|||
} |
@ -1,70 +0,0 @@ |
|||
package org.nl.wms.pda.sendmaterial.service.impl; |
|||
|
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.alibaba.fastjson.JSONArray; |
|||
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.wms.ext.acs.service.AcsToWmsService; |
|||
import org.nl.wms.pda.sendmaterial.service.SendMaterialService; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
@Service |
|||
@RequiredArgsConstructor |
|||
@Slf4j |
|||
public class SendMaterialServiceImpl implements SendMaterialService { |
|||
|
|||
private final AcsToWmsService acsToWmsService; |
|||
|
|||
@Override |
|||
public JSONObject queryPoint() { |
|||
JSONObject result = new JSONObject(); |
|||
// 1.查询区域:豪凯区域 HKQY01、共挤区域 GJQY01
|
|||
JSONArray regionArr = WQL.getWO("PDA_SENDMATERIAL_01").addParam("flag", "1").process().getResultJSONArray(0); |
|||
// 2.根据区域查询对应的物料上料位
|
|||
JSONObject resultJson = new JSONObject(); |
|||
for (int i = 0; i < regionArr.size(); i++) { |
|||
JSONObject jsonRegion = regionArr.getJSONObject(i); |
|||
JSONArray pointArr = WQL.getWO("PDA_SENDMATERIAL_01").addParam("flag", "2").addParam("region_id", jsonRegion.getString("region_id")).process().getResultJSONArray(0); |
|||
jsonRegion.put("pointArr", pointArr); |
|||
} |
|||
resultJson.put("regionja", regionArr); |
|||
result.put("result", resultJson); |
|||
result.put("code", "1"); |
|||
result.put("desc", "查询成功"); |
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public JSONObject confirm(JSONObject whereJson) { |
|||
JSONObject result = new JSONObject(); |
|||
// 1、准备参数:point_code、type:2为共挤区域,8为豪凯区域
|
|||
JSONObject param = new JSONObject(); |
|||
|
|||
String region_id = whereJson.getString("region_id"); |
|||
JSONObject jsonObject = WQLObject.getWQLObject("sch_base_region").query("region_id ='" + region_id + "'").uniqueResult(0); |
|||
String region_code = jsonObject.getString("region_code"); |
|||
if (StrUtil.equals(region_code, "GJQY01")) param.put("type", "2"); |
|||
if (StrUtil.equals(region_code, "HKQY01")) param.put("type", "8"); |
|||
|
|||
param.put("point_code", whereJson.getString("point_code")); |
|||
param.put("material_num", whereJson.getString("qty")); |
|||
// 2、调用接口
|
|||
JSONObject json = acsToWmsService.apply(param); |
|||
if (ObjectUtil.isEmpty(json) || StrUtil.equals(json.getString("status"), "200")) { |
|||
result.put("result", ""); |
|||
result.put("code", "1"); |
|||
result.put("desc", "操作成功"); |
|||
} else { |
|||
result.put("result", ""); |
|||
result.put("code", "0"); |
|||
result.put("desc", "操作失败:" + json.getString("message")); |
|||
} |
|||
return result; |
|||
} |
|||
} |
@ -1,41 +0,0 @@ |
|||
package org.nl.wms.pda.sendvehicle.rest; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.modules.logging.annotation.Log; |
|||
import org.nl.wms.pda.callvehicle.service.CallVehicleService; |
|||
import org.nl.wms.pda.sendmaterial.service.SendMaterialService; |
|||
import org.nl.wms.pda.sendvehicle.service.SendVehicleService; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
@RestController |
|||
@RequiredArgsConstructor |
|||
@Api(tags = "手持送空托盘") |
|||
@RequestMapping("api/pda/sendEmpty") |
|||
@Slf4j |
|||
public class SendVehicleController { |
|||
|
|||
private final SendVehicleService sendVehicleService; |
|||
|
|||
@PostMapping("/queryPoint") |
|||
@Log("查询区域点位") |
|||
@ApiOperation("查询区域点位") |
|||
public ResponseEntity<Object> queryPoint() { |
|||
return new ResponseEntity<>(sendVehicleService.queryPoint(), HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping("/confirm") |
|||
@Log("送空托盘确定") |
|||
@ApiOperation("送空托盘确定") |
|||
public ResponseEntity<Object> confirm(@RequestBody JSONObject whereJson) { |
|||
return new ResponseEntity<>(sendVehicleService.confirm(whereJson), HttpStatus.OK); |
|||
} |
|||
} |
@ -1,19 +0,0 @@ |
|||
package org.nl.wms.pda.sendvehicle.service; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
|
|||
public interface SendVehicleService { |
|||
|
|||
/** |
|||
* 查询区域点位 |
|||
* @return JSONObject |
|||
*/ |
|||
JSONObject queryPoint(); |
|||
|
|||
/** |
|||
* 送空托盘确定 |
|||
* @param whereJson / |
|||
* @return JSONObject |
|||
*/ |
|||
JSONObject confirm(JSONObject whereJson); |
|||
} |
@ -1,78 +0,0 @@ |
|||
package org.nl.wms.pda.sendvehicle.service.impl; |
|||
|
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.alibaba.fastjson.JSONArray; |
|||
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.wms.ext.acs.service.AcsToWmsService; |
|||
import org.nl.wms.pda.sendvehicle.service.SendVehicleService; |
|||
import org.nl.wms.sch.manage.RegionTypeEnum; |
|||
|
|||
|
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
@Service |
|||
@RequiredArgsConstructor |
|||
@Slf4j |
|||
public class SendVehicleServiceImpl implements SendVehicleService { |
|||
|
|||
private final AcsToWmsService acsToWmsService; |
|||
|
|||
@Override |
|||
public JSONObject queryPoint() { |
|||
JSONObject result = new JSONObject(); |
|||
// 1.查询区域:输送区域 SSX01、油漆区域 YQQY01
|
|||
JSONArray regionArr = WQL.getWO("PDA_SENDVEHICLE_01").addParam("flag", "1").process().getResultJSONArray(0); |
|||
// 2.根据区域查询对应的物料上料位
|
|||
JSONObject resultJson = new JSONObject(); |
|||
for (int i = 0; i < regionArr.size(); i++) { |
|||
JSONObject jsonRegion = regionArr.getJSONObject(i); |
|||
if (StrUtil.equals(jsonRegion.getString("region_id"), RegionTypeEnum.SSX.getId())) { |
|||
JSONArray pointArr = WQL.getWO("PDA_SENDVEHICLE_01").addParam("flag", "2").addParam("region_id", jsonRegion.getString("region_id")).process().getResultJSONArray(0); |
|||
jsonRegion.put("pointArr", pointArr); |
|||
} else { |
|||
JSONArray pointArr = WQL.getWO("PDA_SENDVEHICLE_01").addParam("flag", "3").addParam("region_id", jsonRegion.getString("region_id")).process().getResultJSONArray(0); |
|||
jsonRegion.put("pointArr", pointArr); |
|||
} |
|||
} |
|||
resultJson.put("regionja", regionArr); |
|||
result.put("result", resultJson); |
|||
result.put("code", "1"); |
|||
result.put("desc", "查询成功"); |
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public JSONObject confirm(JSONObject whereJson) { |
|||
JSONObject result = new JSONObject(); |
|||
// 1、准备参数:point_code、type:6为输送线区域,5为油漆区域
|
|||
JSONObject param = new JSONObject(); |
|||
|
|||
String region_id = whereJson.getString("region_id"); |
|||
JSONObject jsonObject = WQLObject.getWQLObject("sch_base_region").query("region_id ='" + region_id + "'").uniqueResult(0); |
|||
String region_code = jsonObject.getString("region_code"); |
|||
if (StrUtil.equals(region_code, "SSX01")) param.put("type","6"); |
|||
if (StrUtil.equals(region_code, "YQQY01")) param.put("type","5"); |
|||
|
|||
param.put("point_code",whereJson.getString("point_code")); |
|||
param.put("vehicle_code",whereJson.getString("vehicle_code")); |
|||
param.put("vehicle_num",whereJson.getString("qty")); |
|||
// 2、调用接口
|
|||
JSONObject json = acsToWmsService.apply(param); |
|||
if (StrUtil.equals(json.getString("status"), "200")) { |
|||
result.put("result", ""); |
|||
result.put("code", "1"); |
|||
result.put("desc", "操作成功"); |
|||
} else { |
|||
result.put("result", ""); |
|||
result.put("code", "0"); |
|||
result.put("desc", "操作失败:"+json.getString("message")); |
|||
} |
|||
return result; |
|||
} |
|||
} |
@ -0,0 +1,93 @@ |
|||
package org.nl.wms.pda.service; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
|
|||
/** |
|||
* 辽宁晟华手持服务层接口 |
|||
* |
|||
* @author 张江玮 |
|||
* @date 2022/12/02 10:04 |
|||
*/ |
|||
public interface PdaService { |
|||
|
|||
/** |
|||
* 查询所有区域 |
|||
* |
|||
* @return 所有区域的编码和名称 |
|||
*/ |
|||
JSONArray warehouse(); |
|||
|
|||
/** |
|||
* 根据区域查询点位 |
|||
* |
|||
* @param region_code 区域编码 |
|||
* @return 该区域下的点位编码、名称和状态 |
|||
*/ |
|||
JSONArray point(String region_code); |
|||
|
|||
/** |
|||
* 查询点位详细信息 |
|||
* |
|||
* @param region_code 区域编码 |
|||
* @param point_code 点位编码 |
|||
* @return 点位上的组盘信息 |
|||
*/ |
|||
JSONObject pointInfo(String region_code, String point_code); |
|||
|
|||
/** |
|||
* 查询所有物料 |
|||
* |
|||
* @param condition 查询条件, 用于模糊查询 |
|||
* @return 物料的编码和名称 |
|||
*/ |
|||
JSONArray material(String condition); |
|||
|
|||
/** |
|||
* 库存操作-点击确认 |
|||
* |
|||
* @param region_code 区域编码 |
|||
* @param point_code 点位编码 |
|||
* @param vehicle_code 载具编码, 如果是入窑暂存区该参数将被无视 |
|||
* @param qty 物料数量/重量 |
|||
* @param is_full 是否满托 |
|||
*/ |
|||
void updateStock(String region_code, String point_code, String vehicle_code, String qty, String is_full); |
|||
|
|||
/** |
|||
* 库存操作-点击清空 |
|||
* |
|||
* @param point_code 点位编码 |
|||
*/ |
|||
void emptyStock(String point_code); |
|||
|
|||
/** |
|||
* 查询压制叫料点位 |
|||
* |
|||
* @return 压制叫料点位编码和名称 |
|||
*/ |
|||
JSONArray queryYZCallMaterialPoint(); |
|||
|
|||
/** |
|||
* 压制叫料 |
|||
* |
|||
* @param point_code 点位编码 |
|||
*/ |
|||
void yzCallMaterial(String point_code); |
|||
|
|||
/** |
|||
* 查询空盅点位 |
|||
* |
|||
* @return 空盅点位编码和名称 |
|||
*/ |
|||
JSONArray queryEmptyCupPoint(); |
|||
|
|||
/** |
|||
* 送空盅 |
|||
* |
|||
* @param point_code 点位编码 |
|||
* @param vehicle_code 料盅编码 |
|||
*/ |
|||
void sendEmptyCup(String point_code, String vehicle_code); |
|||
} |
@ -0,0 +1,201 @@ |
|||
package org.nl.wms.pda.service.impl; |
|||
|
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.modules.common.exception.BadRequestException; |
|||
import org.nl.modules.wql.WQL; |
|||
import org.nl.modules.wql.core.bean.WQLObject; |
|||
import org.nl.wms.pda.service.PdaService; |
|||
import org.nl.wms.sch.manage.RegionEnum; |
|||
import org.nl.wms.sch.manage.TaskStatusEnum; |
|||
import org.nl.wms.sch.tasks.callMaterial.YzjCallMaterialTask; |
|||
import org.nl.wms.sch.tasks.sendEmpty.YzjSendEmpVehicleTask; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
/** |
|||
* @author 张江玮 |
|||
* @date 2022/12/02 10:04 |
|||
*/ |
|||
@Service |
|||
@RequiredArgsConstructor |
|||
@Slf4j |
|||
public class PdaServiceImpl implements PdaService { |
|||
|
|||
private final YzjCallMaterialTask yzjCallMaterialTask; |
|||
|
|||
private final YzjSendEmpVehicleTask yzjSendEmpVehicleTask; |
|||
|
|||
/** |
|||
* 查询所有区域 |
|||
* |
|||
* @return 所有区域的编码和名称 |
|||
*/ |
|||
@Override |
|||
public JSONArray warehouse() { |
|||
return WQL.getWO("LNSH_PDA").addParam("flag", "1").process().getResultJSONArray(0); |
|||
} |
|||
|
|||
/** |
|||
* 根据区域查询点位 |
|||
* |
|||
* @param region_code 区域编码 |
|||
* @return 该区域下的点位编码、名称和状态 |
|||
*/ |
|||
@Override |
|||
public JSONArray point(String region_code) { |
|||
return WQL |
|||
.getWO("LNSH_PDA") |
|||
.addParam("flag", "2") |
|||
.addParam("region_code", region_code) |
|||
.process() |
|||
.getResultJSONArray(0); |
|||
} |
|||
|
|||
/** |
|||
* 查询点位详细信息 |
|||
* |
|||
* @param region_code 区域编码 |
|||
* @param point_code 点位编码 |
|||
* @return 点位上的组盘信息 |
|||
*/ |
|||
@Override |
|||
public JSONObject pointInfo(String region_code, String point_code) { |
|||
JSONObject info = WQL |
|||
.getWO("LNSH_PDA") |
|||
.addParam("flag", "3") |
|||
.addParam("point_code", point_code) |
|||
.process() |
|||
.uniqueResult(0); |
|||
|
|||
// 如果区域位于入窑暂存区 则不展示载具编码
|
|||
if (StrUtil.equals(region_code, RegionEnum.RYZCQ.getCode())) { |
|||
info.put("has_vehicle_code", "0"); |
|||
} |
|||
|
|||
return info; |
|||
} |
|||
|
|||
/** |
|||
* 查询所有物料 |
|||
* |
|||
* @param condition 查询条件, 用于模糊查询 |
|||
* @return 物料的编码和名称 |
|||
*/ |
|||
@Override |
|||
public JSONArray material(String condition) { |
|||
return WQL |
|||
.getWO("LNSH_PDA") |
|||
.addParam("flag", "4") |
|||
.addParam("condition", condition) |
|||
.process() |
|||
.getResultJSONArray(0); |
|||
} |
|||
|
|||
/** |
|||
* 库存操作-点击确认 |
|||
* |
|||
* @param region_code 区域编码 |
|||
* @param point_code 点位编码 |
|||
* @param vehicle_code 载具编码, 如果是入窑暂存区该参数将被无视 |
|||
* @param qty 物料数量/重量 |
|||
* @param is_full 是否满托 |
|||
*/ |
|||
@Override |
|||
public void updateStock(String region_code, String point_code, String vehicle_code, String qty, String is_full) { |
|||
|
|||
} |
|||
|
|||
/** |
|||
* 库存操作-点击清空 |
|||
* |
|||
* @param point_code 点位编码 |
|||
*/ |
|||
@Override |
|||
public void emptyStock(String point_code) { |
|||
|
|||
} |
|||
|
|||
/** |
|||
* 查询压制叫料点位 |
|||
* |
|||
* @return 压制叫料点位编码和名称 |
|||
*/ |
|||
@Override |
|||
public JSONArray queryYZCallMaterialPoint() { |
|||
return WQL.getWO("LNSH_PDA").addParam("flag", "5").process().getResultJSONArray(0); |
|||
} |
|||
|
|||
/** |
|||
* 压制叫料 |
|||
* |
|||
* @param point_code 点位编码 |
|||
*/ |
|||
@Override |
|||
public void yzCallMaterial(String point_code) { |
|||
isAvailable(point_code); |
|||
|
|||
yzjCallMaterialTask.createTask(new JSONObject() {{ |
|||
put("point_code2", point_code); |
|||
}}); |
|||
} |
|||
|
|||
/** |
|||
* 查询空盅点位 |
|||
* |
|||
* @return 空盅点位编码和名称 |
|||
*/ |
|||
@Override |
|||
public JSONArray queryEmptyCupPoint() { |
|||
return WQL.getWO("LNSH_PDA").addParam("flag", "6").process().getResultJSONArray(0); |
|||
} |
|||
|
|||
/** |
|||
* 送空盅 |
|||
* |
|||
* @param point_code 点位编码 |
|||
*/ |
|||
@Override |
|||
public void sendEmptyCup(String point_code, String vehicle_code) { |
|||
JSONObject point = isAvailable(point_code); |
|||
|
|||
yzjSendEmpVehicleTask.createTask(new JSONObject() {{ |
|||
put("point_code1", point_code); |
|||
put("vehicle_code", vehicle_code); |
|||
put("vehicle_type", StrUtil.equals(point.getString("point_type"), "2") ? "2" : "1"); |
|||
}}); |
|||
} |
|||
|
|||
/** |
|||
* 查询点位是否可用 |
|||
* 如果点位未被删除 且 未被禁用 且 不存在未完成的任务 即为可用 |
|||
* 不可用将报错 |
|||
* |
|||
* @param point_code 点位编码 |
|||
* @return 点位 |
|||
*/ |
|||
private JSONObject isAvailable(String point_code) { |
|||
JSONObject point = WQLObject |
|||
.getWQLObject("sch_base_point") |
|||
.query("is_delete = '0' AND is_used = '1' AND point_code = '" + point_code + "'") |
|||
.uniqueResult(0); |
|||
if (ObjectUtil.isEmpty(point)) { |
|||
throw new BadRequestException("该点位已被删除或已禁用"); |
|||
} |
|||
|
|||
JSONObject task = WQLObject |
|||
.getWQLObject("sch_base_task") |
|||
.query("is_delete = '0' " + |
|||
"AND ( point_code1 = '" + point_code + "' OR point_code2 = '" + point_code + "' ) " + |
|||
"AND task_status <> '" + TaskStatusEnum.FINISHED.getCode() + "'") |
|||
.uniqueResult(0); |
|||
if (ObjectUtil.isNotEmpty(task)) { |
|||
throw new BadRequestException("该点位存在未完成的任务"); |
|||
} |
|||
|
|||
return point; |
|||
} |
|||
} |
@ -0,0 +1,141 @@ |
|||
[交易说明] |
|||
交易名: 基础点位分页查询 |
|||
所属模块: |
|||
功能简述: |
|||
版权所有: |
|||
表引用: |
|||
版本经历: |
|||
|
|||
[数据库] |
|||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库 |
|||
|
|||
[IO定义] |
|||
################################################# |
|||
## 表字段对应输入参数 |
|||
################################################# |
|||
输入.flag TYPEAS s_string |
|||
输入.region_code TYPEAS s_string |
|||
输入.point_code TYPEAS s_string |
|||
输入.condition TYPEAS s_string |
|||
|
|||
|
|||
[临时表] |
|||
--这边列出来的临时表就会在运行期动态创建 |
|||
|
|||
[临时变量] |
|||
--所有中间过程变量均可在此处定义 |
|||
|
|||
[业务过程] |
|||
|
|||
########################################## |
|||
# 1、输入输出检查 # |
|||
########################################## |
|||
|
|||
|
|||
########################################## |
|||
# 2、主过程前处理 # |
|||
########################################## |
|||
|
|||
|
|||
########################################## |
|||
# 3、业务主过程 # |
|||
########################################## |
|||
|
|||
IF 输入.flag = "1" |
|||
QUERY |
|||
SELECT |
|||
region_code, |
|||
region_name |
|||
FROM |
|||
sch_base_region |
|||
WHERE |
|||
region_code IN ( 'KLHJ', 'RYZCQ', 'CYZCQ', 'BZZCQ' ) |
|||
ENDSELECT |
|||
ENDQUERY |
|||
ENDIF |
|||
|
|||
IF 输入.flag = "2" |
|||
QUERY |
|||
SELECT |
|||
point.point_code, |
|||
point.point_name, |
|||
IF ( task1.task_code IS NULL AND task2.task_code IS NULL, point.point_status, '4' ) AS 'point_status' |
|||
FROM |
|||
sch_base_point point |
|||
LEFT JOIN sch_base_task task1 ON point.point_code = task1.point_code1 AND task1.task_status < '7' |
|||
LEFT JOIN sch_base_task task2 ON point.point_code = task2.point_code2 AND task1.task_status < '7' |
|||
WHERE |
|||
point.is_delete = '0' |
|||
AND point.is_used = '1' |
|||
AND point.region_code = 输入.region_code |
|||
ENDSELECT |
|||
ENDQUERY |
|||
ENDIF |
|||
|
|||
IF 输入.flag = "3" |
|||
QUERY |
|||
SELECT |
|||
point.vehicle_code, |
|||
`group`.material_code, |
|||
`group`.material_name, |
|||
`group`.qty, |
|||
`group`.is_full |
|||
FROM |
|||
sch_base_point point |
|||
INNER JOIN st_buss_vehiclegroup `group` ON point.group_id = `group`.group_id |
|||
WHERE |
|||
point.is_delete = '0' |
|||
AND point.is_used = '1' |
|||
AND point.point_code = 输入.point_code |
|||
ENDSELECT |
|||
ENDQEURY |
|||
ENDIF |
|||
|
|||
IF 输入.flag = "4" |
|||
QUERY |
|||
SELECT |
|||
material_code, |
|||
material_name |
|||
FROM |
|||
md_me_materialbase |
|||
WHERE |
|||
is_delete = '0' |
|||
OPTION 输入.condition <> "" |
|||
material_code LIKE CONCAT ( '%', 输入.condition, '%' ) |
|||
OR material_name LIKE CONCAT ( '%', 输入.condition, '%' ) |
|||
ENDOPTION |
|||
ENDSELECT |
|||
ENDQUERY |
|||
ENDIF |
|||
|
|||
IF 输入.flag = "5" |
|||
QUERY |
|||
SELECT |
|||
point_code, |
|||
point_name |
|||
FROM |
|||
sch_base_point |
|||
WHERE |
|||
is_used = '1' |
|||
AND is_delete = '0' |
|||
AND region_code = 'KLHJ' |
|||
AND point_type = '3' |
|||
ENDSELECT |
|||
ENDQUERY |
|||
ENDIF |
|||
|
|||
IF 输入.flag = "6" |
|||
QUERY |
|||
SELECT |
|||
point_code, |
|||
point_name |
|||
FROM |
|||
`sch_base_point` |
|||
WHERE |
|||
is_used = '1' |
|||
AND is_delete = '0' |
|||
AND region_code = 'KLHJ' |
|||
AND point_type IN ( '2', '4' ) |
|||
ENDSELECT |
|||
ENDQUERY |
|||
ENDIF |
Binary file not shown.
Loading…
Reference in new issue