自动化立体仓库 - WMS系统
skyouc
3 天以前 608e6b5a45d2e53879b10aca3475dd8df92e5e5f
bug修复
13个文件已修改
455 ■■■■■ 已修改文件
src/main/java/com/zy/api/entity/OrderParams.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/api/entity/ReportOrderParams.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/api/enums/MatLocType.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/api/service/impl/AgvScheduleServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/Mat.java 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/ViewWorkInBean.java 47 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/task/handler/OrderSyncHandler.java 302 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/utils/Utils.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/OrderDetlPakoutMapper.xml 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/ViewWorkInMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/common.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/report/workIn.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/report/viewWorkIn.html 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/api/entity/OrderParams.java
@@ -57,8 +57,8 @@
    private String cus_address;
    @ApiModelProperty("WMS ID")
    private String wms_id;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
src/main/java/com/zy/api/entity/ReportOrderParams.java
@@ -45,4 +45,11 @@
        @ApiModelProperty("差异数量")
        private Integer diff_qty;
        @ApiModelProperty("原上架派工数量")
        private Integer old_qty;
        @ApiModelProperty("变更数量")
        private Integer new_qty;
}
src/main/java/com/zy/api/enums/MatLocType.java
@@ -48,4 +48,18 @@
            return null;
        }
    }
    public static String getMatTag(String type) {
        if (type.equals(MatLocType.AUTOMATED.type)) {
            return MatType.LARGE.type;
        } else if (type.equals(MatLocType.SO_HOLDING.type)) {
            return MatType.MIDDEL.type;
        } else if (type.equals(MatLocType.EO_HOLDING.type)) {
            return MatType.SMALL.type;
        } else {
            return null;
        }
    }
}
src/main/java/com/zy/api/service/impl/AgvScheduleServiceImpl.java
@@ -69,7 +69,7 @@
                .contains(task.getIoType())) {
            // 入库
            task.setWrkSts(TaskStatusType.AGV_TASK_ISSUED_IN.type);
        } else if (Arrays.asList(TaskIOType.ALL_OUT.type, TaskIOType.PICK_OUT.type, TaskIOType.MERGE_OUT.type)
        } else if (Arrays.asList(TaskIOType.ALL_OUT.type, TaskIOType.PICK_OUT.type, TaskIOType.MERGE_OUT.type, TaskIOType.EMPTY_OUT.type)
                .contains(task.getIoType())) {
            // 出库
            task.setWrkSts(TaskStatusType.AGV_TASK_ISSUED_OUT.type);
@@ -109,7 +109,7 @@
                task.setWrkSts(TaskStatusType.AGV_TASK_FINISHED_IN.type);
            }
        } else if (Arrays.asList(TaskIOType.ALL_OUT.type, TaskIOType.PICK_OUT.type, TaskIOType.MERGE_OUT.type)
        } else if (Arrays.asList(TaskIOType.ALL_OUT.type, TaskIOType.PICK_OUT.type, TaskIOType.MERGE_OUT.type, TaskIOType.EMPTY_OUT.type)
                .contains(task.getIoType())) {
            // 出库
            if (params.getStatus().equals("RUNNING")) {
src/main/java/com/zy/asrs/entity/Mat.java
@@ -380,52 +380,7 @@
        this.memo = memo;
    }
//    Mat mat = new Mat(
//            null,    // 编号
//            null,    // 所属归类
//            null,    // 商品编号
//            null,    // 商品名称
//            null,    // 别名
//            null,    // 规格
//            null,    // 型号
//            null,    // 颜色
//            null,    // 品牌
//            null,    // 单位
//            null,    // 单价
//            null,    // sku
//            null,    // 单位量
//            null,    // 条码
//            null,    // 产地
//            null,    // 厂家
//            null,    // 生产日期
//            null,    // 品项数
//            null,    // 安全库存量
//            null,    // 重量
//            null,    // 长度
//            null,    // 体积
//            null,    // 三方编码
//            null,    // 供应商
//            null,    // 供应商编码
//            null,    // 是否批次
//            null,    // 保质期
//            null,    // 预警天数
//            null,    // 制购
//            null,    // 要求检验
//            null,    // 危险品
//            null,    // 状态[非空]
//            null,    // 添加人员
//            null,    // 添加时间
//            null,    // 修改人员
//            null,    // 修改时间
//            null    // 备注
//    );
    public String getTagId$(){
//        TagService service = SpringUtils.getBean(TagService.class);
//        Tag tag = service.selectById(this.tagId);
//        if (!Cools.isEmpty(tag)){
//            return String.valueOf(tag.getName());
//        }
        return MatLocType.getTagName(this.tagId + "");
    }
@@ -443,6 +398,10 @@
        return null;
    }
    public String getProType(){
        return MatLocType.getMatTag(this.tagId + "");
    }
    public String getBeBatch$(){
        if (null == this.beBatch){ return null; }
        switch (this.beBatch){
src/main/java/com/zy/asrs/entity/ViewWorkInBean.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.annotations.TableField;
import com.core.common.Cools;
import com.core.common.SpringUtils;
import com.zy.asrs.service.MatService;
import com.zy.system.entity.User;
import com.zy.system.service.UserService;
import io.swagger.annotations.ApiModelProperty;
@@ -35,13 +36,16 @@
    private String crn_end_time;
    @ApiModelProperty(value= "工作号")
    private Integer wrk_no;
    @TableField("wrk_no")
    private Integer wrkNo;
    @ApiModelProperty(value= "工作时间")
    private Date io_time;
    @TableField("io_time")
    private Date ioTime;
    @ApiModelProperty(value= "库位号")
    private String loc_no;
    @TableField("loc_no")
    private String locNo;
    @ApiModelProperty(value= "托盘条码")
    private String zpallet;
@@ -114,13 +118,15 @@
    private Double volume;
    @ApiModelProperty(value= "三方编码")
    private String three_code;
    @TableField("three_code")
    private String threeCode;
    @ApiModelProperty(value= "供应商")
    private String supp;
    @ApiModelProperty(value= "供应商编码")
    private String supp_code;
    @TableField("supp_code")
    private String suppCode;
    @ApiModelProperty(value= "是否批次 1: 是  0: 否  ")
    private Integer be_batch;
@@ -141,23 +147,27 @@
    private Integer danger;
    @ApiModelProperty(value= "修改人员")
    private Long modi_user;
    @TableField("modi_user")
    private Long modiUser;
    @ApiModelProperty(value= "修改时间")
    private Object modi_time;
    @TableField("modi_time")
    private Object modiTime;
    @ApiModelProperty(value= "创建者")
    private Long appe_user;
    @TableField("appe_user")
    private Long appeUser;
    @ApiModelProperty(value= "添加时间")
    private Object appe_time;
    @TableField("appe_time")
    private Object appeTime;
    @ApiModelProperty(value= "备注")
    private String memo;
    public String getModiUser$(){
        UserService service = SpringUtils.getBean(UserService.class);
        User user = service.selectById(this.modi_user);
        User user = service.selectById(this.modiUser);
        if (!Cools.isEmpty(user)){
            return String.valueOf(user.getUsername());
        }
@@ -166,7 +176,7 @@
    public String getAppeUser$(){
        UserService service = SpringUtils.getBean(UserService.class);
        User user = service.selectById(this.appe_user);
        User user = service.selectById(this.appeUser);
        if (!Cools.isEmpty(user)){
            return String.valueOf(user.getUsername());
        }
@@ -174,10 +184,21 @@
    }
    public String getIoTime$(){
        if (Cools.isEmpty(this.io_time)){
        if (Cools.isEmpty(this.ioTime)){
            return "";
        }
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.io_time);
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.ioTime);
    }
    public String getTag$() {
        if (!Cools.isEmpty(this.matnr)){
            MatService matnrService = SpringUtils.getBean(MatService.class);
            Mat matnr = matnrService.selectByMatnr(this.matnr);
            if (!Cools.isEmpty(matnr)){
                return matnr.getTagId$();
            }
        }
        return "";
    }
    public void setQuery_date(String query_date) {
src/main/java/com/zy/asrs/task/handler/OrderSyncHandler.java
@@ -6,6 +6,8 @@
import com.core.common.DateUtils;
import com.core.exception.CoolException;
import com.zy.api.entity.ReportOrderParam;
import com.zy.api.entity.ReportOrderParams;
import com.zy.api.entity.dto.XSR;
import com.zy.api.service.KopenApiService;
import com.zy.asrs.entity.*;
import com.zy.asrs.enums.OrderTypeEnum;
@@ -13,6 +15,7 @@
import com.zy.asrs.task.AbstractHandler;
import com.zy.asrs.task.core.ReturnT;
import com.zy.asrs.utils.OrderInAndOutUtil;
import com.zy.asrs.utils.Utils;
import com.zy.common.constant.MesConstant;
import com.zy.common.model.DetlDto;
import com.zy.common.model.MesPakinParam;
@@ -26,7 +29,9 @@
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
@@ -46,11 +51,13 @@
    @Autowired
    private DocTypeService docTypeService;
    @Autowired
    private OrderPakinService  orderPakinService;
    private OrderPakinService orderPakinService;
    @Autowired
    private OrderDetlPakinService orderDetlPakinService;
    @Autowired
    private KopenApiService kopenApiService;
    @Autowired
    private MatService matService;
    @Transactional
    public ReturnT<String> startOrderIssuedOnceMore(Order order) {
@@ -60,7 +67,7 @@
        }
        Order order1 = OrderInAndOutUtil.selectByNo(order.getPakinPakoutStatus$(), order.getOrderNo());
        if (!Cools.isEmpty(order1)){
        if (!Cools.isEmpty(order1)) {
            return FAIL.setMsg("请等待...订单执行档案正在转历史档案!!!");
        }
        List<OrderDetl> orderDetls = OrderInAndOutUtil.selectByOrderId(order.getPakinPakoutStatus$(), order.getId());
@@ -70,12 +77,12 @@
        // 单据明细档
        List<OrderDetl> orderDetlList = orderDetlService.selectByOrderId(order.getId());
        for (OrderDetl orderDetl : orderDetlList){
            if (orderDetl.getQty().equals(0D)){
        for (OrderDetl orderDetl : orderDetlList) {
            if (orderDetl.getQty().equals(0D)) {
                continue;
            }
            orderDetl.setWorkQty(orderDetl.getQty());
            orderDetl.setAnfme(orderDetl.getAnfme()-orderDetl.getQty());
            orderDetl.setAnfme(orderDetl.getAnfme() - orderDetl.getQty());
            orderDetl.setQty(0D);
            orderDetlService.updateById(orderDetl);
        }
@@ -87,7 +94,7 @@
        return SUCCESS;
    }
    @Transactional
    @Transactional(rollbackFor = Exception.class)
    public ReturnT<String> startOrderIssued(Order order) {
        DocType docType = docTypeService.selectById(order.getDocType());
        if (null == docType) {
@@ -95,20 +102,25 @@
        }
        List<OrderDetl> orderDetls = orderDetlService.selectByOrderId(order.getId());
        OrderInAndOutUtil.insertOrder(order.getPakinPakoutStatus$(),order);
        OrderInAndOutUtil.insertOrder(order.getPakinPakoutStatus$(), order);
        // 单据明细档
        List<DetlDto> list = new ArrayList<>();
        List<OrderDetl> orderDetlList = new ArrayList<>();
        for (OrderDetl detail : orderDetls) {
            DetlDto dto = new DetlDto(detail.getMatnr(), detail.getBatch(),detail.getBrand(),detail.getStandby1(),detail.getStandby2(),detail.getStandby3(),
                    detail.getBoxType1(),detail.getBoxType2(),detail.getBoxType3(), detail.getAnfme(), detail.getThreeCode());
            DetlDto dto = new DetlDto(detail.getMatnr(), detail.getBatch(), detail.getBrand(), detail.getStandby1(),
                    detail.getStandby2(), detail.getStandby3(),
                    detail.getBoxType1(), detail.getBoxType2(), detail.getBoxType3(), detail.getAnfme(),
                    detail.getThreeCode());
            if (DetlDto.has(list, dto)) {
                DetlDto detlDto = DetlDto.find(list, dto.getMatnr(), dto.getBatch(),dto.getBrand(),dto.getStandby1(),dto.getStandby2(),dto.getStandby3(),dto.getBoxType1(),dto.getBoxType2(),dto.getBoxType3());
                DetlDto detlDto = DetlDto.find(list, dto.getMatnr(), dto.getBatch(), dto.getBrand(), dto.getStandby1(),
                        dto.getStandby2(), dto.getStandby3(), dto.getBoxType1(), dto.getBoxType2(), dto.getBoxType3());
                assert detlDto != null;
                detlDto.setAnfme(detlDto.getAnfme() + detail.getAnfme());
                OrderDetl orderDetl = OrderDetl.find(orderDetlList, dto.getMatnr(), dto.getBatch(),dto.getBrand(),dto.getStandby1(),dto.getStandby2(),dto.getStandby3(),dto.getBoxType1(),dto.getBoxType2(),dto.getBoxType3());
                OrderDetl orderDetl = OrderDetl.find(orderDetlList, dto.getMatnr(), dto.getBatch(), dto.getBrand(),
                        dto.getStandby1(), dto.getStandby2(), dto.getStandby3(), dto.getBoxType1(), dto.getBoxType2(),
                        dto.getBoxType3());
                assert orderDetl != null;
                orderDetl.setAnfme(orderDetl.getAnfme() + detail.getAnfme());
            } else {
@@ -116,18 +128,17 @@
                orderDetlList.add(detail);
            }
        }
        for (OrderDetl orderDetl : orderDetlList){
        for (OrderDetl orderDetl : orderDetlList) {
            orderDetl.setWorkQty(0D);
            OrderInAndOutUtil.insertOrderDetl(order.getPakinPakoutStatus$(),order,orderDetl);
            //小松:如果下发备货派工单,则生成备货出库+备货入库
            if (order.getDocType().equals(OrderTypeEnum.TRANSFER.type.longValue())){
            OrderInAndOutUtil.insertOrderDetl(order.getPakinPakoutStatus$(), order, orderDetl);
            // 小松:如果下发备货派工单,则生成备货出库+备货入库
            if (order.getDocType().equals(OrderTypeEnum.TRANSFER.type.longValue())) {
                try {
                    ifTransfetInsertStockIn(order,orderDetl);
                }catch (Exception e){
                    ifTransfetInsertStockIn(order, orderDetl);
                } catch (Exception e) {
                    throw new CoolException(e.getMessage());
                }
            }
        }
        // 修改订单状态 1.未作业 ===>> 2.作业中
        if (!orderService.updateSettle(order.getId(), 2L, null)) {
@@ -137,36 +148,34 @@
    }
    @Transactional(rollbackFor = Exception.class)
    public void ifTransfetInsertStockIn(Order order, OrderDetl orderDetl){
    public void ifTransfetInsertStockIn(Order order, OrderDetl orderDetl) {
        OrderPakin orderPakin = new OrderPakin();
        BeanUtils.copyProperties(order,orderPakin);
        BeanUtils.copyProperties(order, orderPakin);
        orderPakin.setDocType(OrderTypeEnum.STOCK_IN.type.longValue());
        if (!orderPakinService.insert(orderPakin)){
        if (!orderPakinService.insert(orderPakin)) {
            throw new CoolException("插入备货入库单失败");
        }
        OrderDetlPakin orderDetlPakin = new OrderDetlPakin();
        BeanUtils.copyProperties(orderDetl,orderDetlPakin);
        BeanUtils.copyProperties(orderDetl, orderDetlPakin);
        orderDetlPakin.setOrderId(orderPakin.getId());
        if (!orderDetlPakinService.insert(orderDetlPakin)){
        if (!orderDetlPakinService.insert(orderDetlPakin)) {
            throw new CoolException("插入备货入库单失败");
        }
    }
    @Transactional
    public ReturnT<String> startOrderInAndOutUtil(Order order) {
        //小松:轮训到备货派工单是查询备货入库单是否完成
        if (order.getDocType().equals(OrderTypeEnum.STOCK_IN.type.longValue())){
        // 小松:轮训到备货派工单是查询备货入库单是否完成
        if (order.getDocType().equals(OrderTypeEnum.STOCK_IN.type.longValue())) {
            return SUCCESS;
        }
        if (order.getDocType().equals(OrderTypeEnum.TRANSFER.type.longValue())){
        if (order.getDocType().equals(OrderTypeEnum.TRANSFER.type.longValue())) {
            OrderPakin orderPakin = orderPakinService.selectByNo(order.getOrderNo());
            if (null != orderPakin) {
                if (!orderPakin.getSettle().equals(4L)){
                if (!orderPakin.getSettle().equals(4L)) {
                    return SUCCESS;
                }
            }
@@ -176,32 +185,32 @@
            return SUCCESS;
        }
        Order orderSou = orderService.selectByNo(order.getOrderNo());
        if (!orderSou.getSettle().equals(2L)){
        if (!orderSou.getSettle().equals(2L)) {
            return FAIL.setMsg("订单状态不正确,请联系管理员");
        }
        List<OrderDetl> orderDetlList = orderDetlService.selectByOrderId(orderSou.getId());
        List<OrderDetl> orderDetls = OrderInAndOutUtil.selectByOrderId(order.getPakinPakoutStatus$(), order.getId());
        for (OrderDetl orderDetlSou : orderDetlList){
            for (OrderDetl orderDetl : orderDetls){
                if (orderDetl.getQty().equals(0D)){
        for (OrderDetl orderDetlSou : orderDetlList) {
            for (OrderDetl orderDetl : orderDetls) {
                if (orderDetl.getQty().equals(0D)) {
                    continue;
                }
                if (orderDetlSou.beSimilar(orderDetl)){
                if (orderDetlSou.beSimilar(orderDetl)) {
                    double v = orderDetlSou.getAnfme() - orderDetlSou.getQty();
                    if (v<orderDetl.getQty() || orderDetl.getQty().equals(v)){
                    if (v < orderDetl.getQty() || orderDetl.getQty().equals(v)) {
                        orderDetlSou.setQty(orderDetlSou.getAnfme());
                        orderDetl.setQty(orderDetl.getQty() - v);
                        break;
                    } else {
                        orderDetlSou.setQty(orderDetlSou.getQty()+orderDetl.getQty());
                        orderDetlSou.setQty(orderDetlSou.getQty() + orderDetl.getQty());
                        orderDetl.setQty(0D);
                    }
                }
            }
        }
        for (OrderDetl orderDetlSou : orderDetlList){
        for (OrderDetl orderDetlSou : orderDetlList) {
            orderDetlService.updateById(orderDetlSou);
        }
        // 修改订单状态 2.作业中 ===>> 4.待上报
@@ -209,18 +218,17 @@
            throw new CoolException("服务器内部错误,请联系管理员");
        }
        // 修改订单状态 4.完成 ===>> 6.结束
        OrderInAndOutUtil.updateOrder(order.getPakinPakoutStatus$(),order.getId(),6L,null);
        OrderInAndOutUtil.updateOrder(order.getPakinPakoutStatus$(), order.getId(), 6L, null);
        return SUCCESS;
    }
    /**
     * 单据上报
     * @author Ryan
     * @date 2025/12/15 16:14
     *
     * @param order
     * @return com.zy.asrs.task.core.ReturnT<java.lang.String>
     * @author Ryan
     * @date 2025/12/15 16:14
     */
    @Transactional
    public ReturnT<String> startOrderReport(Order order) {
@@ -230,95 +238,146 @@
        }
        long settle = 6L;
        List<OrderDetl> orderDetls = orderDetlService.selectByOrderId(order.getId());
        // 入库完成上报
        if (docType.getPakin() == 1) {
            MesPakinParam pakinParam = new MesPakinParam();
            pakinParam.setPakinTime(DateUtils.convert(order.getUpdateTime()));
            pakinParam.setLgortFrom("5008");
            pakinParam.setLgortTo("5006");
            for (OrderDetl orderDetl : orderDetls) {
                if (!orderDetl.getQty().equals(orderDetl.getAnfme())){
                    settle = 99L;//二次生成单据
                }
                String serial = Cools.isEmpty(orderDetl.getBatch()) ? "" : orderDetl.getBatch();
                pakinParam.getList().add(new MesPakinParam.Detl(orderDetl.getMatnr() + (Cools.isEmpty(serial) ? "" : "-" + serial), orderDetl.getAnfme()));
            }
        if (Integer.valueOf(docType.getDocId() + "").equals(OrderTypeEnum.PICKING.type)) {
            // 上架派工单完成
            ReportOrderParam orderParam = new ReportOrderParam();
            orderParam.setCompany_id(order.getCstmrName())
                    .setWms_id(order.getId() + "")
                    .setOrder_no(order.getOrderNo())
                    .setType(order.getDocType() + "")
                    .setInv_no(order.getNumber())
                    .setPm_tktid(order.getItemName())
                    .setUpdate_time(Utils.dateToStr(new Date(), "yyyy-MM-dd HH:mm:ss"))
                    .setTarget_location("");
            String response = "";
            List<ReportOrderParams> reportOrderParams = new ArrayList<>();
            orderDetls.forEach(detl -> {
                Mat material = matService.selectByMatnr(detl.getMatnr());
                if (Objects.isNull(material)) {
                    throw new CoolException("物料不存在");
                }
                ReportOrderParams itemParam = new ReportOrderParams();
                // BS Code
                itemParam.setTotal_serial(detl.getThreeCode())
                        // 上报时,默认产品类型是null
                        .setPro_type(material.getProType())
                        // 上报时,默认产品编码
                        .setPro_komcode(detl.getMatnr())
                        // 上报时,默认产品id是供应商编码
                        .setPro_id(detl.getSuppCode())
                        // 上报时,默认来源位置是null
                        .setLocation_no(null)
                        // 上报时,默认目标位置是null
                        .setLocation_type(null)
                        // 上报时,默认上报时间是更新时间
                        .setSj_date(order.getUpdateBy().toString())
                        // 上报时,默认上报人是更新人
                        .setSj_emp(order.getUpdateBy$())
                        // 上报时,默认上报数量是订单数量
                        .setPick_qty(detl.getQty().intValue())
                        // 上报时,默认损坏数量是0
                        .setDamage_qty(0)
                        // 上报时,默认差异数量是0
                        .setDiff_qty(0);
                reportOrderParams.add(itemParam);
            });
            orderParam.setDetails(reportOrderParams);
            XSR response = null;
            boolean success = false;
            try {
                ReportOrderParam orderParam = new ReportOrderParam();
                response = kopenApiService.getInDispatchResult(orderParam);
                kopenApiService.getInDispatchResult(orderParam);
//                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)) {
                        throw new CoolException("服务器内部错误,请联系管理员");
                    }
                } else {
                    log.error("请求接口失败!!!url:{};request:{};response:{}", MesConstant.URL+MesConstant.PAKIN_URL, JSON.toJSONString(pakinParam), response);
                    throw new CoolException("上报mes系统失败");
                }
                // if (true) {
                // success = true;
                // // 修改订单状态 4.完成 ===>> 6.已上报
                // if (!orderService.updateSettle(order.getId(), settle, null)) {
                // throw new CoolException("服务器内部错误,请联系管理员");
                // }
                // } else {
                // log.error("请求接口失败!!!url:{};request:{};response:{}", MesConstant.URL +
                // MesConstant.PAKIN_URL, JSON.toJSONString(pakinParam), response);
                // throw new CoolException("上报mes系统失败");
                // }
            } catch (Exception e) {
                log.error("fail", e);
//            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                return FAIL.setMsg(e.getMessage());
            } finally {
                try {
                    // 保存接口日志
                    apiLogService.save(
                            "成品库入库上报",
                            "上架派工单完成上报",
                            MesConstant.URL + MesConstant.PAKIN_URL,
                            null,
                            "127.0.0.1",
                            JSON.toJSONString(pakinParam),
                            response,
                            success
                    );
                } catch (Exception e) { log.error("", e); }
            }
        }
        // 出库完成上报
        if (docType.getPakout() == 1) {
            MesPakoutParam pakoutParam = new MesPakoutParam();
            pakoutParam.setTag(!order.getDocType$().equalsIgnoreCase("手动出库单"));
            pakoutParam.setPakoutTime(DateUtils.convert(order.getUpdateTime()));
            pakoutParam.setLgortFrom("5006");
            pakoutParam.setLgortTo("1111");
            if (!pakoutParam.isTag()) {
                pakoutParam.setKunnr("C1000");
            }
            pakoutParam.setOrderNo(order.getOrderNo());
            for (OrderDetl orderDetl : orderDetls) {
                if (!orderDetl.getQty().equals(orderDetl.getAnfme())){
                    settle = 99L;//二次生成单据
                            JSON.toJSONString(orderParam),
                            JSON.toJSONString(response),
                            success);
                } catch (Exception e) {
                    log.error("", e);
                }
                String serial = Cools.isEmpty(orderDetl.getBatch()) ? "" : orderDetl.getBatch();
                pakoutParam.getList().add(new MesPakoutParam.Detl(orderDetl.getMatnr() + (Cools.isEmpty(serial) ? "" : "-" + serial), orderDetl.getAnfme()));
            }
            String response = "";
        } else if (Integer.valueOf(docType.getDocId() + "").equals(OrderTypeEnum.TRANSFER.type)) {
            // 备货派工单(出库)
            ReportOrderParam orderParam = new ReportOrderParam();
            orderParam.setCompany_id(order.getCstmrName())
                    .setWms_id(order.getId() + "")
                    .setOrder_no(order.getOrderNo())
                    .setType(order.getDocType() + "")
                    .setInv_no(order.getNumber())
                    .setPm_tktid(order.getItemName())
                    .setUpdate_time(Utils.dateToStr(new Date(), "yyyy-MM-dd HH:mm:ss"))
                    .setTarget_location("");
            List<ReportOrderParams> reportOrderParams = new ArrayList<>();
            orderDetls.forEach(detl -> {
                Mat material = matService.selectByMatnr(detl.getMatnr());
                if (Objects.isNull(material)) {
                    throw new CoolException("物料不存在");
                }
                ReportOrderParams itemParam = new ReportOrderParams();
                // BS Code
                itemParam.setTotal_serial(detl.getThreeCode())
                        // 上报时,默认产品类型是null
                        .setPro_type(material.getProType())
                        // 上报时,默认产品编码
                        .setPro_komcode(detl.getMatnr())
                        // 上报时,默认产品id是供应商编码
                        .setPro_id(detl.getSuppCode())
                        // 上报时,默认来源位置是null
                        .setLocation_no(null)
                        // 上报时,默认目标位置是null
                        .setLocation_type(null)
                        // 上报时,默认上报时间是更新时间
                        .setSj_date(order.getUpdateBy().toString())
                        // 上报时,默认上报人是更新人
                        .setSj_emp(order.getUpdateBy$())
                        // 上报时,默认上报数量是订单数量
                        .setPick_qty(detl.getQty().intValue())
                        // 上报时,默认损坏数量是0
                        .setDamage_qty(0)
                        // 上报时,默认差异数量是0
                        .setDiff_qty(0);
                reportOrderParams.add(itemParam);
            });
            orderParam.setDetails(reportOrderParams);
            XSR response = null;
            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.已上报
@@ -326,26 +385,27 @@
                        throw new CoolException("服务器内部错误,请联系管理员");
                    }
                } else {
                    log.error("请求接口失败!!!url:{};request:{};response:{}", MesConstant.URL+MesConstant.PAKOUT_URL, JSON.toJSONString(pakoutParam), response);
                    log.error("请求接口失败!!!url:{};request:{};response:{}", MesConstant.URL + MesConstant.PAKOUT_URL,
                            JSON.toJSONString(orderParam), JSON.toJSONString(response));
                    throw new CoolException("上报mes系统失败");
                }
            } catch (Exception e) {
                log.error("fail", e);
//            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                return FAIL.setMsg(e.getMessage());
            } finally {
                try {
                    // 保存接口日志
                    apiLogService.save(
                            "成品库出库上报",
                            "备货派工单完成上报",
                            MesConstant.URL + MesConstant.PAKOUT_URL,
                            null,
                            "127.0.0.1",
                            JSON.toJSONString(pakoutParam),
                            response,
                            success
                    );
                } catch (Exception e) { log.error("", e); }
                            JSON.toJSONString(orderParam),
                            JSON.toJSONString(response),
                            success);
                } catch (Exception e) {
                    log.error("", e);
                }
            }
        }
        return SUCCESS;
src/main/java/com/zy/asrs/utils/Utils.java
@@ -654,4 +654,15 @@
        return result;
    }
    /**
     * 日期转换为字符串
     * @param date 日期
     * @param format 格式
     * @return 字符串
     */
    public static String dateToStr(Date date, String format) {
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        return sdf.format(date);
    }
}
src/main/resources/mapper/OrderDetlPakoutMapper.xml
@@ -100,6 +100,9 @@
        <if test="matnr!=null and matnr!='' ">
            and mod.matnr like '%' + #{matnr} + '%'
        </if>
        <if test="doc_type!=null and doc_type!='' ">
            and mo.doc_type like '%' + #{doc_type} + '%'
        </if>
        <if test="maktx!=null and maktx!='' ">
            and mod.maktx like '%' + #{maktx} + '%'
        </if>
src/main/resources/mapper/ViewWorkInMapper.xml
@@ -5,8 +5,8 @@
<!-- mapper不支持sql语句嵌套时,采用sql片段包含方式,解决xml标签问题 -->
<sql id="viewWorkInConditionSql">
        <if test="loc_no!=null and loc_no!='' ">
            and loc_no like '%' + #{loc_no} + '%'
        <if test="locNo!=null and locNo!='' ">
            and loc_no like '%' + #{locNo} + '%'
        </if>
        <if test="matnr!=null and matnr!='' ">
            and matnr like '%' + #{matnr} + '%'
src/main/webapp/static/js/common.js
@@ -246,7 +246,7 @@
    {field: 'matnr', align: 'center',title: '商品编号', sort:true}
    ,{field: 'maktx', align: 'center',title: '商品名称', sort:true}
    ,{field: 'orderNo', align: 'center',title: '单据编号', hide: false}
    ,{field: 'standby1', align: 'center',title: '供应商编码', hide: false}
    ,{field: 'suppCode', align: 'center',title: '供应商编码', hide: false}
    ,{field: 'threeCode', align: 'center',title: 'BS Code', hide: false}
    ,{field: 'tag$', align: 'center',title: '零件类型', hide: false}
    ,{field: 'batch', align: 'center',title: '批号', hide: true}
@@ -254,7 +254,7 @@
    ,{field: 'zpallet', align: 'center',title: '托盘条码', hide: false}
    ,{field: 'length', align: 'center',title: '重量', hide: false}
    ,{field: 'volume', align: 'center',title: '尺寸', hide: false}
    ,{field: 'modiTime$', align: 'center',title: '更新时间', hide: false}
    ,{field: 'modiTime', align: 'center',title: '更新时间', hide: false}
    ,{field: 'supp', align: 'center',title: '供应商', hide: true}
    ,{field: 'specs', align: 'center',title: '规格', hide: true}
    ,{field: 'model', align: 'center',title: '代码', hide: true}
src/main/webapp/static/js/report/workIn.js
@@ -1,8 +1,8 @@
var pageCurr;
function getCol() {
    var cols = [
        {field: 'ioTime$', align: 'center', title: '入库日期', width: 200}
        ,{field: 'loc_no', align: 'center',title: '库位号'}
        {field: 'ioTime', align: 'center', title: '入库日期', width: 200}
        ,{field: 'locNo', align: 'center',title: '库位号'}
    ];
    cols.push.apply(cols, detlCols);
    return cols;
src/main/webapp/views/report/viewWorkIn.html
@@ -21,7 +21,7 @@
<div id="search-box" class="layui-form layui-card-header">
    <div class="layui-inline">
        <div class="layui-input-inline">
            <input class="layui-input" type="text" name="loc_no" placeholder="库位号" autocomplete="off">
            <input class="layui-input" type="text" name="locNo" placeholder="库位号" autocomplete="off">
        </div>
    </div>
    <div class="layui-inline">