| | |
| | | @Autowired |
| | | private SnowflakeIdWorker snowflakeIdWorker; |
| | | |
| | | @Value("mes.url") |
| | | @Value("${mes.url}") |
| | | private String url; |
| | | |
| | | @RequestMapping(value = "/mat/auto/matnr/auth") |
| | |
| | | private void auth(String appkey, Object obj, HttpServletRequest request) { |
| | | log.info("{}接口被访问;appkey:{};请求数据:{}", request.getRequestURI(), appkey, JSON.toJSONString(obj)); |
| | | request.setAttribute("cache", obj); |
| | | // if (!auth) { |
| | | // return; |
| | | // } |
| | | if (!auth) { |
| | | return; |
| | | } |
| | | // if (Cools.isEmpty(appkey)) { |
| | | // throw new CoolException("认证失败,请确认appkey无误!"); |
| | | // } |
| | |
| | | @Resource |
| | | private BasDevpMapper basDevpMapper; |
| | | |
| | | @Value("mes.url") |
| | | @Value("${mes.url}") |
| | | private String url; |
| | | |
| | | @Value("mes.pakin") |
| | | @Value("${mes.code}") |
| | | private String code; |
| | | |
| | | @Override |
| | |
| | | } |
| | | elem.setTemp1(codeDataParam.getQuality()); |
| | | elem.setAnfme(codeDataParam.getQty()); |
| | | elem.setBatch(codeDataParam.getBatchNum()); |
| | | //elem.setBatch(codeDataParam.getBatchNum()); |
| | | elem.setThreeCode(codeDataParam.getBarcode()); |
| | | elem.setMatnr(codeDataParam.getProductionCode()); |
| | | elem.setMaktx(codeDataParam.getProductionName()); |
| | |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | log.info("getData:{}",response); |
| | | MesResponse jsonObject = JSON.parseObject(response, MesResponse.class); |
| | | if (jsonObject.getCode().equals(200)) { |
| | | return JSON.parseArray(jsonObject.getData(), CodeDataParam.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(jsonObject.getData()); |
| | | if (jsonObject1.getString("barcodeList")!=null){ |
| | | return JSON.parseArray(jsonObject1.getString("barcodeList"), CodeDataParam.class); |
| | | } |
| | | } |
| | | throw new CoolException(jsonObject.getMessage()); |
| | | } |
| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.common.SnowflakeIdWorker; |
| | |
| | | import com.zy.asrs.utils.MatUtils; |
| | | import com.zy.common.model.DetlDto; |
| | | import com.zy.common.utils.NodeUtils; |
| | | import com.zy.erp.kingdee.enums.KingDeeUtilType; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | @Autowired |
| | | private WrkDetlLogServiceImpl wrkDetlLogService; |
| | | |
| | | @Autowired |
| | | private ApiLogService apiLogService; |
| | | |
| | | public void callApiLogSaveOrder(Object order, String name, Boolean bool) { |
| | | apiLogService.save(name, "null", null, null, |
| | | JSON.toJSONString(order), |
| | | null, bool); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void pakinOrderCreate(OpenOrderPakinParam param) { |
| | | callApiLogSaveOrder(param, "入库单", true); |
| | | |
| | | Order order = orderService.selectByNo(param.getOrderNo()); |
| | | if (!Cools.isEmpty(order) && order.getSettle() !=1) { |
| | | if (!Cools.isEmpty(order) && order.getSettle() != 1) { |
| | | throw new CoolException(param.getOrderNo() + "单据已有工作任务"); |
| | | } |
| | | if (!Cools.isEmpty(order)) { |
| | |
| | | List<DetlDto> list = new ArrayList<>(); |
| | | List<DetlDto> orderDetails = param.getDetails(); |
| | | for (DetlDto detail : orderDetails) { |
| | | DetlDto dto = new DetlDto(detail.getMatnr(), detail.getBatch(), detail.getAnfme(),detail.getFromOrderNo() |
| | | , detail.getMark(),detail.getCustomer(),detail.getSuppName(),detail.getTemp1(),detail.getTemp2(),detail.getTemp3(),detail.getTemp4()); |
| | | DetlDto dto = new DetlDto(detail.getMatnr(), detail.getBatch(), detail.getAnfme(), detail.getFromOrderNo() |
| | | , detail.getMark(), detail.getCustomer(), detail.getSuppName(), detail.getTemp1(), detail.getTemp2(), detail.getTemp3(), detail.getTemp4()); |
| | | if (DetlDto.has(list, dto)) { |
| | | DetlDto detlDto = DetlDto.find(list, dto.getMatnr(), dto.getBatch()); |
| | | assert detlDto != null; |
| | |
| | | @Override |
| | | @Transactional |
| | | public List<OpenOrderCompeteResult> pakinOrderComplete(OpenOrderCompleteParam param) { |
| | | callApiLogSaveOrder(param, "出库单", true); |
| | | List<OpenOrderCompeteResult> results = new ArrayList<>(); |
| | | if (!Cools.isEmpty(param) && !Cools.isEmpty(param.getOrderNo())) { |
| | | // 指定订单 |
| | |
| | | @Override |
| | | @Transactional |
| | | public void pakoutOrderCreate(OpenOrderPakoutParam param) { |
| | | callApiLogSaveOrder(param, "出库单", true); |
| | | Order order = orderService.selectByNo(param.getOrderNo()); |
| | | // 如果单据不存在则添加;如果单据存在,作业中无法修改,反之则修改单据 |
| | | if (!Cools.isEmpty(order)) { |
| | |
| | | List<DetlDto> list = new ArrayList<>(); |
| | | List<DetlDto> orderDetails = param.getDetails(); |
| | | for (DetlDto detail : orderDetails) { |
| | | DetlDto dto = new DetlDto(detail.getMatnr(), detail.getBatch(), detail.getAnfme(),detail.getFromOrderNo() |
| | | , detail.getMark(),detail.getCustomer(),detail.getSuppName(),detail.getTemp1(),detail.getTemp2(),detail.getTemp3(),detail.getTemp4()); |
| | | DetlDto dto = new DetlDto(detail.getMatnr(), detail.getBatch(), detail.getAnfme(), detail.getFromOrderNo() |
| | | , detail.getMark(), detail.getCustomer(), detail.getSuppName(), detail.getTemp1(), detail.getTemp2(), detail.getTemp3(), detail.getTemp4()); |
| | | dto.setTemp1(param.getQuality()); |
| | | if (DetlDto.has(list, dto)) { |
| | | DetlDto detlDto = DetlDto.find(list, dto.getMatnr(), dto.getBatch()); |
| | |
| | | @Override |
| | | @Transactional |
| | | public void syncMat(MatSyncParam param) { |
| | | if (Cools.isEmpty(param.getMatDetails()) || param.getMatDetails().size() <=0 ) { |
| | | if (Cools.isEmpty(param.getMatDetails()) || param.getMatDetails().size() <= 0) { |
| | | throw new CoolException("商品数据为空"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | for(MatSyncParam.MatParam matParam : param.getMatDetails()){ |
| | | if(Cools.isEmpty(matParam.getMatnr())){ |
| | | for (MatSyncParam.MatParam matParam : param.getMatDetails()) { |
| | | if (Cools.isEmpty(matParam.getMatnr())) { |
| | | throw new CoolException("商品编码不能为空"); |
| | | } |
| | | |
| | |
| | | } else { |
| | | mat.sync(matParam); |
| | | mat.setTagId(tagId); |
| | | if (!matService.update(mat, new EntityWrapper<Mat>().eq("matnr",matParam.getMatnr()))) { |
| | | if (!matService.update(mat, new EntityWrapper<Mat>().eq("matnr", matParam.getMatnr()))) { |
| | | throw new CoolException("更新已存在商品信息失败,请联系管理员"); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | //Tag tag = tagService.selectOne(new EntityWrapper<Tag>().eq("memo", matParam.getTagId())); |
| | |
| | | public List<LocDetlByTimeDTO> selectTimeLocDetl(TimeSelectParam param) { |
| | | ArrayList<LocDetlByTimeDTO> locDetlByTimeDTOS = new ArrayList<>(); |
| | | EntityWrapper<WrkMastLog> wrkMastLogEntityWrapper = new EntityWrapper<>(); |
| | | wrkMastLogEntityWrapper.ge("modi_time",param.getStartTime()); |
| | | wrkMastLogEntityWrapper.le("modi_time",param.getEndTime()); |
| | | wrkMastLogEntityWrapper.ge("modi_time", param.getStartTime()); |
| | | wrkMastLogEntityWrapper.le("modi_time", param.getEndTime()); |
| | | // wrkMastLogEntityWrapper.isNotNull("sheet_no"); |
| | | wrkMastLogService.selectList(wrkMastLogEntityWrapper).forEach(wrkMastLog -> { |
| | | if (wrkMastLog.getWrkSts() == 5 || wrkMastLog.getWrkSts() == 15) { |
| | |
| | | wrkDetlLogs.forEach(wrkDetlLog -> { |
| | | if (wrkDetlLog.getOrderNo() != null && !wrkDetlLog.getOrderNo().isEmpty()) { |
| | | LocDetlByTimeDTO locDetlByTimeDTO = new LocDetlByTimeDTO(); |
| | | if (!Cools.isEmpty(wrkDetlLog.getOrderNo())){ |
| | | if (!Cools.isEmpty(wrkDetlLog.getOrderNo())) { |
| | | Order order = orderService.selectByNo(wrkDetlLog.getOrderNo()); |
| | | if (!Cools.isEmpty(order)) { |
| | | locDetlByTimeDTO.setDate(order.getOrderTime()); |
| | |
| | | locDetlByTimeDTO.setOrderType(order.getDocType$()); |
| | | } |
| | | locDetlByTimeDTO.setMatnr(wrkDetlLog.getMatnr()); |
| | | locDetlByTimeDTO.setLocNo(wrkMastLog.getIoType() <100? wrkMastLog.getLocNo(): wrkMastLog.getSourceLocNo()); |
| | | locDetlByTimeDTO.setLocNo(wrkMastLog.getIoType() < 100 ? wrkMastLog.getLocNo() : wrkMastLog.getSourceLocNo()); |
| | | locDetlByTimeDTO.setBatch(wrkDetlLog.getBatch()); |
| | | locDetlByTimeDTO.setAnfme(wrkDetlLog.getAnfme()); |
| | | locDetlByTimeDTO.setOrderNo(wrkDetlLog.getOrderNo()); |
| | |
| | | @Transactional |
| | | public void syncTag(List<TagParam> param) { |
| | | |
| | | param.forEach(tag-> { |
| | | param.forEach(tag -> { |
| | | // 分类 |
| | | Long tagId; |
| | | Date now = new Date(); |
| | | if (Cools.isEmpty(tag.getParentItemClassId())){ |
| | | if (Cools.isEmpty(tag.getParentItemClassId())) { |
| | | Tag priTag = tagService.selectByName("全部", 1); |
| | | |
| | | // 二级分类 |
| | |
| | | throw new CoolException("服务器内部错误,请联系管理员"); |
| | | } |
| | | } |
| | | }else { |
| | | Tag priTag =tagService.selectOne(new EntityWrapper<Tag>().eq("memo", tag.getParentItemClassId())); |
| | | } else { |
| | | Tag priTag = tagService.selectOne(new EntityWrapper<Tag>().eq("memo", tag.getParentItemClassId())); |
| | | if (priTag == null) { |
| | | Tag top = tagService.getTop(); |
| | | NodeUtils nodeUtils = new NodeUtils(); |
| | |
| | | if (tagMapper.insert(secTag) == 0) { |
| | | throw new CoolException("服务器内部错误,请联系管理员"); |
| | | } |
| | | }else { |
| | | } else { |
| | | secTag.setName(tag.getName()); |
| | | secTag.setParentId(priTag.getId()); |
| | | secTag.setParentName(priTag.getName()); |
| | |
| | | List<Tag> tags = tagService.selectList(new EntityWrapper<Tag>().eq("parent_id", secTag.getId())); |
| | | if (!Cools.isEmpty(tags)) { |
| | | for (Tag tag1 : tags) { |
| | | tag1.setPath(nodeUtils.path.toString()+","+secTag.getId()); |
| | | tag1.setPathName(nodeUtils.pathName.toString()+","+secTag.getName()); |
| | | tag1.setPath(nodeUtils.path.toString() + "," + secTag.getId()); |
| | | tag1.setPathName(nodeUtils.pathName.toString() + "," + secTag.getName()); |
| | | if (tagMapper.updateById(tag1) == 0) { |
| | | throw new CoolException("服务器内部错误,请联系管理员"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Transactional |
| | | @Override |
| | | public void orderDelete(String orderNo) { |
| | |
| | | if (order == null) { |
| | | throw new CoolException("未查询到对应订单信息"); |
| | | } |
| | | if (order.getSettle() != 1){ |
| | | if (order.getSettle() != 1) { |
| | | throw new CoolException("该订单已有对应任务,禁止删除"); |
| | | } |
| | | List<OrderDetl> OrderDetl = orderDetlService.selectList(new EntityWrapper<OrderDetl>().eq("order_no", orderNo)); |
| | |
| | | } |
| | | } |
| | | |
| | | // @Scheduled(cron = "0/5 * * * * ? ") |
| | | @Scheduled(cron = "0/5 * * * * ? ") |
| | | @Async("orderThreadPool") |
| | | public void completeAndReport(){ |
| | | String erpReport = Parameter.get().getErpReport(); |
| | |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.DocType; |
| | | import com.zy.asrs.entity.Order; |
| | | import com.zy.asrs.entity.OrderDetl; |
| | | import com.zy.asrs.entity.OrderDetlReport; |
| | | import com.zy.asrs.service.ApiLogService; |
| | | import com.zy.asrs.service.DocTypeService; |
| | | import com.zy.asrs.service.OrderDetlReportService; |
| | | import com.zy.asrs.service.OrderService; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.task.AbstractHandler; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.asrs.third.TokenUtils; |
| | |
| | | @Autowired |
| | | private OrderService orderService; |
| | | @Autowired |
| | | private OrderDetlService orderDetlService; |
| | | @Autowired |
| | | private OrderDetlReportService orderDetlReportService; |
| | | @Autowired |
| | | private ApiLogService apiLogService; |
| | | @Autowired |
| | | private DocTypeService docTypeService; |
| | | |
| | | @Value("mes.url") |
| | | @Value("${mes.url}") |
| | | private String url; |
| | | |
| | | @Value("mes.pakin") |
| | | @Value("${mes.pakin}") |
| | | private String pakin; |
| | | |
| | | @Transactional |
| | |
| | | if (null == docType) { |
| | | return SUCCESS; |
| | | } |
| | | List<OrderDetlReport> orderDetls = orderDetlReportService.selectList(new EntityWrapper<OrderDetlReport>().eq("orderNo", order.getOrderNo())); |
| | | //List<OrderDetl> orderDetls = orderDetlService.selectByOrderId(order.getId()); |
| | | List<OrderDetlReport> orderDetls = orderDetlReportService.selectList(new EntityWrapper<OrderDetlReport>().eq("order_no", order.getOrderNo())); |
| | | // 入库完成上报 |
| | | if (docType.getPakin() == 1) { |
| | | if (docType.getPakin() == 1 && !Cools.isEmpty(orderDetls)) { |
| | | MesPakinParam pakinParam = new MesPakinParam(); |
| | | pakinParam.setReceiptNumber(order.getOrderNo()); |
| | | pakinParam.setReceiptType(order.getDocType$()); |
| | |
| | | // 保存接口日志 |
| | | apiLogService.save( |
| | | "成品库入库上报", |
| | | url +pakin, |
| | | url + pakin, |
| | | null, |
| | | "127.0.0.1", |
| | | JSON.toJSONString(pakinParam), |
| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | @Slf4j |
| | | public class TokenUtils { |
| | | private static String clientId = "xincai"; |
| | | |
| | | private static String clientSecret = "123456"; |
| | | |
| | | private static String erpId = "1130021"; |
| | | private static String erpId = "1933048022695026688"; |
| | | |
| | | private static String tokenUrl = "/getMsg/v2/createToken"; |
| | | private static String tokenUrl = "/mes-data/getMsg/v2/createToken"; |
| | | |
| | | public static Map<String, Object> getToken(String ip) { |
| | | Map<String, Object> data = new HashMap<>(); |
| | |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | log.info("token:{}",response); |
| | | MesResponse jsonObject = JSON.parseObject(response, MesResponse.class); |
| | | if (jsonObject.getCode().equals(200)) { |
| | | data.put("token", JSON.parseObject(jsonObject.getData()).getString("token")); |
| | | } |
| | | return null; |
| | | return data; |
| | | } |
| | | |
| | | |
| | |
| | | crn4: false |
| | | |
| | | mes: |
| | | url: http://192.168.10.201:8080/mes/ |
| | | pakin: /getMsg/v2/sync/WMSDeliveryNoteJudgeFinish |
| | | code: /getMsg/v2/sync/barcodeStatusQuery |
| | | url: 192.168.12.120:8080 |
| | | pakin: /mes-data/getMsg/v2/sync/WMSDeliveryNoteJudgeFinish |
| | | code: /mes-data/getMsg/v2/sync/barcodeStatusQuery |
| | |
| | | var detlCols = [ |
| | | {field: 'matnr', align: 'center',title: '商品编号', sort:true} |
| | | ,{field: 'maktx', align: 'center',title: '商品名称', sort:true} |
| | | ,{field: 'orderNo', align: 'center',title: '单据编号', hide: true} |
| | | ,{field: 'orderNo', align: 'center',title: '单据编号'} |
| | | ,{field: 'batch', align: 'center',title: '批号', width: 300, sort:true} |
| | | ,{field: 'anfme', align: 'center',title: '数量'} |
| | | ,{field: 'zpallet', align: 'center',title: '托盘条码'} |
| | | ,{field: 'specs', align: 'center',title: '规格'} |
| | | ,{field: 'unit', align: 'center',title: '单位', hide: true} |
| | | ,{field: 'barcode', align: 'center',title: '条码', hide: true} |
| | | ,{field: 'supp', align: 'center',title: '供应商', hide: false} |
| | | ,{field: 'sku', align: 'center',title: '客户名称', hide: false} |
| | | ,{field: 'suppCode', align: 'center',title: '来源单号', hide: false} |
| | | ,{field: 'supp', align: 'center',title: '供应商', hide: true} |
| | | ,{field: 'sku', align: 'center',title: '客户名称', hide: true} |
| | | ,{field: 'suppCode', align: 'center',title: '来源单号', hide: true} |
| | | ] |
| | | |
| | |
| | | {field: 'maktx', title: '商品名称', width: 160}, |
| | | {field: 'specs', title: '规格', width: 160}, |
| | | {field: 'batch', title: '批号'}, |
| | | {field: 'supp', align: 'center',title: '供应商', hide: false} |
| | | ,{field: 'sku', align: 'center',title: '客户名称', hide: false} |
| | | ,{field: 'suppCode', align: 'center',title: '来源单号', hide: false}, |
| | | // {field: 'supp', align: 'center',title: '供应商', hide: false} |
| | | // ,{field: 'sku', align: 'center',title: '客户名称', hide: false} |
| | | // ,{field: 'suppCode', align: 'center',title: '来源单号', hide: false}, |
| | | {field: 'anfme', title: '数量'}, |
| | | {field: 'workQty', title: '作业数量'}, |
| | | {field: 'qty', title: '完成数量', style: 'font-weight: bold'}, |
| | | {align: 'center', title: '打印', toolbar: '#printOperate', width: 80} |
| | | // {align: 'center', title: '打印', toolbar: '#printOperate', width: 80} |
| | | // {field: 'unit', title: '单位'}, |
| | | // { |
| | | // field: 'createTime$', title: '创建时间', sort: true, templet: function (d) { |