| | |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.asrs.entity.ManLocDetl; |
| | | import com.zy.asrs.entity.Mat; |
| | | import com.core.common.*; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.OrderInspectionRollParam; |
| | | import com.zy.asrs.entity.param.OrderMesXGHYParam; |
| | | import com.zy.asrs.entity.param.QualityGroupListParam; |
| | | import com.zy.asrs.entity.result.OrderPakoutDetailVo; |
| | | import com.zy.asrs.mapper.LocDetlMapper; |
| | |
| | | private MatService matService; |
| | | @Autowired |
| | | private ApiLogService apiLogService; |
| | | @Autowired |
| | | private SnowflakeIdWorker snowflakeIdWorker; |
| | | |
| | | @Value("${srXghyMes.qualityFinishedCheckoutUrl}") |
| | | private String qualityFinishedCheckoutUrl; |
| | | @Value("${srXghyMes.qualityFinishedCheckout}") |
| | | private String qualityFinishedCheckout; |
| | | |
| | | @Value("${srXghyMes.productInventoryUrl}") |
| | | private String productInventoryUrl; |
| | | @Value("${srXghyMes.productInventory}") |
| | | private String productInventory; |
| | | |
| | | @RequestMapping(value = "/locDetl/update") |
| | | public R update1() { |
| | |
| | | return R.error("用户异常").add("用户异常"); |
| | | } |
| | | List<LocDetl> locDetlList = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("model", model)); |
| | | OrderInspectionRollParam orderInspectionRollParam = new OrderInspectionRollParam(model); |
| | | // OrderInspectionRollParam orderInspectionRollParam = new OrderInspectionRollParam(model); |
| | | String response = ""; |
| | | boolean success = false; |
| | | Map<String, Object> params = JSON.parseObject(JSON.toJSONString(orderInspectionRollParam), Map.class); |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("batchNo", model); |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | .setUri(qualityFinishedCheckoutUrl) |
| | |
| | | qualityFinishedCheckoutUrl+"/"+qualityFinishedCheckout, |
| | | null, |
| | | "127.0.0.1", |
| | | JSON.toJSONString(orderInspectionRollParam), |
| | | JSON.toJSONString(params), |
| | | response, |
| | | success |
| | | ); |
| | | } catch (Exception e) { } |
| | | } |
| | | return R.error("上报失败").add("上报失败"); |
| | | } |
| | | |
| | | @RequestMapping(value = "/synchronize/mes/locDetl/report/auth") |
| | | @ManagerAuth(memo = "同步库存至MES") |
| | | public R synchronizeLocDetlMes() { |
| | | List<LocDetl> locDetlList = locDetlService.selectList(new EntityWrapper<LocDetl>()); |
| | | if (locDetlList.isEmpty()) { |
| | | return R.error("库存为空!!!"); |
| | | } |
| | | |
| | | OrderMesXGHYParam orderMesXGHYParam = new OrderMesXGHYParam(locDetlList,"in","成品入库"); |
| | | orderMesXGHYParam.setBarcode(String.valueOf(snowflakeIdWorker.nextId())); |
| | | orderMesXGHYParam.setPalletizingNo(1); |
| | | |
| | | |
| | | String response = ""; |
| | | boolean success = false; |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | .setUri(productInventoryUrl) |
| | | .setPath(productInventory) |
| | | .setJson(JSON.toJSONString(orderMesXGHYParam)) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getBoolean("state")) { |
| | | success = true; |
| | | } else { |
| | | return R.error("同步库存至MES"); |
| | | } |
| | | } catch (Exception e) { |
| | | return R.error("同步库存至MES"+e.getMessage()); |
| | | } finally { |
| | | try { |
| | | // 保存接口日志 |
| | | apiLogService.save( |
| | | "同步库存至MES", |
| | | productInventoryUrl+"/"+productInventory, |
| | | null, |
| | | "127.0.0.1", |
| | | JSON.toJSONString(orderMesXGHYParam), |
| | | response, |
| | | success |
| | | ); |