| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.alibaba.excel.util.StringUtils; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.core.annotations.AppAuth; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.mes.*; |
| | | import com.zy.asrs.entity.param.CombParam; |
| | | import com.zy.asrs.service.MesService; |
| | | import com.zy.asrs.service.MobileService; |
| | | import com.zy.asrs.service.impl.RcsServiceImpl; |
| | | import com.zy.common.web.BaseController; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.hibernate.validator.constraints.NotEmpty; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @Slf4j |
| | | public class MesController extends BaseController { |
| | | |
| | | // 海康RCS地址 |
| | | @Value("${hik.url}") |
| | | private String HIK_URL; |
| | | @Autowired |
| | | private MobileService mobileService; |
| | | @Resource |
| | | private MesService mesService; |
| | | |
| | |
| | | // 物料信息同步 |
| | | @PostMapping("/api/mes/synMatInfo") |
| | | @AppAuth(memo = "物料信息同步") |
| | | public MesReturn synMatInfo(@RequestHeader(required = false) String appkey,@RequestBody MesMatRecvForm param, HttpServletRequest request){ |
| | | auth(appkey, param, request); |
| | | //public MesReturn synMatInfo(@RequestHeader(required = false) String appkey, @RequestBody List<MesMatRecvForm> params, HttpServletRequest request){ |
| | | public MesReturn synMatInfo(@RequestHeader(required = false) String appkey, @RequestBody MesMatRecvForm params, HttpServletRequest request){ |
| | | auth(appkey, params, request); |
| | | MesReturn mesReturn = new MesReturn(); |
| | | try { |
| | | mesReturn = mesService.matInfoAndInBound(param); |
| | | // for (MesMatRecvForm param : params){ |
| | | // mesReturn = mesService.matInfoAndInBound(param); |
| | | // } |
| | | mesReturn = mesService.matInfoAndInBound(params); |
| | | } catch (Exception e) { |
| | | mesReturn.setSuccess("2"); |
| | | mesReturn.setMessage("物料信息同步失败"); |
| | |
| | | return mesReturn; |
| | | } |
| | | |
| | | // 出库申请(叫料),装配库、滑块库 |
| | | // // 出库入库订单申请 |
| | | @PostMapping("/api/mes/callOutBoundOrder") |
| | | public MesReturn callOutBoundOrder(@RequestBody MesCallOutApply param){ |
| | | |
| | |
| | | // 入站允许 |
| | | @PostMapping("/api/mes/allowInStation") |
| | | public MesReturn allowInStation(@RequestBody TransInOutStationAllow param){ |
| | | |
| | | return mesService.allowInStation(param); |
| | | } |
| | | |
| | | // 离站允许,装配库、滑块库 |
| | | @PostMapping("/api/mes/allowOutStation") |
| | | public MesReturn allowOutStation(@RequestBody TransInOutStationAllow param){ |
| | | |
| | | return mesService.allowOutStation(param); |
| | | } |
| | | |
| | |
| | | return mesService.queryInventory(itemno,orderNo); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * MES调用PDA的AGV订单入库接口 |
| | | * @param combParam |
| | | * @return |
| | | */ |
| | | @RequestMapping("/comb/auth") |
| | | @ManagerAuth(memo = "组托") |
| | | public R comb(@RequestBody CombParam combParam){ |
| | | log.info("=============== MES下发组托订单 ==============="); |
| | | log.info("{}", combParam); |
| | | log.info("=============== MES下发组托订单 ==============="); |
| | | if (combParam.getUserId() != null && !combParam.getUserId().equals(null)){ |
| | | mobileService.comb(combParam, combParam.getUserId()); |
| | | }else { |
| | | mobileService.comb(combParam, getUserId()); |
| | | } |
| | | return R.ok("组托成功"); |
| | | } |
| | | |
| | | @PostMapping("/api/mes/pauseAGV") |
| | | public MesReturn AGVPause(@RequestBody JSONObject param){ |
| | | MesReturn mesReturn = new MesReturn(); |
| | | int AGVType; |
| | | if (param.containsKey("zoneCode")){ |
| | | param.put("mapCode", "BB"); |
| | | param.put("invoke", "BLOCKADE"); |
| | | AGVType = 1; |
| | | }else { |
| | | AGVType = 2; |
| | | } |
| | | if (mesService.AGVPause(param, AGVType) == 1){ |
| | | mesReturn.setSuccess("1"); |
| | | mesReturn.setMessage("成功"); |
| | | return mesReturn; |
| | | }else { |
| | | mesReturn.setSuccess("2"); |
| | | mesReturn.setMessage("失败"); |
| | | return mesReturn; |
| | | } |
| | | } |
| | | } |