|  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.mapper.EntityWrapper; | 
|---|
|  |  |  | import com.core.common.Cools; | 
|---|
|  |  |  | import com.core.common.R; | 
|---|
|  |  |  | import com.zy.asrs.entity.Order; | 
|---|
|  |  |  | import com.zy.asrs.entity.WrkDetl; | 
|---|
|  |  |  | import com.zy.asrs.entity.WrkMast; | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.zy.asrs.service.WrkMastService; | 
|---|
|  |  |  | import com.zy.common.constant.AgvApiConstant; | 
|---|
|  |  |  | import com.zy.common.utils.HttpHandler; | 
|---|
|  |  |  | import com.zy.system.entity.Config; | 
|---|
|  |  |  | import com.zy.system.service.ConfigService; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.annotation.Resource; | 
|---|
|  |  |  | import java.math.BigDecimal; | 
|---|
|  |  |  | import java.util.HashMap; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private OrderService orderService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ConfigService configService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 出库呼叫agv接货 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public void outboundCallAgvHandller(Integer wrkNo) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Config mesAuto = configService.selectConfigByCode("CLOSE_OUTBOUND"); | 
|---|
|  |  |  | if (mesAuto != null && mesAuto.getValue().equals("0")) { | 
|---|
|  |  |  | return ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | WrkMast wrkMast = wrkMastService.selectById(wrkNo); | 
|---|
|  |  |  | if (wrkMast == null) { | 
|---|
|  |  |  | 
|---|
|  |  |  | // 构造请求体 | 
|---|
|  |  |  | JSONObject jsonObject = new JSONObject(); | 
|---|
|  |  |  | jsonObject.put("trayCode", wrkMast.getBarcode()); // 托盘条码 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | jsonObject.put("startLocation", wrkMast.getStaNo()); // 提升机号 | 
|---|
|  |  |  | jsonObject.put("endLocation", wrkMast.getInvWh()); // 地码/终点货位 | 
|---|
|  |  |  | jsonObject.put("taskId", wrkMast.getWrkNo()); // 任务id | 
|---|
|  |  |  | jsonObject.put("outBoundtype", "2.1.2.1原料/半成品出库"); | 
|---|
|  |  |  | //jsonObject.put("erpCode", wrkDetls.get(0).getOrderNo()); | 
|---|
|  |  |  | // 保存一个订单明细的单据编号 | 
|---|
|  |  |  | String orderNo = ""; | 
|---|
|  |  |  | JSONArray jsonArray = new JSONArray(); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (order != null) { | 
|---|
|  |  |  | jsonObject.put("erpCode", orderNo); // 工单号 | 
|---|
|  |  |  | jsonObject.put("outBoundtype", order.getDocType$()); // 入出库单据类型 | 
|---|
|  |  |  | //jsonObject.put("outBoundtype", order.getDocType$()); // 入出库单据类型 | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | String body = jsonObject.toString(); | 
|---|
|  |  |  | 
|---|
|  |  |  | .doPost(); | 
|---|
|  |  |  | if (!Cools.isEmpty(response)) { | 
|---|
|  |  |  | JSONObject jsonObject1 = JSONObject.parseObject(response); | 
|---|
|  |  |  | if ((Integer) jsonObject1.get("code") == 200) { | 
|---|
|  |  |  | if (jsonObject1.get("code") != null && jsonObject1.get("code").equals("200")) { | 
|---|
|  |  |  | success = true; | 
|---|
|  |  |  | wrkMast.setRefWrkno(1.0); | 
|---|
|  |  |  | wrkMastService.updateById(wrkMast); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|