| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | 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.service.ApiLogService; |
| | | import com.zy.asrs.service.DocTypeService; |
| | | import com.zy.asrs.service.OrderDetlService; |
| | | import com.zy.asrs.service.OrderService; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.CombParam; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.service.impl.MatServiceImpl; |
| | | import com.zy.asrs.task.AbstractHandler; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.asrs.utils.OrderInAndOutUtil; |
| | |
| | | import com.zy.common.model.MesPakoutParam; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.jdbc.core.JdbcTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * Created by vincent on 2020/7/7 |
| | |
| | | private ApiLogService apiLogService; |
| | | @Autowired |
| | | private DocTypeService docTypeService; |
| | | @Autowired |
| | | private MobileService mobileService; |
| | | @Autowired |
| | | private WaitPakinService waitPakinService; |
| | | @Autowired |
| | | private OrderPakinService orderPakinService; |
| | | @Autowired |
| | | private OrderDetlPakinService orderDetlPakinService; |
| | | @Autowired |
| | | private MatService matService; |
| | | |
| | | |
| | | @Transactional |
| | | public ReturnT<String> startOrderIssuedOnceMore(Order order) { |
| | |
| | | return SUCCESS; |
| | | } |
| | | |
| | | /** |
| | | * 上报单据转执行单据 |
| | | * @author Ryan |
| | | * @date 2026/1/5 14:07 |
| | | */ |
| | | @Transactional |
| | | public ReturnT<String> startOrderIssued(Order order) { |
| | | DocType docType = docTypeService.selectById(order.getDocType()); |
| | |
| | | return SUCCESS; |
| | | } |
| | | List<OrderDetl> orderDetls = orderDetlService.selectByOrderId(order.getId()); |
| | | //设置为单据执行中 |
| | | order.setSettle(2L); |
| | | |
| | | OrderInAndOutUtil.insertOrder(order.getPakinPakoutStatus$(),order); |
| | | // 单据明细档 |
| | |
| | | } |
| | | } |
| | | for (OrderDetl orderDetl : orderDetlList){ |
| | | orderDetl.setWorkQty(0D); |
| | | OrderInAndOutUtil.insertOrderDetl(order.getPakinPakoutStatus$(),order,orderDetl); |
| | | } |
| | | OrderPakin pakinOrder = orderPakinService.selectOne(new EntityWrapper<OrderPakin>().eq("order_no", order.getOrderNo())); |
| | | if (Objects.isNull(pakinOrder)){ |
| | | return FAIL.setMsg("入库单据不存在!!!"); |
| | | } |
| | | //如果为入库单 PakinPakoutStatus = 1,单据生成完毕后,生成入库组托档。 |
| | | if (pakinOrder.getPakinPakoutStatus().equals(1)){ |
| | | List<OrderDetlPakin> pakinOrderDetls = orderDetlPakinService.selectList(new EntityWrapper<OrderDetlPakin>().eq("order_id", pakinOrder.getId())); |
| | | if (!Objects.isNull(pakinOrderDetls) && !pakinOrderDetls.isEmpty()) { |
| | | pakinOrderDetls.forEach(orderDetl -> { |
| | | WaitPakin waitPakin = new WaitPakin(); |
| | | BeanUtils.copyProperties(orderDetl, waitPakin); |
| | | Mat matnr = matService.selectOne(new EntityWrapper<Mat>().eq("matnr", orderDetl.getMatnr())); |
| | | if (Objects.isNull(matnr)){ |
| | | throw new CoolException(orderDetl.getMatnr() + "商品档案不存在"); |
| | | } |
| | | if (!Objects.isNull(orderDetl.getBarcode()) && !orderDetl.getBarcode().isEmpty()) { |
| | | waitPakin.setBarcode(orderDetl.getBarcode()); |
| | | waitPakin.setZpallet(orderDetl.getBarcode()); |
| | | } |
| | | waitPakin.setOrderId(pakinOrder.getId()); |
| | | waitPakin.setAnfme(orderDetl.getAnfme()); |
| | | waitPakin.setOrderNo(pakinOrder.getOrderNo()); |
| | | waitPakin.setIoStatus("N"); |
| | | waitPakin.setStatus("Y"); |
| | | waitPakin.setAppeTime(new Date()); |
| | | waitPakin.setModiTime(new Date()); |
| | | if (!waitPakinService.insert(waitPakin)) { |
| | | throw new CoolException("组托档保存失败!!"); |
| | | } |
| | | }); |
| | | } else { |
| | | throw new CoolException("入库单据明细不存在!!!"); |
| | | } |
| | | } |
| | | // 修改订单状态 1.未作业 ===>> 2.作业中 |
| | | if (!orderService.updateSettle(order.getId(), 2L, null)) { |
| | |
| | | String response = ""; |
| | | boolean success = false; |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | .setUri(MesConstant.URL) |
| | | .setPath(MesConstant.PAKIN_URL) |
| | | .setJson(JSON.toJSONString(pakinParam)) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | // response = new HttpHandler.Builder() |
| | | // .setUri(MesConstant.URL) |
| | | // .setPath(MesConstant.PAKIN_URL) |
| | | // .setJson(JSON.toJSONString(pakinParam)) |
| | | // .build() |
| | | // .doPost(); |
| | | // JSONObject jsonObject = JSON.parseObject(response); |
| | | // if (jsonObject.getInteger("code").equals(200)) { |
| | | if (true) { |
| | | success = true; |
| | | // 修改订单状态 4.完成 ===>> 6.已上报 |
| | | if (!orderService.updateSettle(order.getId(), settle, null)) { |
| | |
| | | String response = ""; |
| | | boolean success = false; |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | .setUri(MesConstant.URL) |
| | | .setPath(MesConstant.PAKOUT_URL) |
| | | .setJson(JSON.toJSONString(pakoutParam)) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | // response = new HttpHandler.Builder() |
| | | // .setUri(MesConstant.URL) |
| | | // .setPath(MesConstant.PAKOUT_URL) |
| | | // .setJson(JSON.toJSONString(pakoutParam)) |
| | | // .build() |
| | | // .doPost(); |
| | | // JSONObject jsonObject = JSON.parseObject(response); |
| | | // if (jsonObject.getInteger("code").equals(200)) { |
| | | if (true) { |
| | | success = true; |
| | | // 修改订单状态 4.完成 ===>> 6.已上报 |
| | | if (!orderService.updateSettle(order.getId(), settle, null)) { |