| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.annotations.AppAuth; |
| | |
| | | private MatService matService; |
| | | |
| | | /** |
| | | * 订单上报测试接口 |
| | | */ |
| | | @PostMapping("/orderReportTest") |
| | | public synchronized R queryTask(@RequestBody String param) { |
| | | log.info("收到订单上报:{}", param); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 任务查询接口 |
| | | */ |
| | | @PostMapping("/queryTask") |
| | |
| | | @TableField("loc_no") |
| | | private String locNo; |
| | | |
| | | @ApiModelProperty("area_id") |
| | | @TableField |
| | | private Long areaId; |
| | | |
| | | @ApiModelProperty("area_name") |
| | | @TableField |
| | | private String areaName; |
| | | // @ApiModelProperty("area_id") |
| | | // @TableField |
| | | // private Long areaId; |
| | | // |
| | | // @ApiModelProperty("area_name") |
| | | // @TableField |
| | | // private String areaName; |
| | | |
| | | @ApiModelProperty(value = "托盘条码") |
| | | @TableField |
| | |
| | | @TableField |
| | | private Integer inspect; |
| | | |
| | | @ApiModelProperty(value = "危险品 1: 是 0: 否 ") |
| | | @ApiModelProperty(value = "1.齐套,2.混料") |
| | | @TableField |
| | | private Integer danger; |
| | | |
| | |
| | | } |
| | | switch (this.danger) { |
| | | case 1: |
| | | return "是"; |
| | | case 0: |
| | | return "否"; |
| | | return "齐套"; |
| | | case 2: |
| | | return "混料"; |
| | | default: |
| | | return String.valueOf(this.danger); |
| | | } |
| | |
| | | */ |
| | | @ApiModelProperty(value = "备用1") |
| | | @TableField("box_type1") |
| | | private String boxType1 = "1"; |
| | | private String boxType1 = ""; |
| | | |
| | | /** |
| | | * 备用2 |
| | | */ |
| | | @ApiModelProperty(value = "备用2") |
| | | @TableField("box_type2") |
| | | private String boxType2 = "1"; |
| | | private String boxType2 = ""; |
| | | |
| | | /** |
| | | * 备用3 |
| | | */ |
| | | @ApiModelProperty(value = "备用3") |
| | | @TableField("box_type3") |
| | | private String boxType3 = "1"; |
| | | private String boxType3 = ""; |
| | | |
| | | public String getBeBatch$() { |
| | | if (null == this.beBatch) { |
| | |
| | | private String standby2 = ""; |
| | | private String standby3 = ""; |
| | | |
| | | private String boxType1 = "1"; |
| | | private String boxType2 = "1"; |
| | | private String boxType3 = "1"; |
| | | private String boxType1 = ""; |
| | | private String boxType2 = ""; |
| | | private String boxType3 = ""; |
| | | |
| | | // 物料数量 |
| | | private Double anfme; |
| | |
| | | List<LocDetl> getStockList(Map<String, Object> condition1); |
| | | |
| | | long getStockListCount(Map<String, Object> condition1); |
| | | |
| | | void updateDangerByLocNo(String locNo); |
| | | } |
| | |
| | | , @Param("boxType1") String boxType1, |
| | | @Param("boxType2") String boxType2, |
| | | @Param("boxType3") String boxType3, @Param("workQty") Double workQty); |
| | | |
| | | int selectReportComplete(Long orderId); |
| | | } |
| | |
| | | @Param("boxType2") String boxType2, |
| | | @Param("boxType3") String boxType3, @Param("workQty") Double workQty); |
| | | |
| | | int selectReportComplete(Long id); |
| | | } |
| | |
| | | // } |
| | | WaitPakin waitPakin = new WaitPakin(); |
| | | BeanUtils.copyProperties(mat, waitPakin); |
| | | waitPakin.setStandby1(detlDto.getStandby1()); |
| | | waitPakin.setBatch(detlDto.getBatch()); |
| | | waitPakin.setZpallet(param.getBarcode()); |
| | | waitPakin.setIoStatus("N"); |
| | |
| | | BeanUtils.copyProperties(mat, waitPakin); |
| | | // waitPakin.sync(mat); |
| | | waitPakin.setOrderNo(detlDto.getOrderNo()); // 单据编号 |
| | | waitPakin.setStandby1(detlDto.getStandby1()); |
| | | waitPakin.setOrderId(detlDto.getOrderId()); |
| | | waitPakin.setBatch(detlDto.getBatch()); // 序列码 |
| | | waitPakin.setZpallet(param.getBarcode()); // 托盘码 |
| | |
| | | } |
| | | if (complete) { |
| | | // 出库订单重新整理明细 |
| | | DocType docType = docTypeService.selectById(order.getDocType()); |
| | | if (null != docType && docType.getPakout() == 1) { |
| | | if (!orderDetlService.delete(new EntityWrapper<OrderDetlPakin>().eq("order_id", order.getId()))) { |
| | | throw new CoolException("重整出库订单【orderNo = " + order.getOrderNo() + "】明细失败"); |
| | | } |
| | | List<WrkDetl> wrkDetls = wrkDetlService.selectAndLogByOrderNo(orderNo); |
| | | for (WrkDetl wrkDetl : wrkDetls) { |
| | | OrderDetlPakin orderDetl = new OrderDetlPakin(); |
| | | orderDetl.sync(wrkDetl); |
| | | orderDetl.setQty(orderDetl.getAnfme()); |
| | | orderDetl.setOrderId(order.getId()); |
| | | orderDetl.setOrderNo(orderNo); |
| | | orderDetl.setStatus(1); |
| | | orderDetl.setCreateTime(order.getCreateTime()); |
| | | orderDetl.setCreateBy(order.getCreateBy()); |
| | | orderDetl.setUpdateTime(order.getUpdateTime()); |
| | | orderDetl.setUpdateBy(order.getUpdateBy()); |
| | | if (!orderDetlService.insert(orderDetl)) { |
| | | throw new CoolException("重整出库订单【orderNo = " + order.getOrderNo() + "】明细失败"); |
| | | } |
| | | } |
| | | } |
| | | // DocType docType = docTypeService.selectById(order.getDocType()); |
| | | // if (null != docType && docType.getPakout() == 1) { |
| | | // if (!orderDetlService.delete(new EntityWrapper<OrderDetlPakin>().eq("order_id", order.getId()))) { |
| | | // throw new CoolException("重整出库订单【orderNo = " + order.getOrderNo() + "】明细失败"); |
| | | // } |
| | | // List<WrkDetl> wrkDetls = wrkDetlService.selectAndLogByOrderNo(orderNo); |
| | | // for (WrkDetl wrkDetl : wrkDetls) { |
| | | // OrderDetlPakin orderDetl = new OrderDetlPakin(); |
| | | // orderDetl.sync(wrkDetl); |
| | | // orderDetl.setQty(orderDetl.getAnfme()); |
| | | // orderDetl.setOrderId(order.getId()); |
| | | // orderDetl.setOrderNo(orderNo); |
| | | // orderDetl.setStatus(1); |
| | | // orderDetl.setCreateTime(order.getCreateTime()); |
| | | // orderDetl.setCreateBy(order.getCreateBy()); |
| | | // orderDetl.setUpdateTime(order.getUpdateTime()); |
| | | // orderDetl.setUpdateBy(order.getUpdateBy()); |
| | | // if (!orderDetlService.insert(orderDetl)) { |
| | | // throw new CoolException("重整出库订单【orderNo = " + order.getOrderNo() + "】明细失败"); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | if (!this.updateSettle(order.getId(), 4L, null)) { |
| | | throw new CoolException("修改订单【orderNo = " + order.getOrderNo() + "】状态为已完成失败"); |
| | |
| | | } |
| | | if (complete) { |
| | | // 出库订单重新整理明细 |
| | | DocType docType = docTypeService.selectById(order.getDocType()); |
| | | if (null != docType && docType.getPakout() == 1) { |
| | | if (!orderDetlService.delete(new EntityWrapper<OrderDetlPakout>().eq("order_id", order.getId()))) { |
| | | throw new CoolException("重整出库订单【orderNo = " + order.getOrderNo() + "】明细失败"); |
| | | } |
| | | List<WrkDetl> wrkDetls = wrkDetlService.selectAndLogByOrderNo(orderNo); |
| | | for (WrkDetl wrkDetl : wrkDetls) { |
| | | OrderDetlPakout orderDetl = new OrderDetlPakout(); |
| | | orderDetl.sync(wrkDetl); |
| | | orderDetl.setQty(orderDetl.getAnfme()); |
| | | orderDetl.setOrderId(order.getId()); |
| | | orderDetl.setOrderNo(orderNo); |
| | | orderDetl.setStatus(1); |
| | | orderDetl.setCreateTime(order.getCreateTime()); |
| | | orderDetl.setCreateBy(order.getCreateBy()); |
| | | orderDetl.setUpdateTime(order.getUpdateTime()); |
| | | orderDetl.setUpdateBy(order.getUpdateBy()); |
| | | if (!orderDetlService.insert(orderDetl)) { |
| | | throw new CoolException("重整出库订单【orderNo = " + order.getOrderNo() + "】明细失败"); |
| | | } |
| | | } |
| | | } |
| | | // DocType docType = docTypeService.selectById(order.getDocType()); |
| | | // if (null != docType && docType.getPakout() == 1) { |
| | | // if (!orderDetlService.delete(new EntityWrapper<OrderDetlPakout>().eq("order_id", order.getId()))) { |
| | | // throw new CoolException("重整出库订单【orderNo = " + order.getOrderNo() + "】明细失败"); |
| | | // } |
| | | // List<WrkDetl> wrkDetls = wrkDetlService.selectAndLogByOrderNo(orderNo); |
| | | // for (WrkDetl wrkDetl : wrkDetls) { |
| | | // OrderDetlPakout orderDetl = new OrderDetlPakout(); |
| | | // orderDetl.sync(wrkDetl); |
| | | // orderDetl.setQty(orderDetl.getAnfme()); |
| | | // orderDetl.setOrderId(order.getId()); |
| | | // orderDetl.setOrderNo(orderNo); |
| | | // orderDetl.setStatus(1); |
| | | // orderDetl.setCreateTime(order.getCreateTime()); |
| | | // orderDetl.setCreateBy(order.getCreateBy()); |
| | | // orderDetl.setUpdateTime(order.getUpdateTime()); |
| | | // orderDetl.setUpdateBy(order.getUpdateBy()); |
| | | // if (!orderDetlService.insert(orderDetl)) { |
| | | // throw new CoolException("重整出库订单【orderNo = " + order.getOrderNo() + "】明细失败"); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | if (!this.updateSettle(order.getId(), 4L, null)) { |
| | | throw new CoolException("修改订单【orderNo = " + order.getOrderNo() + "】状态为已完成失败"); |
| | |
| | | throw new CoolException("保存工作主档历史档失败"); |
| | | } |
| | | // 获取目标站 |
| | | // Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>() |
| | | // .eq("type_no", wrkMast.getIoType() - 50) |
| | | // .eq("stn_no", wrkMast.getStaNo()) // 作业站点 = 拣料出库的目标站 |
| | | // .eq("crn_no", wrkMast.getCrnNo()); // 堆垛机号 |
| | | // StaDesc staDesc = staDescService.selectOne(wrapper); |
| | | // if (Cools.isEmpty(staDesc)) { |
| | | // throw new CoolException("入库路径不存在"); |
| | | // } |
| | | int stn_no = 0; |
| | | switch (wrkMast.getStaNo().substring(0, 2)) { |
| | | case "11": |
| | | stn_no = 1109; |
| | | break; |
| | | case "12": |
| | | stn_no = 1209; |
| | | break; |
| | | case "13": |
| | | stn_no = 1309; |
| | | break; |
| | | case "14": |
| | | stn_no = 1402; |
| | | break; |
| | | default: |
| | | } |
| | | Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>() |
| | | .eq("type_no", wrkMast.getIoType() - 50) |
| | | .eq("stn_no", stn_no) // 作业站点 = 拣料出库的目标站 |
| | | .eq("crn_no", wrkMast.getCrnNo()); // 堆垛机号 |
| | | StaDesc staDesc = staDescService.selectOne(wrapper); |
| | | if (Cools.isEmpty(staDesc)) { |
| | | throw new CoolException("入库路径不存在"); |
| | | } |
| | | Date now = new Date(); |
| | | // 堆垛机站点(目标站) |
| | | // Integer staNo = staDesc.getCrnStn(); |
| | |
| | | wrkMast.setIoType(wrkMast.getIoType() - 50); // 入出库类型: 103->53,104->54,107->57 |
| | | wrkMast.setWrkSts(2L); // 工作状态: 2.设备上走 |
| | | wrkMast.setSourceStaNo(wrkMast.getStaNo()); // 源站 |
| | | wrkMast.setStaNo("0"); // 目标站 |
| | | wrkMast.setStaNo(staDesc.getCrnStn$()); // 目标站 |
| | | wrkMast.setLocNo(wrkMast.getSourceLocNo()); // 目标库位 = 出库时的源库位 |
| | | wrkMast.setSourceLocNo(""); // 源库位清空 |
| | | wrkMast.setModiTime(now); |
| | |
| | | package com.zy.asrs.task; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.zy.asrs.entity.OrderDetlPakin; |
| | | import com.zy.asrs.entity.OrderDetlPakout; |
| | | import com.zy.asrs.entity.OrderPakin; |
| | | import com.zy.asrs.entity.OrderPakout; |
| | | import com.zy.asrs.service.ApiLogService; |
| | | import com.zy.asrs.service.OrderPakinService; |
| | | import com.zy.asrs.service.OrderPakoutService; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.service.impl.OrderDetlPakinServiceImpl; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.asrs.task.handler.OrderPakinSyncHandler; |
| | | import com.zy.asrs.task.handler.OrderPakoutSyncHandler; |
| | |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @Autowired |
| | | private LoadingConfigTimer loadingConfigTimer; |
| | | |
| | | @Resource |
| | | private OrderDetlPakoutService orderDetlPakoutService; |
| | | |
| | | @Resource |
| | | private OrderDetlPakinService orderDetlPakinService; |
| | | |
| | | |
| | | @Scheduled(cron = "0 0 1 * * ? ") |
| | | public void clearApiLog() { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 定时上报已入库的订单数量 |
| | | */ |
| | | // @Scheduled(cron = "0 0/5 * * * ?") |
| | | @Scheduled(cron = "0 0/1 * * * ?") |
| | | @Async("orderThreadPool") |
| | | public void reportInStockOrders() { |
| | | if (loadingConfigTimer.getErpReport()) { |
| | | List<OrderDetlPakin> orderDetlPakinList = orderDetlPakinService.selectList(new EntityWrapper<OrderDetlPakin>().where("qty > units")); |
| | | if (!orderDetlPakinList.isEmpty()) { |
| | | orderPakinSyncHandler.reportInStockOrders(orderDetlPakinList); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Scheduled(cron = "0/15 * * * * ? ") |
| | | /** |
| | | * 定时上报已出库的订单数量,定时任务5分钟上报一次,出入库错开上报 |
| | | */ |
| | | // @Scheduled(cron = "0 3/5 * * * ?") |
| | | @Scheduled(cron = "0/10 * * * * ?") |
| | | @Async("orderThreadPool") |
| | | public void reportOutStockOrders() { |
| | | if (loadingConfigTimer.getErpReport()) { |
| | | List<OrderDetlPakout> orderDetlPakoutList = orderDetlPakoutService.selectList(new EntityWrapper<OrderDetlPakout>().where("qty > units")); |
| | | if (!orderDetlPakoutList.isEmpty()) { |
| | | orderPakoutSyncHandler.reportOutStockOrders(orderDetlPakoutList); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 订单已完成,上报已完成,订单状态变已上报 |
| | | */ |
| | | @Scheduled(cron = "0 * * * * ?") |
| | | @Async("orderThreadPool") |
| | | public void completeOrderReport() { |
| | | // 入库订单已完成转已上报 |
| | | orderPakinSyncHandler.completeOrderReport(); |
| | | // 出库订单已完成转已上报 |
| | | orderPakoutSyncHandler.completeOrderReport(); |
| | | } |
| | | |
| | | // @Scheduled(cron = "0/15 * * * * ? ") |
| | | @Async("orderThreadPool") |
| | | public void completeOrderPakin() { |
| | | if (loadingConfigTimer.getErpReport()) { |
| | |
| | | } |
| | | |
| | | |
| | | @Scheduled(cron = "0/15 * * * * ? ") |
| | | // @Scheduled(cron = "0/15 * * * * ? ") |
| | | @Async("orderThreadPool") |
| | | public void completeOrderPakout() { |
| | | if (loadingConfigTimer.getErpReport()) { |
| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.zy.asrs.entity.DocType; |
| | | import com.zy.asrs.entity.OrderDetlPakin; |
| | | import com.zy.asrs.entity.OrderPakin; |
| | | import com.zy.asrs.mapper.OrderDetlPakinMapper; |
| | | import com.zy.asrs.mapper.OrderPakinMapper; |
| | | import com.zy.asrs.service.ApiLogService; |
| | | import com.zy.asrs.service.DocTypeService; |
| | | import com.zy.asrs.service.OrderDetlPakinService; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * Created by vincent on 2020/7/7 |
| | |
| | | } |
| | | } |
| | | |
| | | @Transactional |
| | | public void reportInStockOrders(List<OrderDetlPakin> orderDetlPakinList) { |
| | | // 按订单分组 |
| | | Map<String, List<OrderDetlPakin>> listMap = orderDetlPakinList.stream().collect(Collectors.groupingBy(OrderDetlPakin::getOrderNo)); |
| | | |
| | | // 构造请求体 |
| | | JSONArray param = new JSONArray(); |
| | | for (Map.Entry<String, List<OrderDetlPakin>> entry : listMap.entrySet()) { |
| | | JSONObject object = new JSONObject(); |
| | | object.put("orderNo", entry.getKey()); |
| | | List<OrderDetlPakin> orderDetlPakins = entry.getValue(); |
| | | JSONArray detl = new JSONArray(); |
| | | for (OrderDetlPakin orderDetlPakin : orderDetlPakins) { |
| | | JSONObject detlObject = new JSONObject(); |
| | | detlObject.put("sku", orderDetlPakin.getSku()); |
| | | detlObject.put("standby1", orderDetlPakin.getStandby1()); |
| | | detlObject.put("matnr", orderDetlPakin.getMatnr()); |
| | | detlObject.put("batch", orderDetlPakin.getBatch()); |
| | | detlObject.put("anfme", orderDetlPakin.getQty() - orderDetlPakin.getUnits()); |
| | | detl.add(detlObject); |
| | | } |
| | | object.put("matList", detl); |
| | | param.add(object); |
| | | } |
| | | |
| | | String response = ""; |
| | | boolean success = false; |
| | | String errorMsg = null; |
| | | String requestJson = param.toJSONString(); |
| | | String url = loadingConfigTimer.getErpReportURL() + loadingConfigTimer.getErpInReportPath(); |
| | | String nameSpaces = "入库单上报"; |
| | | try { |
| | | |
| | | response = new HttpHandler.Builder() |
| | | .setUri(loadingConfigTimer.getErpReportURL()) |
| | | .setPath(loadingConfigTimer.getErpInReportPath()) |
| | | .setJson(requestJson) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getString("code") != null && jsonObject.getString("code").equals("200")) { |
| | | // 批量更新units 上报数量 |
| | | List<OrderDetlPakin> collect = orderDetlPakinList.stream().peek(orderDetlPakin -> orderDetlPakin.setUnits(orderDetlPakin.getQty())).collect(Collectors.toList()); |
| | | orderDetlPakinService.updateBatchById(collect); |
| | | success = true; |
| | | } else { |
| | | errorMsg = response; |
| | | log.error(nameSpaces + "调用外部接口失败,url:{},request:{},response:{}", url, requestJson, response); |
| | | } |
| | | } catch (Exception e) { |
| | | errorMsg = e.getMessage(); |
| | | log.error(nameSpaces + "调用外部接口异常,url:{},request:{},response:{}", url, requestJson, response, e); |
| | | } finally { |
| | | try { |
| | | apiLogService.save( |
| | | nameSpaces, |
| | | url, |
| | | null, |
| | | "127.0.0.1", |
| | | requestJson, |
| | | response, |
| | | success, |
| | | errorMsg |
| | | ); |
| | | } catch (Exception e) { |
| | | log.error(nameSpaces + "保存接口日志失败", e); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Resource |
| | | private OrderDetlPakinMapper orderDetlPakinMapper; |
| | | |
| | | public void completeOrderReport() { |
| | | List<OrderPakin> orderPakins = orderPakinService.selectList(new EntityWrapper<OrderPakin>().where("settle = 4")); |
| | | |
| | | // 使用 removeIf 简化代码 |
| | | orderPakins.removeIf(orderPakin -> orderDetlPakinMapper.selectReportComplete(orderPakin.getId()) == 0); |
| | | |
| | | // 对剩余数据进行settle设置 |
| | | orderPakins.forEach(orderPakin -> orderPakin.setSettle(6L)); |
| | | |
| | | // 批量更新 |
| | | if (!orderPakins.isEmpty()) { |
| | | orderPakinService.updateBatchById(orderPakins); |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.zy.asrs.entity.DocType; |
| | | import com.zy.asrs.entity.OrderDetlPakin; |
| | | import com.zy.asrs.entity.OrderDetlPakout; |
| | | import com.zy.asrs.entity.OrderPakout; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.mapper.OrderDetlPakoutMapper; |
| | | import com.zy.asrs.service.ApiLogService; |
| | | import com.zy.asrs.service.DocTypeService; |
| | | import com.zy.asrs.service.OrderDetlPakoutService; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * Created by vincent on 2020/7/7 |
| | |
| | | } |
| | | } |
| | | |
| | | @Resource |
| | | private OrderDetlPakoutMapper orderDetlPakoutMapper; |
| | | |
| | | public void completeOrderReport() { |
| | | List<OrderPakout> orderPakouts = orderPakoutService.selectList(new EntityWrapper<OrderPakout>().where("settle = 4")); |
| | | |
| | | // 使用 removeIf 简化代码 |
| | | orderPakouts.removeIf(orderPakout -> orderDetlPakoutMapper.selectReportComplete(orderPakout.getId()) == 0); |
| | | |
| | | // 对剩余数据进行settle设置 |
| | | orderPakouts.forEach(orderPakin -> orderPakin.setSettle(6L)); |
| | | |
| | | // 批量更新 |
| | | if (!orderPakouts.isEmpty()) { |
| | | orderPakoutService.updateBatchById(orderPakouts); |
| | | } |
| | | } |
| | | |
| | | public void reportOutStockOrders(List<OrderDetlPakout> orderDetlPakoutList) { |
| | | // 按订单分组 |
| | | Map<String, List<OrderDetlPakout>> listMap = orderDetlPakoutList.stream().collect(Collectors.groupingBy(OrderDetlPakout::getOrderNo)); |
| | | |
| | | // 构造请求体 |
| | | JSONArray param = new JSONArray(); |
| | | for (Map.Entry<String, List<OrderDetlPakout>> entry : listMap.entrySet()) { |
| | | JSONObject object = new JSONObject(); |
| | | object.put("orderNo", entry.getKey()); |
| | | List<OrderDetlPakout> orderDetlPakouts = entry.getValue(); |
| | | JSONArray detl = new JSONArray(); |
| | | for (OrderDetlPakout orderDetlPakout : orderDetlPakouts) { |
| | | JSONObject detlObject = new JSONObject(); |
| | | detlObject.put("sku", orderDetlPakout.getSku()); |
| | | detlObject.put("standby1", orderDetlPakout.getStandby1()); |
| | | detlObject.put("matnr", orderDetlPakout.getMatnr()); |
| | | detlObject.put("batch", orderDetlPakout.getBatch()); |
| | | detlObject.put("anfme", orderDetlPakout.getQty() - orderDetlPakout.getUnits() ); |
| | | detl.add(detlObject); |
| | | } |
| | | object.put("matList", detl); |
| | | param.add(object); |
| | | } |
| | | |
| | | String response = ""; |
| | | boolean success = false; |
| | | String errorMsg = null; |
| | | String requestJson = param.toJSONString(); |
| | | String url = loadingConfigTimer.getErpReportURL() + loadingConfigTimer.getErpOutReportPath(); |
| | | String nameSpaces = "出库单上报"; |
| | | try { |
| | | |
| | | response = new HttpHandler.Builder() |
| | | .setUri(loadingConfigTimer.getErpReportURL()) |
| | | .setPath(loadingConfigTimer.getErpOutReportPath()) |
| | | .setJson(requestJson) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getString("code") != null && jsonObject.getString("code").equals("200")) { |
| | | // 批量更新units 上报数量 |
| | | List<OrderDetlPakout> collect = orderDetlPakoutList.stream().peek(orderDetlPakout -> orderDetlPakout.setUnits(orderDetlPakout.getQty())).collect(Collectors.toList()); |
| | | orderDetlPakoutService.updateBatchById(collect); |
| | | success = true; |
| | | } else { |
| | | errorMsg = response; |
| | | log.error(nameSpaces + "调用外部接口失败,url:{},request:{},response:{}", url, requestJson, response); |
| | | } |
| | | } catch (Exception e) { |
| | | errorMsg = e.getMessage(); |
| | | log.error(nameSpaces + "调用外部接口异常,url:{},request:{},response:{}", url, requestJson, response, e); |
| | | } finally { |
| | | try { |
| | | apiLogService.save( |
| | | nameSpaces, |
| | | url, |
| | | null, |
| | | "127.0.0.1", |
| | | requestJson, |
| | | response, |
| | | success, |
| | | errorMsg |
| | | ); |
| | | } catch (Exception e) { |
| | | log.error(nameSpaces + "保存接口日志失败", e); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.enums.LocStsType; |
| | | import com.zy.asrs.mapper.LocDetlMapper; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.service.impl.BasStationServiceImpl; |
| | | import com.zy.asrs.task.AbstractHandler; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | |
| | | private TaskDetlService taskDetlService; |
| | | @Autowired |
| | | private BasStationServiceImpl basStationService; |
| | | |
| | | @Resource |
| | | private LocDetlMapper locDetlMapper; |
| | | |
| | | public ReturnT<String> start(WrkMast wrkMast) { |
| | | // 4.入库完成 |
| | |
| | | default: |
| | | break; |
| | | } |
| | | // 更新托盘物料是否齐套(托盘物料都是一个订单的) |
| | | locDetlMapper.updateDangerByLocNo(locMast.getLocNo()); |
| | | |
| | | // 修改工作主档状态 |
| | | wrkMast.setWrkSts(5L); |
| | | wrkMast.setModiTime(now); |
| | |
| | | default: |
| | | break; |
| | | } |
| | | // 更新托盘物料是否齐套(托盘物料都是一个订单的) |
| | | locDetlMapper.updateDangerByLocNo(locMast.getLocNo()); |
| | | // 修改工作主档状态 |
| | | wrkMast.setWrkSts(15L); |
| | | wrkMast.setModiTime(now); |
| | |
| | | .setSpecs(pakin.getSpecs()) |
| | | .setColor(pakin.getColor()) |
| | | .setLocNo(locCache.getLocNo()) |
| | | .setAreaId(locCache.getAreaId()) |
| | | .setAreaName(locCache.getAreaName()) |
| | | // .setAreaId(locCache.getAreaId()) |
| | | // .setAreaName(locCache.getAreaName()) |
| | | .setUnit(pakin.getUnit()) |
| | | .setBatch(pakin.getBatch()); |
| | | if (!locDetlService.insert(detl)) { |
| | |
| | | <if test="specs!=null and specs!='' "> |
| | | and a.specs like '%' + #{specs} + '%' |
| | | </if> |
| | | <if test="standby1!=null and standby1!='' "> |
| | | and a.standby1 like '%' + #{standby1} + '%' |
| | | </if> |
| | | </sql> |
| | | |
| | | <select id="getStockOutPage" resultMap="BaseResultMap"> |
| | |
| | | <update id="frozenInventory"> |
| | | update asr_loc_detl set frozen = #{frozen} where loc_no = #{locNo} and matnr = #{matnr} and batch = #{batch} |
| | | </update> |
| | | <update id="updateDangerByLocNo"> |
| | | UPDATE d |
| | | SET danger = CASE |
| | | WHEN t.cnt = 1 THEN 1 |
| | | ELSE 2 |
| | | END |
| | | FROM asr_loc_detl d |
| | | JOIN ( |
| | | SELECT loc_no, COUNT(DISTINCT standby1) AS cnt |
| | | FROM asr_loc_detl |
| | | WHERE loc_no = #{locNo} |
| | | GROUP BY loc_no |
| | | ) t ON d.loc_no = t.loc_no |
| | | </update> |
| | | |
| | | <select id="selectSameDetlTodayBatch" resultType="java.lang.String"> |
| | | SELECT ld.loc_no FROM asr_loc_detl ld |
| | |
| | | and mdt.pakout = 1 |
| | | <include refid="pakOutPageCondition"></include> |
| | | </select> |
| | | <select id="selectReportComplete" resultType="java.lang.Integer"> |
| | | SELECT |
| | | CASE |
| | | WHEN COUNT(*) = SUM(CASE WHEN anfme = units THEN 1 ELSE 0 END) THEN 1 |
| | | ELSE 0 |
| | | END |
| | | FROM man_order_detl_pakin |
| | | WHERE order_id = #{orderId} |
| | | </select> |
| | | |
| | | <update id="increase"> |
| | | update man_order_detl_pakin |
| | |
| | | and mdt.pakout = 1 |
| | | <include refid="pakOutPageCondition"></include> |
| | | </select> |
| | | <select id="selectReportComplete" resultType="java.lang.Integer"> |
| | | SELECT |
| | | CASE |
| | | WHEN COUNT(*) = SUM(CASE WHEN anfme = units THEN 1 ELSE 0 END) THEN 1 |
| | | ELSE 0 |
| | | END |
| | | FROM man_order_detl_pakout |
| | | WHERE order_id = #{orderId} |
| | | </select> |
| | | |
| | | <update id="increase"> |
| | | update man_order_detl_pakout |
| | |
| | | |
| | | <update id="increaseQtyByOrderNo"> |
| | | update man_order_detl_pakout |
| | | set qty = qty + #{qty} |
| | | set qty = qty + #{qty},work_qty = work_qty - #{qty} |
| | | where 1=1 |
| | | and order_no = #{orderNo} |
| | | and matnr = #{matnr} |
| | |
| | | var detlCols = [ |
| | | {field: 'matnr', align: 'center',title: '商品编号(品号)', sort:true} |
| | | ,{field: 'maktx', align: 'center',title: '商品名称(品名)', sort:true} |
| | | ,{field: 'orderNo', align: 'center',title: '单据编号', hide: false} |
| | | ,{field: 'orderNo', align: 'center',title: '单据编号', hide: true} |
| | | ,{field: 'standby1', align: 'center',title: '工单号'} |
| | | ,{field: 'batch', align: 'center',title: '货品特征', sort:true} |
| | | ,{field: 'anfme', align: 'center',title: '数量', hide: false} |
| | | ,{field: 'zpallet', align: 'center',title: '托盘条码', hide: false} |
| | |
| | | {type: 'checkbox'}, |
| | | {field: 'locNo', align: 'center',title: '库位号'} |
| | | ,{field: 'storeDate', align: 'center',title: '库龄(天)', sort:true} |
| | | ,{field: 'standby1', align: 'center',title: '工单号'} |
| | | ,{field: 'matnr', align: 'center',title: '商品编号', sort:true} |
| | | ,{field: 'maktx', align: 'center',title: '商品名称', sort:true} |
| | | ,{field: 'orderNo', align: 'center',title: '单据编号', hide: true} |
| | | ,{field: 'batch', align: 'center',title: '批号', width: 300, sort:true} |
| | | ,{field: 'batch', align: 'center',title: '批号'} |
| | | ,{field: 'anfme', align: 'center',title: '数量'} |
| | | ,{field: 'zpallet', align: 'center',title: '托盘条码'} |
| | | ,{field: 'specs', align: 'center',title: '规格'} |
| | | ,{field: 'model', align: 'center',title: '代码', hide: true} |
| | | ,{field: 'specs', align: 'center',title: '规格',hide: true} |
| | | ,{field: 'model', align: 'center',title: '形态属性', hide: true} |
| | | ,{field: 'color', align: 'center',title: '颜色', hide: true} |
| | | ,{field: 'brand', align: 'center',title: '品牌', hide: true} |
| | | ,{field: 'unit', align: 'center',title: '单位', hide: true} |
| | | ,{field: 'unit', align: 'center',title: '单位',hide: true} |
| | | ,{field: 'price', align: 'center',title: '单价', hide: true} |
| | | ,{field: 'sku', align: 'center',title: 'sku', hide: true} |
| | | ,{field: 'units', align: 'center',title: '单位量', hide: true} |
| | |
| | | ,{field: 'deadWarn', align: 'center',title: '预警天数', hide: true} |
| | | ,{field: 'source$', align: 'center',title: '制购', hide: true} |
| | | ,{field: 'check$', align: 'center',title: '要求检验', hide: true} |
| | | ,{field: 'danger$', align: 'center',title: '危险品', hide: true} |
| | | ,{field: 'danger$', align: 'center',title: '齐套否'} |
| | | ,{field: 'frozen$', align: 'center',title: '冻结否', |
| | | templet: function(d) { |
| | | // 根据条件判断字体颜色 |
| | |
| | | } else { |
| | | return '<span">' +d.frozen$ + '</span>'; |
| | | } |
| | | }} |
| | | },hide: true} |
| | | ]; |
| | | |
| | | // cols.push.apply(cols, detlCols); |
| | |
| | | {field: 'matnr', title: '商品编码', width: 160}, |
| | | {field: 'maktx', title: '商品名称', width: 200}, |
| | | {field: 'batch', title: '批号', edit: true}, |
| | | {field: 'specs', title: '规格'}, |
| | | {field: 'standby1', 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: 'matnr', title: '商品编码', width: 160}, |
| | | {field: 'maktx', title: '商品名称', width: 200}, |
| | | {field: 'batch', title: '批号', edit: true}, |
| | | {field: 'specs', title: '规格'}, |
| | | {field: 'standby1', 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}, |
| | |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input" type="text" name="specs" placeholder="规格" autocomplete="off"> |
| | | <input class="layui-input" type="text" name="standby1" placeholder="工单号" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input" type="text" name="batch" placeholder="批号" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <select name="danger" class="layui-input" type="text" autocomplete="off"> |
| | | <!-- <option style="display: none"></option>--> |
| | | <option value="">是否齐套</option> |
| | | <option value="1">齐套</option> |
| | | <option value="2">混料</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input" type="text" name="matnr" placeholder="商品编号" autocomplete="off"> |
| | | <input class="layui-input" type="text" name="standby1" placeholder="工单号" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input" type="text" name="specs" placeholder="规格" autocomplete="off"> |
| | | <input class="layui-input" type="text" name="matnr" placeholder="商品编号" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | <!-- <div class="layui-inline">--> |
| | | <!-- <div class="layui-input-inline">--> |
| | | <!-- <input class="layui-input" type="text" name="specs" placeholder="规格" autocomplete="off">--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input" type="text" name="maktx" placeholder="物料描述" autocomplete="off"> |