rev:新增设备状态监控功能;修改点位查询和批量修改;任务下方ACSAGV参数修改;烘箱温度和时间用redis进行存储和查询;
This commit is contained in:
@@ -40,6 +40,7 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -59,15 +60,22 @@ public class UserController {
|
||||
|
||||
@ApiOperation("查询用户")
|
||||
@GetMapping
|
||||
public ResponseEntity<Object> query(UserQuery query, PageQuery page){
|
||||
return new ResponseEntity(userService.getUserDetail(query, page),HttpStatus.OK);
|
||||
public ResponseEntity<Object> query(UserQuery query, PageQuery page) {
|
||||
return new ResponseEntity(userService.getUserDetail(query, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("查询用户")
|
||||
@PostMapping(value = "/getUserList")
|
||||
public ResponseEntity<Object> query() {
|
||||
List<SysUser> userList = userService.list(new QueryWrapper<SysUser>().eq("is_used", true));
|
||||
return new ResponseEntity(userList, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("新增用户")
|
||||
@ApiOperation("新增用户")
|
||||
@PostMapping
|
||||
// @SaCheckPermission("user:add")
|
||||
public ResponseEntity<Object> create(@RequestBody Map user){
|
||||
public ResponseEntity<Object> create(@RequestBody Map user) {
|
||||
userService.create(user);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
@@ -76,7 +84,7 @@ public class UserController {
|
||||
@ApiOperation("修改用户")
|
||||
@PutMapping
|
||||
// @SaCheckPermission("user:edit")
|
||||
public ResponseEntity<Object> update( @RequestBody Map resources) throws Exception {
|
||||
public ResponseEntity<Object> update(@RequestBody Map resources) throws Exception {
|
||||
userService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@@ -84,8 +92,8 @@ public class UserController {
|
||||
@Log("修改用户:个人中心")
|
||||
@ApiOperation("修改用户:个人中心")
|
||||
// @PutMapping(value = "center")
|
||||
public ResponseEntity<Object> center(@RequestBody SysUser resources){
|
||||
if(!resources.getUserId().equals(StpUtil.getLoginIdAsLong())){
|
||||
public ResponseEntity<Object> center(@RequestBody SysUser resources) {
|
||||
if (!resources.getUserId().equals(StpUtil.getLoginIdAsLong())) {
|
||||
throw new BadRequestException("不能修改他人资料");
|
||||
}
|
||||
userService.saveOrUpdate(resources);
|
||||
@@ -110,20 +118,20 @@ public class UserController {
|
||||
|
||||
@ApiOperation("修改头像")
|
||||
@PostMapping(value = "/updateAvatar")
|
||||
public ResponseEntity<Object> updateAvatar(@RequestParam MultipartFile avatar){
|
||||
public ResponseEntity<Object> updateAvatar(@RequestParam MultipartFile avatar) {
|
||||
return new ResponseEntity<>(userService.updateAvatar(avatar), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("修改邮箱")
|
||||
@ApiOperation("修改邮箱")
|
||||
@PostMapping(value = "/updateEmail/{code}")
|
||||
public ResponseEntity<Object> updateEmail(@PathVariable String code,@RequestBody SysUser user) throws Exception {
|
||||
String password = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey,user.getPassword());
|
||||
public ResponseEntity<Object> updateEmail(@PathVariable String code, @RequestBody SysUser user) throws Exception {
|
||||
String password = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, user.getPassword());
|
||||
SysUser userInfo = userService.getOne(new QueryWrapper<SysUser>().eq("username", SecurityUtils.getCurrentUsername()));
|
||||
if(!SaSecureUtil.md5BySalt(userInfo.getPassword(), "salt").equals(SaSecureUtil.md5BySalt(password, "salt"))){
|
||||
if (!SaSecureUtil.md5BySalt(userInfo.getPassword(), "salt").equals(SaSecureUtil.md5BySalt(password, "salt"))) {
|
||||
throw new BadRequestException("密码错误");
|
||||
}
|
||||
userService.update(new UpdateWrapper<SysUser>().set(userInfo.getUsername(),user.getEmail()));
|
||||
userService.update(new UpdateWrapper<SysUser>().set(userInfo.getUsername(), user.getEmail()));
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
|
||||
package org.nl.wms.basedata.master.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.basedata.master.service.DeviceStatusService;
|
||||
import org.nl.wms.basedata.master.service.dto.CustomerbaseDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author ldjun
|
||||
* @date 2021-12-06
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "设备状态监控")
|
||||
@RequestMapping("/api/devicestatus")
|
||||
@Slf4j
|
||||
public class DeviceStatusController {
|
||||
|
||||
private final DeviceStatusService deviceStatusService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询设备状态监控")
|
||||
@ApiOperation("查询设备状态监控")
|
||||
//@PreAuthorize("@el.check('customerbase:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(deviceStatusService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改客户基础表")
|
||||
@ApiOperation("修改客户基础表")
|
||||
//@PreAuthorize("@el.check('customerbase:edit')")
|
||||
public ResponseEntity<Object> update(@RequestBody JSONObject jo) {
|
||||
deviceStatusService.update(jo);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除客户基础表")
|
||||
@ApiOperation("删除客户基础表")
|
||||
//@PreAuthorize("@el.check('customerbase:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
deviceStatusService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
|
||||
package org.nl.wms.basedata.master.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.basedata.master.service.dto.CustomerbaseDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author ldjun
|
||||
* @date 2021-12-06
|
||||
**/
|
||||
public interface DeviceStatusService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param whereJson 条件参数
|
||||
* @return List<CustomerbaseDto>
|
||||
*/
|
||||
List<CustomerbaseDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param dto /
|
||||
*/
|
||||
void update(JSONObject jo);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
|
||||
package org.nl.wms.basedata.master.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.wql.core.bean.ResultBean;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.nl.wms.basedata.master.service.DeviceStatusService;
|
||||
import org.nl.wms.basedata.master.service.dto.CustomerbaseDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author ldjun
|
||||
* @description 服务实现
|
||||
* @date 2021-12-06
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class DeviceStatusServiceImpl implements DeviceStatusService {
|
||||
@Autowired
|
||||
private DeviceStatusService deviceStatusService;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
String where = "";
|
||||
WQLObject wo = WQLObject.getWQLObject("em_bi_devicestatus");
|
||||
String search = (String) whereJson.get("search");
|
||||
if (!StrUtil.isEmpty(search)) {
|
||||
where = "AND (device_code like '%" + search + "%' OR device_name like '%" + search + "%')";
|
||||
}
|
||||
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "1=1" + where, "device_code desc");
|
||||
final JSONObject json = rb.pageResult();
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CustomerbaseDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("md_cs_customerbase");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
List<CustomerbaseDto> list = arr.toJavaList(CustomerbaseDto.class);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(JSONObject jo) {
|
||||
WQLObject wo = WQLObject.getWQLObject("em_bi_devicestatus");
|
||||
String device_code = jo.getString("device_code");
|
||||
if (!jo.containsKey("need_update_flag")){
|
||||
JSONArray rows = jo.getJSONArray("upload_user");
|
||||
HashMap<String,String> map = new HashMap<>();
|
||||
String msg = "";
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
if (i!=rows.size()-1){
|
||||
msg += rows.getString(i)+",";
|
||||
}else {
|
||||
msg += rows.getString(i);
|
||||
}
|
||||
}
|
||||
map.put("upload_user",msg);
|
||||
wo.update(map,"device_code = '"+device_code+"'");
|
||||
}else {
|
||||
wo.update(jo);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("md_cs_customerbase");
|
||||
for (Long cust_id : ids) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("cust_id", String.valueOf(cust_id));
|
||||
param.put("is_delete", "1");
|
||||
param.put("update_optid", currentUserId);
|
||||
param.put("update_optname", nickName);
|
||||
param.put("update_time", now);
|
||||
wo.update(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -87,6 +87,13 @@ public class AcsToWmsController {
|
||||
return new ResponseEntity<>(acsToWmsService.shipDeviceUpdate(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/sendDeviceStatus")
|
||||
@ApiOperation("设备状态变更上报")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> sendDeviceStatus(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(acsToWmsService.sendDeviceStatus(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/initialize")
|
||||
@Log(value = "仓位初始化", isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LMS)
|
||||
@ApiOperation("仓位初始化")
|
||||
|
||||
@@ -78,6 +78,15 @@ public interface AcsToWmsService {
|
||||
*/
|
||||
JSONObject shipDeviceUpdate(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* ACS客户端--->LMS服务端
|
||||
* 输送线光电无货上报
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @return JSONObject
|
||||
*/
|
||||
JSONObject sendDeviceStatus(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 仓位初始化
|
||||
*/
|
||||
|
||||
@@ -714,8 +714,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
} else if (type.equals("3")) {
|
||||
//判断AGV是否启用
|
||||
String device_code = whereJson.getString("device_code");
|
||||
String product_area = device_code.substring(0,2);
|
||||
String agv_status = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode(product_area+"_agv_status").getValue();
|
||||
String product_area = device_code.substring(0, 2);
|
||||
String agv_status = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode(product_area + "_agv_status").getValue();
|
||||
|
||||
if ("0".equals(agv_status)) {
|
||||
log.info("当前AGV未启用,不启用自动出烘箱功能!");
|
||||
@@ -806,6 +806,40 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject sendDeviceStatus(JSONObject whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("em_bi_devicestatus");
|
||||
String device_code = whereJson.getString("device_code");
|
||||
if (StrUtil.isEmpty(device_code)) {
|
||||
log.info("未传入设备号,输入参数为:" + whereJson.toString());
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("status", HttpStatus.OK.value());
|
||||
result.put("message", "反馈成功!");
|
||||
return result;
|
||||
} else {
|
||||
JSONObject device = wo.query("device_code = '" + device_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
log.info("未查询到对应的设备:" + device_code);
|
||||
} else {
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
if (whereJson.containsKey("mode")) {
|
||||
map.put("mode", whereJson.getString("mode"));
|
||||
map.put("mode_update_time", DateUtil.now());
|
||||
}
|
||||
if (whereJson.containsKey("error")) {
|
||||
map.put("error", whereJson.getString("error"));
|
||||
map.put("error_msg", whereJson.getString("error_msg"));
|
||||
map.put("error_update_time", DateUtil.now());
|
||||
}
|
||||
wo.update(map, "device_code = '" + device_code + "'");
|
||||
}
|
||||
}
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("status", HttpStatus.OK.value());
|
||||
result.put("message", "反馈成功!");
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject shipDeviceUpdate(JSONObject whereJson) {
|
||||
|
||||
@@ -337,17 +337,25 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
String car_no = whereJson.getString("car_no");
|
||||
|
||||
JSONObject jsonParam = new JSONObject();
|
||||
if ("2,3,4,5".contains(car_no)) {
|
||||
/*if ("2,3,4,5".contains(car_no)) {
|
||||
jsonParam.put("agv_system", "2");
|
||||
jsonParam.put("car_no", car_no);
|
||||
|
||||
} else if ("1".contains(car_no)) {
|
||||
jsonParam.put("agv_system", "1");
|
||||
jsonParam.put("car_no", car_no);
|
||||
} else if ("6,7,8,9".contains(car_no)) {
|
||||
jsonParam.put("agv_system", "3");
|
||||
jsonParam.put("car_no", car_no);
|
||||
}*/
|
||||
if ("1".contains(car_no)) {
|
||||
jsonParam.put("agv_system", "1");
|
||||
jsonParam.put("car_no", car_no);
|
||||
}else {
|
||||
jsonParam.put("agv_system", "2");
|
||||
jsonParam.put("car_no", car_no);
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
String resultMsg = HttpRequest.post(url)
|
||||
.body(String.valueOf(jsonParam))
|
||||
|
||||
@@ -986,6 +986,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
String box_length = param.getString("Attribute2"); // 木箱料号
|
||||
String box_width = param.getString("Attribute3"); // 木箱料号
|
||||
String box_high = param.getString("Attribute4"); // 木箱料号
|
||||
String sub_type = param.getString("Attribute5"); // 包装关系类型
|
||||
JSONArray details = param.getJSONArray("details");
|
||||
if (ObjectUtil.isEmpty(details)) throw new BadRequestException("明细为空");
|
||||
for (int i = 0; i < details.size(); i++) {
|
||||
@@ -1009,6 +1010,9 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
String sap_pcsn = detail.getString("Attribute1");//SAP批次
|
||||
String thickness_request = detail.getString("Attribute2");//物料主数据厚度
|
||||
String width_standard = detail.getString("Attribute3");//要求幅宽
|
||||
String demand_limit = detail.getString("Attribute4");//客户需求抗拉下限
|
||||
String standard_limit = detail.getString("Attribute5");//内控标准抗拉下限
|
||||
String actual_value = detail.getString("Attribute6");//生产实际抗拉值
|
||||
|
||||
//查询库内是否存在相同的子卷号
|
||||
JSONObject container_jo = WQLObject.getWQLObject("PDM_BI_SubPackageRelation").query("container_name = '" + ContainerName + "'").uniqueResult(0);
|
||||
@@ -1020,10 +1024,14 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
jo.put("workorder_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
jo.put("package_box_sn", PackageBoxSN);
|
||||
jo.put("sap_pcsn", sap_pcsn);
|
||||
jo.put("sub_type", sub_type);
|
||||
jo.put("box_type", box_type);
|
||||
jo.put("box_length", box_length);
|
||||
jo.put("box_width", box_width);
|
||||
jo.put("box_high", box_high);
|
||||
jo.put("demand_limit", demand_limit);
|
||||
jo.put("standard_limit", standard_limit);
|
||||
jo.put("actual_value", actual_value);
|
||||
jo.put("quanlity_in_box", QuanlityInBox);
|
||||
if (StrUtil.equals(BoxWeight, "0")) {
|
||||
BoxWeight2 = NumberUtil.add(BoxWeight2, NetWeight).toString();
|
||||
|
||||
@@ -56,4 +56,12 @@ public class SapToLmsController {
|
||||
return new ResponseEntity<>(sapToLmsService.getCannibalize(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@SaIgnore
|
||||
@PostMapping("/getReCutInfo")
|
||||
@Log("SAP给LMS推送改切出库单")
|
||||
@ApiOperation("SAP给LMS推送改切出库单")
|
||||
public ResponseEntity<Object> getReCutInfo(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(sapToLmsService.getReCutInfo(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,4 +21,6 @@ public interface SapToLmsService {
|
||||
* SAP给LMS推送调拨出库单
|
||||
* */
|
||||
JSONObject getCannibalize(JSONObject jo);
|
||||
|
||||
JSONObject getReCutInfo(JSONObject jo);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,93 @@ public class SapToLmsServiceImpl implements SapToLmsService {
|
||||
private final RawAssistIStorService rawAssistIStorService;
|
||||
|
||||
|
||||
@Override
|
||||
public JSONObject getReCutInfo(JSONObject jo) {
|
||||
log.info("getReCutInfo的输入参数为:------------------------" + jo.toString());
|
||||
|
||||
JSONObject jsonMst = new JSONObject();
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
|
||||
String msg = "改切出库单据推送成功!";
|
||||
try {
|
||||
String LGORT = jo.getString("LGORT");
|
||||
JSONObject stor_jo = WQLObject.getWQLObject("ST_IVT_BSRealStorAttr").query("ext_id = '" + LGORT + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(stor_jo)) {
|
||||
result.put("RTYPE", "E");
|
||||
result.put("RTMSG", "操作失败!" + "未查询到外部标识为:" + LGORT + "对应的仓库!");
|
||||
result.put("RTOAL", 1);
|
||||
result.put("RTDAT", null);
|
||||
return result;
|
||||
}
|
||||
|
||||
jsonMst.put("stor_id", stor_jo.getString("stor_id"));
|
||||
jsonMst.put("stor_code", stor_jo.getString("stor_code"));
|
||||
jsonMst.put("stor_name", stor_jo.getString("stor_name"));
|
||||
jsonMst.put("detail_count", "1");
|
||||
jsonMst.put("bill_status", "10");
|
||||
jsonMst.put("create_mode", "03");
|
||||
jsonMst.put("bill_type", "1003");
|
||||
jsonMst.put("biz_date", DateUtil.now());
|
||||
jsonMst.put("user", "sap");
|
||||
|
||||
JSONArray dtls = new JSONArray();
|
||||
String sap_pcsn = jo.getString("CHARG");
|
||||
if (StrUtil.isEmpty("sap_pcsn")) {
|
||||
throw new BadRequestException("请求参数SAP批次不能为空!");
|
||||
}
|
||||
JSONObject sub_jo = WQLObject.getWQLObject("PDM_BI_SubPackageRelation").query("sap_pcsn = '" + sap_pcsn + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(sub_jo)) {
|
||||
throw new BadRequestException("LMS中不存在SAP批次为【" + sap_pcsn + "】的包装关系");
|
||||
}
|
||||
String container_name = sub_jo.getString("container_name");
|
||||
JSONObject struct_ivt = WQLObject.getWQLObject("st_ivt_structivt").query("pcsn = '" + container_name + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(struct_ivt)) {
|
||||
throw new BadRequestException("SAP批次为【" + sap_pcsn + "】的成品卷不存在或已经出库!");
|
||||
} else {
|
||||
if (struct_ivt.getDoubleValue("frozen_qty") > 0) {
|
||||
msg = "SAP批次为【" + sap_pcsn + "】的成品卷已经被分配或出库中";
|
||||
}else {
|
||||
JSONObject dtl = new JSONObject();
|
||||
//查询该物料
|
||||
JSONObject mater_jo = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + sub_jo.getString("product_name") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(mater_jo)) {
|
||||
throw new BadRequestException("未查询到物料:" + sub_jo.getString("product_name") + ",信息!");
|
||||
}
|
||||
dtl.put("material_id", mater_jo.getString("material_id"));
|
||||
dtl.put("pcsn", container_name);
|
||||
dtl.put("box_no", sub_jo.getString("package_box_sn"));
|
||||
JSONObject unit = WQLObject.getWQLObject("md_pb_measureunit").query("measure_unit_id = '" + mater_jo.getString("base_unit_id") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(unit)) {
|
||||
throw new BadRequestException("未查询到物料计量单位:" + mater_jo.getString("base_unit_id") + ",信息!");
|
||||
}
|
||||
dtl.put("qty_unit_id", unit.getString("measure_unit_id"));
|
||||
dtl.put("qty_unit_name", unit.getString("unit_name"));
|
||||
dtl.put("plan_qty", sub_jo.getString("net_weight"));
|
||||
dtls.add(dtl);
|
||||
|
||||
|
||||
jsonMst.put("tableData", dtls);
|
||||
String iostorinv_id = checkOutBillService.insertDtl(jsonMst);
|
||||
|
||||
//调用自动分配
|
||||
JSONObject out_jo = new JSONObject();
|
||||
out_jo.put("iostorinv_id", iostorinv_id);
|
||||
checkOutBillService.allDiv(out_jo);
|
||||
}
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
result.put("TYPE", "E");
|
||||
result.put("MESSAGE", "推送失败!" + exception.getMessage());
|
||||
log.info("getMaterialInfo的输出参数为:------------------------" + result.toString());
|
||||
return result;
|
||||
}
|
||||
result.put("TYPE", "S");
|
||||
result.put("MESSAGE", msg);
|
||||
log.info("getMaterialInfo的输出参数为:------------------------" + result.toString());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getMaterialInfo(JSONObject jo) {
|
||||
JSONArray rows = jo.getJSONArray("DATAS");
|
||||
|
||||
@@ -12,6 +12,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
|
||||
import org.nl.modules.common.utils.RedisUtils;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
@@ -25,6 +26,7 @@ import org.nl.wms.sch.tasks.CutConveyorTask;
|
||||
import org.nl.wms.sch.tasks.InCoolIvtTask;
|
||||
import org.nl.wms.sch.tasks.InHotTask;
|
||||
import org.nl.wms.sch.tasks.OutHotTask;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -33,6 +35,9 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
@Slf4j
|
||||
public class BakingServiceImpl implements BakingService {
|
||||
|
||||
@Autowired
|
||||
private RedisUtils redisUtils;
|
||||
|
||||
/*
|
||||
* 业务流程:
|
||||
* 入烤箱:
|
||||
@@ -112,8 +117,8 @@ public class BakingServiceImpl implements BakingService {
|
||||
*/
|
||||
JSONObject jsonPointZc = pointTab.query("point_code = '" + point_code1 + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonPointZc)) {
|
||||
if (!in_area_id.contains(jsonPointZc.getString("product_area"))){
|
||||
throw new BadRequestException("当前登录人员暂无【"+jsonPointZc.getString("product_area")+"】操作权限");
|
||||
if (!in_area_id.contains(jsonPointZc.getString("product_area"))) {
|
||||
throw new BadRequestException("当前登录人员暂无【" + jsonPointZc.getString("product_area") + "】操作权限");
|
||||
}
|
||||
/*
|
||||
* 暂存区入烘箱
|
||||
@@ -123,10 +128,23 @@ public class BakingServiceImpl implements BakingService {
|
||||
jsonMap.put("flag", "1");
|
||||
jsonMap.put("product_area", jsonPointZc.getString("product_area"));
|
||||
//获取温度幅度
|
||||
jsonMap.put("min_temperature", (NumberUtil.sub(temperature, temperature_lose)).toString());
|
||||
jsonMap.put("max_temperature", (NumberUtil.add(temperature, temperature_lose)).toString());
|
||||
/*jsonMap.put("min_temperature", (NumberUtil.sub(temperature, temperature_lose)).toString());
|
||||
jsonMap.put("max_temperature", (NumberUtil.add(temperature, temperature_lose)).toString());*/
|
||||
jsonMap.put("point_location", jsonPointZc.getString("point_location"));
|
||||
JSONObject jsonHotIvt = WQL.getWO("PDA_BAKING_01").addParamMap(jsonMap).process().uniqueResult(0);
|
||||
JSONArray hot_rows = WQL.getWO("PDA_BAKING_01").addParamMap(jsonMap).process().getResultJSONArray(0);
|
||||
JSONObject jsonHotIvt = new JSONObject();
|
||||
for (int i = 0; i < hot_rows.size(); i++) {
|
||||
JSONObject hot_row = hot_rows.getJSONObject(i);
|
||||
String point_code = hot_row.getString("point_code");
|
||||
String point_temperature = (String) redisUtils.hget(point_code, "temperature");
|
||||
if (!ObjectUtil.isEmpty(point_temperature)) {
|
||||
if (point_temperature.equals(temperature)) {
|
||||
jsonHotIvt = hot_row;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(jsonHotIvt)) {
|
||||
throw new BadRequestException("烘烤区没有合适温度的空位!");
|
||||
}
|
||||
@@ -175,8 +193,8 @@ public class BakingServiceImpl implements BakingService {
|
||||
String point_location = jsonCoolIvt.getString("point_location"); // 位置
|
||||
String reging_id = "";
|
||||
|
||||
if (!in_area_id.contains(product_area)){
|
||||
throw new BadRequestException("当前登录人员暂无【"+product_area+"】操作权限");
|
||||
if (!in_area_id.contains(product_area)) {
|
||||
throw new BadRequestException("当前登录人员暂无【" + product_area + "】操作权限");
|
||||
}
|
||||
switch (product_area) {
|
||||
case "A1":
|
||||
@@ -215,10 +233,22 @@ public class BakingServiceImpl implements BakingService {
|
||||
JSONObject jsonMap = new JSONObject();
|
||||
jsonMap.put("flag", "1");
|
||||
jsonMap.put("product_area", product_area);
|
||||
jsonMap.put("min_temperature", NumberUtil.sub(temperature, temperature_lose) + "");
|
||||
jsonMap.put("max_temperature", NumberUtil.add(temperature, temperature_lose) + "");
|
||||
/*jsonMap.put("min_temperature", NumberUtil.sub(temperature, temperature_lose) + "");
|
||||
jsonMap.put("max_temperature", NumberUtil.add(temperature, temperature_lose) + "");*/
|
||||
jsonMap.put("point_location", map.getString("point_location"));
|
||||
JSONObject jsonHotIvt = WQL.getWO("PDA_BAKING_01").addParamMap(jsonMap).process().uniqueResult(0);
|
||||
JSONArray hot_rows = WQL.getWO("PDA_BAKING_01").addParamMap(jsonMap).process().getResultJSONArray(0);
|
||||
JSONObject jsonHotIvt = new JSONObject();
|
||||
for (int i = 0; i < hot_rows.size(); i++) {
|
||||
JSONObject hot_row = hot_rows.getJSONObject(i);
|
||||
String point_code = hot_row.getString("point_code");
|
||||
String point_temperature = (String) redisUtils.hget(point_code, "temperature");
|
||||
if (!ObjectUtil.isEmpty(point_temperature)) {
|
||||
if (point_temperature.equals(temperature)) {
|
||||
jsonHotIvt = hot_row;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isEmpty(jsonHotIvt)) {
|
||||
throw new BadRequestException("烘烤区没有合适温度的空位!");
|
||||
}
|
||||
@@ -308,8 +338,8 @@ public class BakingServiceImpl implements BakingService {
|
||||
}
|
||||
// 1.查询暂存位有没有空位
|
||||
String product_area = jsonHotIvt.getString("product_area");
|
||||
if (!in_area_id.contains(product_area)){
|
||||
throw new BadRequestException("当前登录人员暂无【"+product_area+"】操作权限");
|
||||
if (!in_area_id.contains(product_area)) {
|
||||
throw new BadRequestException("当前登录人员暂无【" + product_area + "】操作权限");
|
||||
}
|
||||
String reging_id = "";
|
||||
switch (product_area) {
|
||||
@@ -443,8 +473,8 @@ public class BakingServiceImpl implements BakingService {
|
||||
throw new BadRequestException("请扫描点位类型为出箱的烘箱对接位!");
|
||||
}
|
||||
|
||||
if (!in_area_id.contains(jsonPoint.getString("product_area"))){
|
||||
throw new BadRequestException("当前登录人员暂无【"+jsonPoint.getString("product_area")+"】操作权限");
|
||||
if (!in_area_id.contains(jsonPoint.getString("product_area"))) {
|
||||
throw new BadRequestException("当前登录人员暂无【" + jsonPoint.getString("product_area") + "】操作权限");
|
||||
}
|
||||
// 2.找冷却区空货位
|
||||
JSONObject map = new JSONObject();
|
||||
@@ -570,8 +600,8 @@ public class BakingServiceImpl implements BakingService {
|
||||
public JSONObject release(JSONObject whereJson) {
|
||||
JSONArray rows = new JSONArray();
|
||||
JSONObject jo = new JSONObject();
|
||||
JSONObject point_jo = WQLObject.getWQLObject("sch_base_point").query("point_code = '"+whereJson.getString("point_code")+"'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(point_jo)){
|
||||
JSONObject point_jo = WQLObject.getWQLObject("sch_base_point").query("point_code = '" + whereJson.getString("point_code") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(point_jo)) {
|
||||
throw new BadRequestException("未查询到对应的报警灯点位!");
|
||||
}
|
||||
jo.put("device_code", whereJson.getString("point_code"));
|
||||
@@ -594,7 +624,7 @@ public class BakingServiceImpl implements BakingService {
|
||||
String point_code = whereJson.getString("point_code");
|
||||
JSONObject json = new JSONObject();
|
||||
|
||||
if (point_code.endsWith("BJD")){
|
||||
if (point_code.endsWith("BJD")) {
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("data", json);
|
||||
result.put("message", "操作成功!");
|
||||
@@ -609,24 +639,24 @@ public class BakingServiceImpl implements BakingService {
|
||||
if (ObjectUtil.isNotEmpty(jsonCool) && ObjectUtil.isNotEmpty(jsonCool.getString("container_name"))) {
|
||||
json.put("container_name", jsonCool.getString("container_name"));
|
||||
String product_area = jsonCool.getString("product_area");
|
||||
if (!in_area_id.contains(product_area)){
|
||||
throw new BadRequestException("当前登录人员暂无【"+product_area+"】操作权限");
|
||||
if (!in_area_id.contains(product_area)) {
|
||||
throw new BadRequestException("当前登录人员暂无【" + product_area + "】操作权限");
|
||||
}
|
||||
} else {
|
||||
JSONObject jsonHot = hotIvtTab.query("point_code = '" + point_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonHot) && ObjectUtil.isNotEmpty(jsonHot.getString("container_name"))) {
|
||||
json.put("container_name", jsonHot.getString("container_name"));
|
||||
String product_area = jsonHot.getString("product_area");
|
||||
if (!in_area_id.contains(product_area)){
|
||||
throw new BadRequestException("当前登录人员暂无【"+product_area+"】操作权限");
|
||||
if (!in_area_id.contains(product_area)) {
|
||||
throw new BadRequestException("当前登录人员暂无【" + product_area + "】操作权限");
|
||||
}
|
||||
} else {
|
||||
JSONObject jsonPoint = pointIvtTab.query("point_code = '" + point_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonPoint) && ObjectUtil.isNotEmpty(jsonPoint.getString("material_code"))) {
|
||||
json.put("container_name", jsonPoint.getString("material_code"));
|
||||
String product_area = jsonPoint.getString("product_area");
|
||||
if (!in_area_id.contains(product_area)){
|
||||
throw new BadRequestException("当前登录人员暂无【"+product_area+"】操作权限");
|
||||
if (!in_area_id.contains(product_area)) {
|
||||
throw new BadRequestException("当前登录人员暂无【" + product_area + "】操作权限");
|
||||
}
|
||||
} else {
|
||||
if (ObjectUtil.isEmpty(jsonCool) && ObjectUtil.isEmpty(jsonHot) && ObjectUtil.isEmpty(jsonPoint)) {
|
||||
|
||||
@@ -136,6 +136,9 @@ public class RawFoilServiceImpl implements RawFoilService {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("data", resultJSONArray.getJSONArray("content"));
|
||||
jo.put("size", resultJSONArray.getString("totalElements"));
|
||||
if (StrUtil.isNotEmpty(whereJson.getString("container_name")) && ObjectUtil.isEmpty(resultJSONArray.getJSONArray("content"))){
|
||||
throw new BadRequestException("当前输入的母卷工单已结束或不存在!");
|
||||
}
|
||||
jo.put("message", "查询成功!");
|
||||
return jo;
|
||||
}
|
||||
|
||||
@@ -51,33 +51,90 @@
|
||||
sch_base_point a
|
||||
INNER JOIN (
|
||||
SELECT
|
||||
COUNT( task.task_id ) AS num,
|
||||
point_code
|
||||
COUNT( c.task_id ) AS num,
|
||||
c.point_code
|
||||
FROM
|
||||
SCH_BASE_Point po
|
||||
LEFT JOIN sch_base_task task ON ( task.point_code1 = po.point_code OR task.point_code2 = po.point_code OR task.point_code3 = po.point_code )
|
||||
AND task.task_status < '07'
|
||||
AND task.is_delete = '0'
|
||||
WHERE
|
||||
po.is_delete = '0'
|
||||
AND po.is_used = '1'
|
||||
(
|
||||
SELECT
|
||||
task.task_id,
|
||||
point_code
|
||||
FROM
|
||||
SCH_BASE_Point po
|
||||
LEFT JOIN sch_base_task task ON task.point_code1 = po.point_code
|
||||
AND task.task_status < '07'
|
||||
AND task.is_delete = '0'
|
||||
WHERE
|
||||
po.is_delete = '0'
|
||||
AND po.is_used = '1'
|
||||
OPTION 输入.reging_id <> ""
|
||||
po.region_id = 输入.reging_id
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.reging_id <> ""
|
||||
po.region_id = 输入.reging_id
|
||||
ENDOPTION
|
||||
OPTION 输入.point_location <> ""
|
||||
po.point_location = 输入.point_location
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.point_location <> ""
|
||||
po.point_location = 输入.point_location
|
||||
ENDOPTION
|
||||
OPTION 输入.point_type <> ""
|
||||
po.point_type = 输入.point_type
|
||||
ENDOPTION
|
||||
OPTION 输入.point_type = "5"
|
||||
IFNULL(po.material_code,'') = ''
|
||||
ENDOPTION
|
||||
UNION
|
||||
SELECT
|
||||
task.task_id,
|
||||
point_code
|
||||
FROM
|
||||
SCH_BASE_Point po
|
||||
LEFT JOIN sch_base_task task ON task.point_code1 = po.point_code
|
||||
AND task.task_status < '07'
|
||||
AND task.is_delete = '0'
|
||||
WHERE
|
||||
po.is_delete = '0'
|
||||
AND po.is_used = '1'
|
||||
OPTION 输入.reging_id <> ""
|
||||
po.region_id = 输入.reging_id
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.point_type <> ""
|
||||
po.point_type = 输入.point_type
|
||||
ENDOPTION
|
||||
OPTION 输入.point_type = "5"
|
||||
IFNULL(po.material_code,'') = ''
|
||||
ENDOPTION
|
||||
GROUP BY
|
||||
po.point_code
|
||||
OPTION 输入.point_location <> ""
|
||||
po.point_location = 输入.point_location
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.point_type <> ""
|
||||
po.point_type = 输入.point_type
|
||||
ENDOPTION
|
||||
OPTION 输入.point_type = "5"
|
||||
IFNULL(po.material_code,'') = ''
|
||||
ENDOPTION
|
||||
UNION
|
||||
SELECT
|
||||
task.task_id,
|
||||
point_code
|
||||
FROM
|
||||
SCH_BASE_Point po
|
||||
LEFT JOIN sch_base_task task ON task.point_code1 = po.point_code
|
||||
AND task.task_status < '07'
|
||||
AND task.is_delete = '0'
|
||||
WHERE
|
||||
po.is_delete = '0'
|
||||
AND po.is_used = '1'
|
||||
OPTION 输入.reging_id <> ""
|
||||
po.region_id = 输入.reging_id
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.point_location <> ""
|
||||
po.point_location = 输入.point_location
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.point_type <> ""
|
||||
po.point_type = 输入.point_type
|
||||
ENDOPTION
|
||||
OPTION 输入.point_type = "5"
|
||||
IFNULL(po.material_code,'') = ''
|
||||
ENDOPTION
|
||||
) c
|
||||
GROUP BY
|
||||
c.point_code
|
||||
) b ON b.point_code = a.point_code
|
||||
ORDER BY num,a.point_code
|
||||
ENDSELECT
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "半成品入库")
|
||||
@Api(tags = "成品入库")
|
||||
@RequestMapping("/api/pda/st")
|
||||
@Slf4j
|
||||
public class ProductInstorController {
|
||||
@@ -38,8 +38,8 @@ public class ProductInstorController {
|
||||
}
|
||||
|
||||
@PostMapping("/confirm")
|
||||
@Log("查询子卷包装关系")
|
||||
@ApiOperation("查询子卷包装关系")
|
||||
@Log("手持生产入库确认")
|
||||
@ApiOperation("手持生产入库确认")
|
||||
public ResponseEntity<Object> confirm(@RequestBody JSONObject whereJson){
|
||||
return new ResponseEntity<>(productInstorService.confirm(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -129,6 +129,14 @@ public class ProductInstorServiceImpl implements ProductInstorService {
|
||||
if (option.equals("4")) {
|
||||
mst_jo.put("bill_type", "0005");
|
||||
}
|
||||
HashMap box_map = box_rows.get(0);
|
||||
Object sub_type = box_map.get("sub_type");
|
||||
if (ObjectUtil.isNotEmpty(sub_type)){
|
||||
if (sub_type.equals("1")){
|
||||
//如果为返检的包装关系则变为返检入库
|
||||
mst_jo.put("bill_type", "0006");
|
||||
}
|
||||
}
|
||||
//查询成品库仓库
|
||||
JSONObject stor = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("is_delete = '0' AND is_used = '1' AND is_productstore = '1'").uniqueResult(0);
|
||||
mst_jo.put("stor_id", stor.getString("stor_id"));
|
||||
|
||||
@@ -70,7 +70,8 @@
|
||||
container_name,
|
||||
product_name,
|
||||
product_description,
|
||||
net_weight
|
||||
net_weight,
|
||||
sub_type
|
||||
FROM
|
||||
pdm_bi_subpackagerelation sub
|
||||
WHERE
|
||||
@@ -85,7 +86,8 @@
|
||||
sub.container_name,
|
||||
sub.product_name,
|
||||
sub.product_description,
|
||||
sub.net_weight
|
||||
sub.net_weight,
|
||||
sub_type
|
||||
FROM
|
||||
st_ivt_iostorinvdis dis
|
||||
LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id
|
||||
|
||||
@@ -13,6 +13,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.utils.RedisUtils;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
@@ -22,6 +23,7 @@ import org.nl.wms.basedata.st.service.impl.UserAreaServiceImpl;
|
||||
import org.nl.wms.ext.mes.service.impl.LmsToMesServiceImpl;
|
||||
import org.nl.wms.pdm.ivt.service.HotPointIvtService;
|
||||
import org.nl.wms.pdm.ivt.service.dto.HotPointIvtDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -40,6 +42,9 @@ import java.util.Map;
|
||||
@Slf4j
|
||||
public class HotPointIvtServiceImpl implements HotPointIvtService {
|
||||
|
||||
@Autowired
|
||||
private RedisUtils redisUtils;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
//获取人员对应的区域
|
||||
@@ -59,6 +64,17 @@ public class HotPointIvtServiceImpl implements HotPointIvtService {
|
||||
|
||||
if (ObjectUtil.isNotEmpty(in_area_id)) map.put("in_area_id", in_area_id);
|
||||
JSONObject json = WQL.getWO("ST_IVT_HOTPOINTIVT").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "product_area,point_code");
|
||||
JSONArray rows = json.getJSONArray("content");
|
||||
JSONArray new_rows = new JSONArray();
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject row = rows.getJSONObject(i);
|
||||
String temperature = (String) redisUtils.hget(row.getString("point_code"), "temperature");
|
||||
String last_time = (String) redisUtils.hget(row.getString("point_code"), "last_time");
|
||||
row.put("temperature",temperature);
|
||||
row.put("last_time",last_time);
|
||||
new_rows.add(row);
|
||||
}
|
||||
json.put("content",new_rows);
|
||||
return json;
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -6,10 +6,12 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.utils.RedisUtils;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||
import org.nl.wms.sch.tasks.URLEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -18,9 +20,12 @@ import java.util.HashMap;
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class AutoQueryDeviceStatus {
|
||||
@Autowired
|
||||
private RedisUtils redisUtils;
|
||||
private final WmsToAcsService wmsToAcsService;
|
||||
|
||||
public void run() {
|
||||
WQLObject ivtTab = WQLObject.getWQLObject("st_ivt_hotpointivt");
|
||||
for (URLEnum url : URLEnum.values()) {
|
||||
try {
|
||||
String product_area = url.getProduct_area();
|
||||
@@ -30,13 +35,12 @@ public class AutoQueryDeviceStatus {
|
||||
continue;
|
||||
}
|
||||
JSONObject jo = wmsToAcsService.getHotPointStatus(device_rows);
|
||||
WQLObject ivtTab = WQLObject.getWQLObject("st_ivt_hotpointivt");
|
||||
JSONArray de_rows = jo.getJSONArray("data");
|
||||
for (int i = 0; i < de_rows.size(); i++) {
|
||||
JSONObject row = de_rows.getJSONObject(i);
|
||||
String device_code = row.getString("device_code");
|
||||
HashMap<String,String> map = new HashMap<>();
|
||||
map.put("temperature", row.getString("temperature"));
|
||||
map.put("temperature", row.getString("now_temperature"));
|
||||
//获取倒计时,分,秒
|
||||
String countdown_house = row.getString("countdown_house");
|
||||
String countdown_min = row.getString("countdown_min");
|
||||
@@ -53,7 +57,9 @@ public class AutoQueryDeviceStatus {
|
||||
}
|
||||
String last_time = countdown_house + "小时" + countdown_min + "分钟";
|
||||
map.put("last_time", last_time);
|
||||
ivtTab.update(map,"point_code = '"+device_code+"'");
|
||||
redisUtils.hset(device_code,"temperature",row.getString("temperature"));
|
||||
redisUtils.hset(device_code,"last_time",last_time);
|
||||
//ivtTab.update(map,"point_code = '"+device_code+"'");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.info(e.getMessage());
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
package org.nl.wms.sch.manage;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.config.RedisConfig;
|
||||
import org.nl.modules.common.utils.RedisUtils;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||
import org.nl.wms.sch.tasks.URLEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class AutoSendFeiShu {
|
||||
public void run() {
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("em_bi_devicestatus");
|
||||
//查询故障了还未发送的
|
||||
JSONArray send_rows = wo.query("error = '1' AND is_upload = '0' AND upload_flag = '1'").getResultJSONArray(0);
|
||||
this.sendInfo(send_rows);
|
||||
|
||||
//查询已经发送了但是还是故障中的
|
||||
String resend_time = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("FEISHU_URL").getValue();
|
||||
JSONArray resend_rows = wo.query("error = '1' AND is_upload = '1' AND upload_flag = '1' AND TIMESTAMPDIFF(MINUTE,upload_time,NOW()) > " + resend_time).getResultJSONArray(0);
|
||||
this.sendInfo(resend_rows);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void sendInfo(JSONArray device_rows) {
|
||||
WQLObject wo = WQLObject.getWQLObject("em_bi_devicestatus");
|
||||
for (int i = 0; i < device_rows.size(); i++) {
|
||||
JSONObject row = device_rows.getJSONObject(i);
|
||||
String device_code = row.getString("device_code");
|
||||
String device_name = row.getString("device_name");
|
||||
String product_area = row.getString("product_area");
|
||||
String error_msg = row.getString("error_msg");
|
||||
String upload_user = row.getString("upload_user");
|
||||
String[] split = upload_user.split(",");
|
||||
JSONArray UserList = new JSONArray();
|
||||
if (split.length > 0) {
|
||||
for (String s : split) {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("User", s);
|
||||
UserList.add(jo);
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
String Message = product_area + "区域的设备:" + device_code + "[" + device_name + "],发生故障。故障信息为:" + error_msg;
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("SendType", "L");
|
||||
jo.put("Title", "LMS设备故障信息");
|
||||
jo.put("WarnType", "string");
|
||||
jo.put("MessageType", "P");
|
||||
jo.put("UserList", UserList);
|
||||
jo.put("Message", Message);
|
||||
|
||||
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("FEISHU_URL").getValue();
|
||||
String api = "/FeiShuNoticesWebApi/CommunalApi";
|
||||
url = url + api;
|
||||
try {
|
||||
String resultMsg = HttpRequest.post(url)
|
||||
.body(String.valueOf(jo))
|
||||
.execute().body();
|
||||
log.info("飞书输入参数为:-------------------" + jo);
|
||||
log.info("飞书输出参数为:-------------------" + resultMsg);
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("is_upload", "1");
|
||||
map.put("upload_time", DateUtil.now());
|
||||
wo.update(map, "device_code = '" + device_code + "'");
|
||||
} catch (Exception e) {
|
||||
log.info(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
package org.nl.wms.sch.rest;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -84,6 +85,18 @@ public class PointController {
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@PutMapping("/changeActives")
|
||||
@Log("批量修改点位启用状态")
|
||||
@ApiOperation("批量修改点位启用状态")
|
||||
//@SaCheckPermission("store:edit")
|
||||
public ResponseEntity<Object> update2(@RequestBody JSONArray rows) {
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject json = rows.getJSONObject(i);
|
||||
pointService.changeActive(json);
|
||||
}
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@PostMapping("/getPoint")
|
||||
@Log("查询点位下拉框")
|
||||
@ApiOperation("查询点位下拉框")
|
||||
|
||||
@@ -50,7 +50,13 @@ public class PointServiceImpl implements PointService {
|
||||
map.put("point_status", whereJson.get("point_status"));
|
||||
map.put("is_used", whereJson.get("is_used"));
|
||||
map.put("point_type", whereJson.get("point_type"));
|
||||
map.put("name", whereJson.get("name"));
|
||||
Object name = whereJson.get("name");
|
||||
if (ObjectUtil.isNotEmpty(name)){
|
||||
String search = (String) name;
|
||||
String[] split = search.split("_");
|
||||
name = String.join("\\_", split);
|
||||
map.put("name", name);
|
||||
}
|
||||
JSONObject json = WQL.getWO("QSCH_BASE_POINT").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "point_code asc");
|
||||
JSONArray content = json.getJSONArray("content");
|
||||
JSONArray res = new JSONArray();
|
||||
|
||||
@@ -45,13 +45,13 @@ public class CallEmpReelTask extends AbstractAcsTask {
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
|
||||
String product_area = json.getString("product_area");
|
||||
String agv_system_type = "";
|
||||
if (product_area.equals("A1") || product_area.equals("A2")) {
|
||||
String agv_system_type = "2";
|
||||
/*if (product_area.equals("A1") || product_area.equals("A2")) {
|
||||
agv_system_type = "2";
|
||||
}
|
||||
if (product_area.equals("A3") || product_area.equals("A4")) {
|
||||
agv_system_type = "3";
|
||||
}
|
||||
}*/
|
||||
AcsTaskDto dto = AcsTaskDto.builder()
|
||||
.ext_task_id(json.getString("task_id"))
|
||||
.task_code(json.getString("task_code"))
|
||||
|
||||
@@ -44,13 +44,13 @@ public class CoolCutTask extends AbstractAcsTask {
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
|
||||
String product_area = json.getString("product_area");
|
||||
String agv_system_type = "";
|
||||
if (product_area.equals("A1") || product_area.equals("A2")) {
|
||||
String agv_system_type = "2";
|
||||
/*if (product_area.equals("A1") || product_area.equals("A2")) {
|
||||
agv_system_type = "2";
|
||||
}
|
||||
if (product_area.equals("A3") || product_area.equals("A4")) {
|
||||
agv_system_type = "3";
|
||||
}
|
||||
}*/
|
||||
AcsTaskDto dto = AcsTaskDto.builder()
|
||||
.ext_task_id(json.getString("task_id"))
|
||||
.task_code(json.getString("task_code"))
|
||||
|
||||
@@ -42,13 +42,13 @@ public class CutTrussTask extends AbstractAcsTask {
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
|
||||
String product_area = json.getString("product_area");
|
||||
String agv_system_type = "";
|
||||
if (product_area.equals("A1") || product_area.equals("A2")) {
|
||||
String agv_system_type = "2";
|
||||
/*if (product_area.equals("A1") || product_area.equals("A2")) {
|
||||
agv_system_type = "2";
|
||||
}
|
||||
if (product_area.equals("A3") || product_area.equals("A4")) {
|
||||
agv_system_type = "3";
|
||||
}
|
||||
}*/
|
||||
|
||||
//添加过滤,如果为分切机B轴的下料位,要判断该分切机A轴的点位是否存在未下发的任务,存在则也不允许下发
|
||||
String point_code1 = json.getString("point_code1");
|
||||
|
||||
@@ -47,13 +47,13 @@ public class InCoolIvtTask extends AbstractAcsTask {
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
|
||||
String product_area = json.getString("product_area");
|
||||
String agv_system_type = "";
|
||||
if (product_area.equals("A1") || product_area.equals("A2")) {
|
||||
String agv_system_type = "2";
|
||||
/*if (product_area.equals("A1") || product_area.equals("A2")) {
|
||||
agv_system_type = "2";
|
||||
}
|
||||
if (product_area.equals("A3") || product_area.equals("A4")) {
|
||||
agv_system_type = "3";
|
||||
}
|
||||
}*/
|
||||
|
||||
AcsTaskDto dto = AcsTaskDto.builder()
|
||||
.ext_task_id(json.getString("task_id"))
|
||||
|
||||
@@ -45,13 +45,13 @@ public class InHotTask extends AbstractAcsTask {
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
|
||||
String product_area = json.getString("product_area");
|
||||
String agv_system_type = "";
|
||||
if (product_area.equals("A1") || product_area.equals("A2")) {
|
||||
String agv_system_type = "2";
|
||||
/*if (product_area.equals("A1") || product_area.equals("A2")) {
|
||||
agv_system_type = "2";
|
||||
}
|
||||
if (product_area.equals("A3") || product_area.equals("A4")) {
|
||||
agv_system_type = "3";
|
||||
}
|
||||
}*/
|
||||
|
||||
AcsTaskDto dto = AcsTaskDto.builder()
|
||||
.ext_task_id(json.getString("task_id"))
|
||||
|
||||
@@ -45,13 +45,13 @@ public class OutHotTask extends AbstractAcsTask {
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
|
||||
String product_area = json.getString("product_area");
|
||||
String agv_system_type = "";
|
||||
if (product_area.equals("A1") || product_area.equals("A2")){
|
||||
String agv_system_type = "2";
|
||||
/*if (product_area.equals("A1") || product_area.equals("A2")){
|
||||
agv_system_type = "2";
|
||||
}
|
||||
if (product_area.equals("A3") || product_area.equals("A4")){
|
||||
agv_system_type = "3";
|
||||
}
|
||||
}*/
|
||||
|
||||
AcsTaskDto dto = AcsTaskDto.builder()
|
||||
.ext_task_id(json.getString("task_id"))
|
||||
|
||||
@@ -227,6 +227,9 @@ public class InBillQueryServiceImpl implements InBillQueryService {
|
||||
mp.put("居中度(mm)", "±1");
|
||||
mp.put("塌边(mm)", "≤10");
|
||||
mp.put("米数(长度)", NumberUtil.round(json.getString("length"), 1));
|
||||
mp.put("生产实际抗拉值", json.getString("actual_value"));
|
||||
mp.put("内控标准抗拉下限", json.getString("standard_limit"));
|
||||
mp.put("客户需求抗拉下限", json.getString("demand_limit"));
|
||||
mp.put("生产日期", json.getString("date_of_production").replace("-","/"));
|
||||
mp.put("入库日期", json.getString("confirm_time").substring(0,10).replace("-","/"));
|
||||
list.add(mp);
|
||||
|
||||
@@ -78,6 +78,9 @@
|
||||
sub.thickness_request,
|
||||
sub.width_standard,
|
||||
sub.mass_per_unit_area,
|
||||
sub.demand_limit,
|
||||
sub.standard_limit,
|
||||
sub.actual_value,
|
||||
(case when plan.parent_container_name <> '' then plan.parent_container_name else plan.restruct_container_name end) AS parent_container_name,
|
||||
mst.remark,
|
||||
(case when DATE_FORMAT( mst.confirm_time, '%H:%i:%s' ) >='08:00:00' AND DATE_FORMAT( mst.confirm_time, '%H:%i:%s' ) <= '19:59:59' then '白班'
|
||||
@@ -315,6 +318,9 @@
|
||||
sub.thickness,
|
||||
sub.box_weight,
|
||||
sub.length,
|
||||
sub.actual_value,
|
||||
sub.standard_limit,
|
||||
sub.demand_limit,
|
||||
sub.thickness_request,
|
||||
sub.width_standard,
|
||||
sub.mass_per_unit_area,
|
||||
|
||||
Reference in New Issue
Block a user