| | |
| | | if (locMast == null) { |
| | | return false; |
| | | } |
| | | return this.baseMapper.selectEmptyLocCount(locMast.getLocType1(), locMast.getCrnNo()) > 1; |
| | | return this.baseMapper.selectEmptyLocCount(locMast.getLocType1(), locMast.getCrnNo()) > 5; |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Autowired |
| | | MesMatSyncHandler handler; |
| | | |
| | | |
| | | //@Scheduled(cron = "0/30 * * * * ?") |
| | | // @Scheduled(cron = "0/30 * * * * ?") |
| | | //@Scheduled(cron = "0 0/2 * * * ?") |
| | | private void execute() { |
| | | |
| | | ReturnT<String> result = null; |
| | |
| | | import com.zy.asrs.task.handler.MesPakinHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | |
| | | @Autowired |
| | | MesPakinHandler handler; |
| | | |
| | | |
| | | //@Scheduled(cron = "0/30 * * * * ?") |
| | | |
| | | //@Scheduled(cron = "0/30 * * * * ?") |
| | | private void execute() { |
| | | |
| | |
| | | import com.zy.asrs.task.handler.MesPakoutHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * 轮询MES接口,生成出库单据 |
| | |
| | | private void execute() { |
| | | |
| | | ReturnT<String> result = null; |
| | | try { |
| | | result = handler.start(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if (!result.isSuccess()) { |
| | | log.error(""); |
| | | } |
| | |
| | | package com.zy.asrs.task.handler; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | |
| | | import com.zy.asrs.task.AbstractHandler; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.asrs.utils.MesSyncUtil; |
| | | import com.zy.common.constant.MesConstant; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import java.io.IOException; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class MesPakinHandler extends AbstractHandler<String> { |
| | | @Value("${mes.pakin.url}") |
| | | private String url; |
| | | private String uri; |
| | | |
| | | @Value("${mes.pakin.path}") |
| | | private String path; |
| | |
| | | @Transactional |
| | | public ReturnT<String> start() { |
| | | boolean success = true; |
| | | log.info("url:" + url + path); |
| | | log.info("url:" + uri + path); |
| | | JSONObject jsonObject = null; |
| | | String respone; |
| | | try { |
| | | jsonObject = doGetJsonData(); |
| | | jsonObject = doPostJsonData(); |
| | | log.info("MesPakinHandler jsonObject:" + jsonObject); |
| | | } catch (IOException e) { |
| | | success = false; |
| | | e.printStackTrace(); |
| | |
| | | int code = jsonObject.getInteger("code"); |
| | | |
| | | if(code == 200){ |
| | | JSONObject jsonData = jsonObject.getJSONObject("data"); |
| | | String orderNo = jsonData.getString("orderNo"); |
| | | Order o = insertOrder(jsonData,orderNo); |
| | | insertOrUpdateOrderDetl(jsonData, o); |
| | | if(!Cools.isEmpty(jsonObject.getString("data")) && jsonObject.getString("data").length()>2){ |
| | | |
| | | JSONArray jsonArray = jsonObject.getJSONArray("data"); |
| | | List<JSONObject> jsonDataList = jsonArray.toJavaList(JSONObject.class); |
| | | |
| | | jsonDataList.forEach(data -> { |
| | | String orderNo = data.getString("orderNo"); |
| | | Order o = insertOrder(data,orderNo); |
| | | insertOrUpdateOrderDetl(data, o); |
| | | }); |
| | | } |
| | | }else { |
| | | success = false; |
| | | log.error("请求mes接口响应错误,响应码为: " + code); |
| | |
| | | private void saveApiLog(String response, boolean success){ |
| | | apiLogService.save( |
| | | "生成入库单据", |
| | | url + path, |
| | | uri + path, |
| | | null, |
| | | "127.0.0.1", |
| | | null, |
| | |
| | | } |
| | | |
| | | /* |
| | | 发起一个doGet请求 |
| | | 发起一个请求来获取未获取过的单据信息 |
| | | */ |
| | | private JSONObject doGetJsonData() throws IOException { |
| | | private JSONObject doPostJsonData() throws IOException { |
| | | |
| | | Map<String, Object> requestParamMap = MesSyncUtil.getRequestParamMap(); |
| | | //获取未获取过的所有单据 |
| | | requestParamMap.put("type",0); |
| | | |
| | | return JSON.parseObject( new HttpHandler.Builder() |
| | | .setUri(url) |
| | | .setUri(uri) |
| | | .setPath(path) |
| | | .setParams(MesSyncUtil.getRequestParamMap()) |
| | | .setParams(requestParamMap) |
| | | .build() |
| | | .doGet()); |
| | | .doPostWithParam()); |
| | | } |
| | | |
| | | /* |
| | |
| | | o.setOrderTime(jsonData.getString("orderTime")); |
| | | //单据类型 |
| | | DocType docType = docTypeService.selectOrAdd(jsonData.getString("orderType"), Boolean.TRUE); |
| | | //物流名称 -- 入库库房名称(立体库名称) |
| | | o.setShipName(jsonData.getString("storage")); |
| | | o.setDocType(docType.getDocId()); |
| | | o.setCreateTime(new Date()); |
| | | o.setUpdateTime(new Date()); |
| | |
| | | package com.zy.asrs.task.handler; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.common.SnowflakeIdWorker; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.DiaphragmInfo; |
| | | import com.zy.asrs.entity.DocType; |
| | | import com.zy.asrs.entity.Order; |
| | | import com.zy.asrs.entity.OrderDetl; |
| | | import com.zy.asrs.service.ApiLogService; |
| | | import com.zy.asrs.service.DocTypeService; |
| | | import com.zy.asrs.service.OrderDetlService; |
| | | import com.zy.asrs.service.OrderService; |
| | | import com.zy.asrs.task.AbstractHandler; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.asrs.utils.MesSyncUtil; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class MesPakoutHandler extends AbstractHandler<String> { |
| | | @Value("${mes.pakin.url}") |
| | | private String url; |
| | | @Value("${mes.pakout.url}") |
| | | private String uri; |
| | | |
| | | @Value("${mes.pakin.path}") |
| | | @Value("${mes.pakout.path}") |
| | | private String path; |
| | | |
| | | @Autowired |
| | | private DocTypeService docTypeService; |
| | | |
| | | @Autowired |
| | | private SnowflakeIdWorker snowflakeIdWorker; |
| | | |
| | | @Autowired |
| | | private OrderService orderService; |
| | | |
| | | @Autowired |
| | | private ApiLogService apiLogService; |
| | | |
| | | @Autowired |
| | | private OrderDetlService orderDetlService; |
| | | |
| | | public ReturnT<String> start() throws IOException { |
| | | @Transactional |
| | | public ReturnT<String> start() { |
| | | boolean success = true; |
| | | log.info("url:" + uri + path); |
| | | JSONObject jsonObject = null; |
| | | try { |
| | | jsonObject = doPostJsonData(); |
| | | } catch (IOException e) { |
| | | success = false; |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | int code = jsonObject.getInteger("code"); |
| | | |
| | | if(code == 200){ |
| | | if(!Cools.isEmpty(jsonObject.getString("data")) && jsonObject.getString("data").length()>2){ |
| | | |
| | | JSONArray jsonArray = jsonObject.getJSONArray("data"); |
| | | List<JSONObject> jsonDataList = jsonArray.toJavaList(JSONObject.class); |
| | | |
| | | jsonDataList.forEach(data -> { |
| | | String orderNo = data.getString("orderNo"); |
| | | Order o = insertOrder(data,orderNo); |
| | | insertOrUpdateOrderDetl(data, o); |
| | | }); |
| | | } |
| | | |
| | | }else { |
| | | success = false; |
| | | log.error("请求mes接口响应错误,响应码为: " + code); |
| | | } |
| | | saveApiLog(jsonObject.toJSONString(),success); |
| | | return SUCCESS; |
| | | } |
| | | |
| | | /* |
| | | 保存日志 |
| | | */ |
| | | private void saveApiLog(String response, boolean success){ |
| | | apiLogService.save( |
| | | "生成出库单据", |
| | | uri + path, |
| | | null, |
| | | "127.0.0.1", |
| | | null, |
| | | response, |
| | | success |
| | | ); |
| | | } |
| | | |
| | | /* |
| | | 发起一个请求来获取未获取过的单据信息 |
| | | */ |
| | | private JSONObject doPostJsonData() throws IOException { |
| | | |
| | | Map<String, Object> requestParamMap = MesSyncUtil.getRequestParamMap(); |
| | | //获取未获取过的所有单据 |
| | | requestParamMap.put("type",0); |
| | | |
| | | return JSON.parseObject( new HttpHandler.Builder() |
| | | .setUri(uri) |
| | | .setPath(path) |
| | | .setParams(requestParamMap) |
| | | .build() |
| | | .doPostWithParam()); |
| | | } |
| | | |
| | | /* |
| | | 新增order信息 |
| | | */ |
| | | private Order insertOrder(JSONObject jsonData, String orderNo){ |
| | | Order o = orderService.selectByNo(orderNo); |
| | | if (!Cools.isEmpty(o)) { |
| | | throw new CoolException(jsonData.getString("orderNo") + "单据已存在,请勿重复提交"); |
| | | } |
| | | |
| | | o = orderMapping(jsonData); |
| | | if (!orderService.insert(o)) { |
| | | throw new CoolException("生成单据主档失败,请联系管理员"); |
| | | } |
| | | return o; |
| | | } |
| | | |
| | | /* |
| | | 根据orderNo、matnr、batch,新增或者更改orderDetl信息 |
| | | */ |
| | | private void insertOrUpdateOrderDetl(JSONObject jsonData, Order o){ |
| | | List<DiaphragmInfo> diaphragmInfoList = JSONObject.parseArray(jsonData.getString("orderDetails"),DiaphragmInfo.class); |
| | | |
| | | diaphragmInfoList.forEach(d -> { |
| | | EntityWrapper<OrderDetl> wrapper = new EntityWrapper<>(); |
| | | wrapper.eq("order_no",o.getOrderNo()).eq("matnr",d.getItemCode()).eq("batch",d.getBatchNo()); |
| | | OrderDetl od = orderDetlService.selectOne(wrapper); |
| | | if(od == null){ |
| | | od = new OrderDetl(); |
| | | od.setOrderNo(o.getOrderNo()); |
| | | od.setOrderId(o.getId()); |
| | | orderDetlMapping(d,od); |
| | | orderDetlService.insert(od); |
| | | }else { |
| | | od.setQty(od.getQty() + d.getQuantity().doubleValue()); |
| | | od.setAnfme(od.getAnfme() + d.getAssQuantity().doubleValue()); |
| | | od.setUpdateTime(new Date()); |
| | | orderDetlService.updateById(od); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /* |
| | | 映射Order类和jsonData的字段 |
| | | */ |
| | | private Order orderMapping(JSONObject jsonData){ |
| | | Order o = new Order(); |
| | | o.setStatus(1); |
| | | //设置订单状态 --- 初始化状态 |
| | | o.setSettle(0L); |
| | | //uuid |
| | | o.setUuid(String.valueOf(snowflakeIdWorker.nextId())); |
| | | //单据编号 |
| | | o.setOrderNo(jsonData.getString("orderNo")); |
| | | //单据时间 |
| | | o.setOrderTime(jsonData.getString("orderTime")); |
| | | //单据类型 |
| | | DocType docType = docTypeService.selectOrAdd(jsonData.getString("orderType"), Boolean.TRUE); |
| | | //物流名称 -- 入库库房名称(立体库名称) |
| | | o.setShipName(jsonData.getString("storage")); |
| | | o.setDocType(docType.getDocId()); |
| | | o.setCreateTime(new Date()); |
| | | o.setUpdateTime(new Date()); |
| | | return o; |
| | | } |
| | | |
| | | /* |
| | | 映射OrderDetl与隔膜信息类的字段关系 |
| | | */ |
| | | private void orderDetlMapping(DiaphragmInfo d, OrderDetl od){ |
| | | //批号 -- 生产批号 |
| | | od.setBatch(d.getBatchNo()); |
| | | //商品编码 -- 物料编码 |
| | | od.setMatnr(d.getItemCode()); |
| | | //商品名称 -- 物料名称 |
| | | od.setMaktx(d.getItemName()); |
| | | //数量 -- 数量 |
| | | od.setAnfme(d.getQuantity() == null ? null : d.getQuantity().doubleValue()); |
| | | //完成数量 -- 辅数量 |
| | | od.setQty(d.getAssQuantity() == null ? null : d.getAssQuantity().doubleValue()); |
| | | //规格 -- 规格/型号 |
| | | od.setSpecs(d.getStd()); |
| | | //备注 -- 备注 |
| | | od.setMemo(d.getNote()); |
| | | //条形码 -- 条形码 |
| | | od.setQrCode(d.getBarCode()); |
| | | //颜色 -- 大卷位置 |
| | | od.setColor(d.getPosition()); |
| | | //型号 -- 小卷位置 |
| | | od.setModel(d.getPosition2()); |
| | | //品牌 -- 等级 |
| | | od.setBrand(d.getGrade()); |
| | | //收卷开始日期 |
| | | od.setStartDate(d.getStartDate()); |
| | | //收卷结束日期 |
| | | od.setEndDate(d.getEndDate()); |
| | | |
| | | od.setCreateTime(new Date()); |
| | | od.setUpdateTime(new Date()); |
| | | } |
| | | } |
| | |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.exception.CoolException; |
| | | import com.sun.org.apache.xpath.internal.operations.Or; |
| | | import com.zy.asrs.entity.DiaphragmInfo; |
| | | import com.zy.asrs.entity.DocType; |
| | | import com.zy.asrs.entity.Order; |
| | | import com.zy.asrs.entity.OrderDetl; |
| | |
| | | import com.zy.common.model.MesPakoutParam; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.jdbc.core.JdbcTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * Created by vincent on 2020/7/7 |
| | |
| | | @Autowired |
| | | private DocTypeService docTypeService; |
| | | |
| | | @Value("${mes.pakin-sync.url}") |
| | | private String pakinUrl; |
| | | |
| | | @Value("${mes.pakin-sync.path}") |
| | | private String pakinPath; |
| | | |
| | | @Value("${mes.pakout-sync.url}") |
| | | private String pakoutUrl; |
| | | |
| | | @Value("${mes.pakout-sync.path}") |
| | | private String pakoutPath; |
| | | |
| | | @Transactional |
| | | public ReturnT<String> start(Order order) { |
| | | DocType docType = docTypeService.selectById(order.getDocType()); |
| | |
| | | List<OrderDetl> orderDetls = orderDetlService.selectByOrderId(order.getId()); |
| | | // 入库完成上报 |
| | | if (docType.getPakin() == 1) { |
| | | /* |
| | | MesPakinParam pakinParam = new MesPakinParam(); |
| | | pakinParam.setPakinTime(DateUtils.convert(order.getUpdateTime())); |
| | | pakinParam.setLgortFrom("5008"); |
| | |
| | | success |
| | | ); |
| | | } catch (Exception e) { log.error("", e); } |
| | | } */ |
| | | |
| | | return orderPakinSync(order,docType.getDocName(),orderDetls); |
| | | } |
| | | } |
| | | // 出库完成上报 |
| | | if (docType.getPakout() == 1) { |
| | | /* |
| | | MesPakoutParam pakoutParam = new MesPakoutParam(); |
| | | pakoutParam.setTag(!order.getDocType$().equalsIgnoreCase("手动出库单")); |
| | | pakoutParam.setPakoutTime(DateUtils.convert(order.getUpdateTime())); |
| | |
| | | ); |
| | | } catch (Exception e) { log.error("", e); } |
| | | } |
| | | */ |
| | | |
| | | return orderPakoutSync(order,docType.getDocName(),orderDetls); |
| | | } |
| | | return SUCCESS; |
| | | } |
| | | |
| | | private ReturnT<String> orderPakoutSync (Order order, String orderType, List<OrderDetl> orderDetls){ |
| | | Map<String,Object> requestMap = getRequestMap(order,orderType,orderDetls); |
| | | String response = ""; |
| | | boolean success = false; |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | .setUri(pakoutUrl) |
| | | .setPath(pakoutPath) |
| | | .setJson(JSON.toJSONString(requestMap)) |
| | | .build() |
| | | .doPost(); |
| | | success = orderSettleUpdate(response,order); |
| | | } catch (Exception e) { |
| | | log.error("fail", e); |
| | | // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg(e.getMessage()); |
| | | } finally { |
| | | try { |
| | | // 保存接口日志 |
| | | apiLogService.save( |
| | | "成品库出库上报", |
| | | pakoutUrl + pakoutPath, |
| | | null, |
| | | "127.0.0.1", |
| | | JSON.toJSONString(requestMap), |
| | | response, |
| | | success |
| | | ); |
| | | } catch (Exception e) { log.error("", e); } |
| | | } |
| | | |
| | | return SUCCESS; |
| | | } |
| | | |
| | | private ReturnT<String> orderPakinSync (Order order, String orderType, List<OrderDetl> orderDetls){ |
| | | Map<String,Object> requestMap = getRequestMap(order,orderType,orderDetls); |
| | | |
| | | String response = ""; |
| | | boolean success = false; |
| | | |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | .setUri(pakinUrl) |
| | | .setPath(pakinPath) |
| | | .setJson(JSON.toJSONString(requestMap)) |
| | | .build() |
| | | .doPost(); |
| | | success = orderSettleUpdate(response,order); |
| | | } catch (Exception e) { |
| | | log.error("fail", e); |
| | | // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg(e.getMessage()); |
| | | } finally { |
| | | try { |
| | | // 保存接口日志 |
| | | apiLogService.save( |
| | | "成品库入库上报", |
| | | pakinUrl + pakinPath, |
| | | null, |
| | | "127.0.0.1", |
| | | JSON.toJSONString(requestMap), |
| | | response, |
| | | success |
| | | ); |
| | | } catch (Exception e) { log.error("", e); } |
| | | } |
| | | |
| | | return SUCCESS; |
| | | |
| | | } |
| | | |
| | | private Map<String,Object> getRequestMap(Order order,String orderType, List<OrderDetl> orderDetls){ |
| | | Map<String,Object> requestMap = new HashMap<>(); |
| | | requestMap.put("orderNo",order.getOrderNo()); |
| | | requestMap.put("orderTime",order.getOrderTime()); |
| | | requestMap.put("orderType",orderType); |
| | | |
| | | List<DiaphragmInfo> diaphragmInfoList = orderDetls.stream().map(od -> { |
| | | DiaphragmInfo diaphragmInfo = new DiaphragmInfo(); |
| | | diaphragmInfo.setBatchNo(od.getBatch()); |
| | | diaphragmInfo.setItemCode(od.getMatnr()); |
| | | diaphragmInfo.setBarCode(od.getQrCode()); |
| | | diaphragmInfo.setQuantity(new BigDecimal(od.getAnfme())); |
| | | diaphragmInfo.setAssQuantity(new BigDecimal(od.getQty())); |
| | | return diaphragmInfo; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | requestMap.put("orderDetails",diaphragmInfoList); |
| | | |
| | | return requestMap; |
| | | } |
| | | |
| | | private boolean orderSettleUpdate(String response, Order order){ |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | //success = true; |
| | | // 修改订单状态 4.完成 ===>> 6.已上报 |
| | | if (!orderService.updateSettle(order.getId(), 6L, null)) { |
| | | throw new CoolException("服务器内部错误,请联系管理员"); |
| | | } |
| | | } else { |
| | | //log.error("请求接口失败!!!url:{};request:{};response:{}", MesConstant.URL+MesConstant.PAKIN_URL, JSON.toJSONString(requestMap), response); |
| | | throw new CoolException("上报mes系统失败"); |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.zy.asrs.utils; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.core.common.Cools; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.util.DigestUtils; |
| | | |
| | | import java.nio.charset.StandardCharsets; |
| | |
| | | |
| | | public class MesSyncUtil { |
| | | |
| | | @Value("${mes.appkey}") |
| | | private static String appkey; |
| | | |
| | | public static Map<String,Object> getRequestParamMap(){ |
| | | Date date = new Date(); |
| | | String ts = date.getTime() + ""; |
| | | String key = DigestUtils.md5DigestAsHex(("appkey" + ts).getBytes(StandardCharsets.UTF_8)); |
| | | String key = DigestUtils.md5DigestAsHex(("SX3WMS20230725" + ts).getBytes(StandardCharsets.UTF_8)); |
| | | Map<String,Object> requestParamMap = new HashMap<>(); |
| | | requestParamMap.put("ts",ts); |
| | | requestParamMap.put("key",key); |
| | | return requestParamMap; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | System.out.println(appkey); |
| | | System.out.println(MesSyncUtil.getRequestParamMap()); |
| | | |
| | | String jsonString = "{\"msg\":\"操作成功\",\"code\":200,\"data\":\"[]\"}"; |
| | | JSONObject jsonObject = JSONObject.parseObject(jsonString); |
| | | String data = jsonObject.getString("data"); |
| | | |
| | | System.out.println(data); |
| | | if(!Cools.isEmpty(data)){ |
| | | System.out.println(data); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | } else if (sourceStaNo > 299){ |
| | | whsType = 3; |
| | | } |
| | | |
| | | // 目标堆垛机号 |
| | | int crnNo = whsType; |
| | | if (!basCrnpService.checkSiteError(crnNo, true)){ |
| | |
| | | log.error("系统没有空库位!!! 尺寸规格: {}, 轮询次数:{}", JSON.toJSONString(locTypeDto), times); |
| | | throw new CoolException("没有空库位"); |
| | | } |
| | | |
| | | String locNo = locMast.getLocNo(); |
| | | |
| | | // 生成工作号 |
| | |
| | | } |
| | | |
| | | /** |
| | | * POST请求执行 并且url带参数请求 |
| | | * @return the HttpHandler response |
| | | */ |
| | | public String doPostWithParam() throws IOException { |
| | | Request request; |
| | | Request.Builder headerBuilder = new Request.Builder(); |
| | | if (headers != null && headers.size()>0){ |
| | | for (Map.Entry<String, Object> entry : headers.entrySet()){ |
| | | headerBuilder.addHeader(entry.getKey(), String.valueOf(entry.getValue())); |
| | | } |
| | | } |
| | | if (json == null || "".equals(json)){ |
| | | FormBody.Builder builder = new FormBody.Builder(); |
| | | FormBody body = builder.build(); |
| | | request = headerBuilder |
| | | .url(paramsToUrl(uri, path, params, https)) |
| | | .post(body) |
| | | .build(); |
| | | } else { |
| | | RequestBody body = RequestBody.create(MEDIA_TYPE, json); |
| | | Request.Builder builder = headerBuilder.url((https?"https://":"http://")+uri+path); |
| | | builder.header("Content-Type", "application/json;charset=UTF-8"); |
| | | request = builder.post(body).build(); |
| | | |
| | | } |
| | | Call call = getClient(timeout, timeUnit).newCall(request); |
| | | Response response = call.execute(); |
| | | return response.body().string(); |
| | | } |
| | | |
| | | /** |
| | | * POST请求执行 |
| | | * @return the HttpHandler response |
| | | */ |
| | |
| | | cellMinWidth: 100, |
| | | cols: [[ |
| | | {type: 'numbers'}, |
| | | {field: 'matnr', title: '商品编码', width: 160}, |
| | | {field: 'maktx', title: '商品名称', width: 160}, |
| | | {field: 'batch', title: '批号'}, |
| | | {field: 'matnr', title: '物料编码', width: 160}, |
| | | {field: 'maktx', title: '物料名称', width: 160}, |
| | | {field: 'batch', title: '生产批号'}, |
| | | {field: 'anfme', title: '数量'}, |
| | | {field: 'workQty', title: '作业数量'}, |
| | | {field: 'qty', title: '完成数量', style: 'font-weight: bold'}, |
| | | {field: 'qty', title: '辅数量'}, |
| | | {field: 'qrCode', title: '条形码'}, |
| | | //{field: 'qty', title: '完成数量', style: 'font-weight: bold'}, |
| | | // {field: 'unit', title: '单位'}, |
| | | // { |
| | | // field: 'createTime$', title: '创建时间', sort: true, templet: function (d) { |
| | |
| | | // }, |
| | | // {field: 'inQty', title: '已入库量'}, |
| | | // {field: 'color', title: '颜色'}, |
| | | {field: 'specs', title: '规格'} |
| | | {field: 'specs', title: '规格/型号'} |
| | | ]], |
| | | request: { |
| | | pageName: 'curr', |
| | |
| | | cellMinWidth: 100, |
| | | cols: [[ |
| | | {type: 'numbers', title: '#'}, |
| | | {field: 'matnr', title: '商品编码', width: 160}, |
| | | {field: 'maktx', title: '商品名称', width: 200}, |
| | | {field: 'batch', title: '批号', edit: true}, |
| | | {field: 'specs', title: '规格'}, |
| | | {field: 'anfme', title: '数量(修改)', style: 'color: blue;font-weight: bold', edit: true, minWidth: 110, width: 110}, |
| | | {field: 'workQty', title: '作业数量', minWidth: 100, width: 100}, |
| | | {field: 'matnr', title: '物料编码', width: 160}, |
| | | {field: 'maktx', title: '物料名称', width: 200}, |
| | | {field: 'batch', title: '生产批号', edit: true}, |
| | | {field: 'specs', title: '规格/型号'}, |
| | | {field: 'anfme', title: '数量', style: 'color: blue;font-weight: bold', edit: true, minWidth: 110, width: 110}, |
| | | //{field: 'workQty', title: '作业数量', minWidth: 100, width: 100}, |
| | | // {field: 'unit', title: '单位', width: 80}, |
| | | {field: 'qty', title: '辅数量' , edit: true}, |
| | | {field: 'memo', title: '备注' , edit: true}, |
| | | {align: 'center', title: '操作', toolbar: '#formSSXMTableBar', minWidth: 80, width: 80, fixed: 'right'} |
| | | ]], |
| | |
| | | <form class="layui-form toolbar"> |
| | | <div class="layui-form-item"> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label">商品编码:</label> |
| | | <label class="layui-form-label">物料编码:</label> |
| | | <div class="layui-input-inline"> |
| | | <input name="matnr" class="layui-input" placeholder="商品编码"/> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label">商品名称:</label> |
| | | <label class="layui-form-label">物料名称:</label> |
| | | <div class="layui-input-inline"> |
| | | <input name="maktx" class="layui-input" placeholder="商品名称"/> |
| | | </div> |