自动化立体仓库 - WMS系统
skyouc
2 天以前 7cf2e143941e1548cc468992ada42106a27805a1
src/main/java/com/zy/asrs/task/handler/OrderSyncHandler.java
@@ -5,13 +5,9 @@
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.enums.OrderTypeEnum;
import com.zy.asrs.service.*;
import com.zy.asrs.task.AbstractHandler;
import com.zy.asrs.task.core.ReturnT;
import com.zy.asrs.utils.OrderInAndOutUtil;
@@ -21,6 +17,7 @@
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;
@@ -46,6 +43,10 @@
    private ApiLogService apiLogService;
    @Autowired
    private DocTypeService docTypeService;
    @Autowired
    private OrderPakinService  orderPakinService;
    @Autowired
    private OrderDetlPakinService orderDetlPakinService;
    @Transactional
    public ReturnT<String> startOrderIssuedOnceMore(Order order) {
@@ -114,6 +115,15 @@
        for (OrderDetl orderDetl : orderDetlList){
            orderDetl.setWorkQty(0D);
            OrderInAndOutUtil.insertOrderDetl(order.getPakinPakoutStatus$(),order,orderDetl);
            //小松:如果下发备货派工单,则生成备货出库+备货入库
            if (order.getDocType().equals(OrderTypeEnum.TRANSFER.type.longValue())){
                try {
                    ifTransfetInsertStockIn(order,orderDetl);
                }catch (Exception e){
                    throw new CoolException(e.getMessage());
                }
            }
        }
        // 修改订单状态 1.未作业 ===>> 2.作业中
        if (!orderService.updateSettle(order.getId(), 2L, null)) {
@@ -122,8 +132,41 @@
        return SUCCESS;
    }
    @Transactional(rollbackFor = Exception.class)
    public void ifTransfetInsertStockIn(Order order, OrderDetl orderDetl){
        OrderPakin orderPakin = new OrderPakin();
        BeanUtils.copyProperties(order,orderPakin);
        orderPakin.setDocType(OrderTypeEnum.STOCK_IN.type.longValue());
        if (!orderPakinService.insert(orderPakin)){
            throw new CoolException("插入备货入库单失败");
        }
        OrderDetlPakin orderDetlPakin = new OrderDetlPakin();
        BeanUtils.copyProperties(orderDetl,orderDetlPakin);
        orderDetlPakin.setOrderId(orderPakin.getId());
        if (!orderDetlPakinService.insert(orderDetlPakin)){
            throw new CoolException("插入备货入库单失败");
        }
    }
    @Transactional
    public ReturnT<String> startOrderInAndOutUtil(Order order) {
        //小松:轮训到备货派工单是查询备货入库单是否完成
        if (order.getDocType().equals(OrderTypeEnum.STOCK_IN.type.longValue())){
            return SUCCESS;
        }
        if (order.getDocType().equals(OrderTypeEnum.TRANSFER.type.longValue())){
            OrderPakin orderPakin = orderPakinService.selectByNo(order.getOrderNo());
            if (null != orderPakin) {
                if (!orderPakin.getSettle().equals(4L)){
                    return SUCCESS;
                }
            }
        }
        DocType docType = docTypeService.selectById(order.getDocType());
        if (null == docType) {
            return SUCCESS;