自动化立体仓库 - WMS系统
ZY
2024-07-19 7125be069f3f926afe3e15366e9211646de1c637
中间表代码提交,初步测试完成
22个文件已修改
9个文件已添加
2个文件已删除
1 文件已重命名
2550 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/entity/Mat.java 43 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/Order.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/OrderDetl.java 183 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/mapper/OrderDetlMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/OrderDetlService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/OrderDetlServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/service/erp/ErpSqlServer.java 107 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/third/erp/entity/InCancelTB.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/third/erp/entity/InDetTB.java 217 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/third/erp/entity/InHedTB.java 156 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/third/erp/entity/ItemTB.java 174 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/third/erp/entity/OutCancelTB.java 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/third/erp/entity/OutDetTB.java 132 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/third/erp/entity/OutHedTB.java 100 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/third/erp/task/ERPInCancelScheduler.java 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/third/erp/task/ERPInCancelSchedulerMS.java 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/third/erp/task/ERPInHedTBScheduler.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/third/erp/task/ERPInOrOutCancelService.java 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/third/erp/task/ERPInOrOutService.java 240 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/third/erp/task/ERPInOrOutTBSchedulerMS.java 147 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/third/erp/task/ERPItemScheduler.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/third/erp/task/ERPItemService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/third/erp/task/ERPOutCancelScheduler.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/third/erp/task/ERPOutHedTBScheduler.java 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/third/lk/entity/ErpLKStorage.java 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/third/lk/entity/InDetTB.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/third/lk/entity/InDetTBBak.java 142 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/third/lk/entity/InHedTBBak.java 118 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/third/lk/entity/OutDetTB.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/third/lk/entity/OutDetTBBak.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/third/lk/entity/OutHedTBBak.java 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/third/lk/task/LKInTBScheduler.java 98 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/update20240719.sql 168 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/OrderDetlMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/Mat.java
@@ -328,32 +328,33 @@
    /**
     * 外部主键
     */
    @TableField("auto_id")
    private Integer autoId;
    /**
     * 订单号
     */
    @TableField("out_order_no")
    private String outOrderNo;
//    @TableField("auto_id")
//    private Integer autoId;
//    /**
//     * 订单号
//     */
//    @TableField("out_order_no")
//    private String outOrderNo;
//
//    /**
//     * 炉号\客户图号
//     */
//    @TableField("lu_hao")
//    private String luHao;
//
//    /**
//     * 工单号
//     */
//    @TableField("pg_no")
//    private String sPgNO;
    /**
     * 炉号\客户图号
     */
    @TableField("lu_hao")
    private String luHao;
    /**
     * 工单号
     */
    @TableField("pg_no")
    private String sPgNO;
    @TableField("temp1")
    private String temp1;
    @TableField("temp2")
    private String temp2;
    @TableField("temp3")
    private String temp3;
src/main/java/com/zy/asrs/entity/Order.java
@@ -93,7 +93,7 @@
     * 客户编号
     */
    @ApiModelProperty(value= "客户编号")
    private Long cstmr;
    private String cstmr;
    /**
     * 客户
@@ -270,7 +270,7 @@
    public Order() {}
    public Order(String uuid,String orderNo,String orderTime,Long docType,Long itemId,String itemName,Long allotItemId,String defNumber,String number,Long cstmr,String cstmrName,String tel,String operMemb,Double totalFee,Double discount,Double discountFee,Double otherFee,Double actFee,Integer payType,String salesman,Integer accountDay,Integer postFeeType,Double postFee,Date payTime,Date sendTime,String shipName,String shipCode,Long settle,Integer status,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo) {
    public Order(String uuid,String orderNo,String orderTime,Long docType,Long itemId,String itemName,Long allotItemId,String defNumber,String number,String cstmr,String cstmrName,String tel,String operMemb,Double totalFee,Double discount,Double discountFee,Double otherFee,Double actFee,Integer payType,String salesman,Integer accountDay,Integer postFeeType,Double postFee,Date payTime,Date sendTime,String shipName,String shipCode,Long settle,Integer status,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo) {
        this.uuid = uuid;
        this.orderNo = orderNo;
        this.orderTime = orderTime;
src/main/java/com/zy/asrs/entity/OrderDetl.java
@@ -27,21 +27,21 @@
    /**
     * ID
     */
    @ApiModelProperty(value= "ID")
    @ApiModelProperty(value = "ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * 订单内码
     */
    @ApiModelProperty(value= "订单内码")
    @ApiModelProperty(value = "订单内码")
    @TableField("order_id")
    private Long orderId;
    /**
     * 单据编号
     */
    @ApiModelProperty(value= "单据编号")
    @ApiModelProperty(value = "单据编号")
    @TableField("order_no")
    private String orderNo;
@@ -49,253 +49,254 @@
    /**
     * 数量
     */
    @ApiModelProperty(value= "数量")
    @ApiModelProperty(value = "数量")
    private Double anfme;
    /**
     * 作业数量
     *
     *  入库 : 组托完成,组托档、工作档、入库完成数量
     *  出库 : 工作档、出库完成数量
     * <p>
     * 入库 : 组托完成,组托档、工作档、入库完成数量
     * 出库 : 工作档、出库完成数量
     */
    @ApiModelProperty(value= "作业数量")
    @ApiModelProperty(value = "作业数量")
    @TableField("work_qty")
    private Double workQty;
    /**
     * 完成数量
     *
     *  入库 : qty 👆
     *  出库 : qty 👆
     * <p>
     * 入库 : qty 👆
     * 出库 : qty 👆
     */
    @ApiModelProperty(value= "完成数量")
    @ApiModelProperty(value = "完成数量")
    private Double qty;
    /**
     * 商品编码
     */
    @ApiModelProperty(value= "商品编码")
    @ApiModelProperty(value = "商品编码")
    private String matnr;
    /**
     * 商品名称
     */
    @ApiModelProperty(value= "商品名称")
    @ApiModelProperty(value = "商品名称")
    private String maktx;
    /**
     * 批号
     */
    @ApiModelProperty(value= "批号")
    @ApiModelProperty(value = "批号")
    private String batch;
    /**
     * 规格
     */
    @ApiModelProperty(value= "规格")
    @ApiModelProperty(value = "规格")
    private String specs;
    /**
     * 型号
     */
    @ApiModelProperty(value= "型号")
    @ApiModelProperty(value = "型号")
    private String model;
    /**
     * 颜色
     */
    @ApiModelProperty(value= "颜色")
    @ApiModelProperty(value = "颜色")
    private String color;
    /**
     * 品牌
     */
    @ApiModelProperty(value= "品牌")
    @ApiModelProperty(value = "品牌")
    private String brand;
    /**
     * 单位
     */
    @ApiModelProperty(value= "单位")
    @ApiModelProperty(value = "单位")
    private String unit;
    /**
     * 单价
     */
    @ApiModelProperty(value= "单价")
    @ApiModelProperty(value = "单价")
    private Double price;
    /**
     * sku
     */
    @ApiModelProperty(value= "sku")
    @ApiModelProperty(value = "sku")
    private String sku;
    /**
     * 单位量
     */
    @ApiModelProperty(value= "单位量")
    @ApiModelProperty(value = "单位量")
    private Double units;
    /**
     * 条码
     */
    @ApiModelProperty(value= "条码")
    @ApiModelProperty(value = "条码")
    private String barcode;
    /**
     * 产地
     */
    @ApiModelProperty(value= "产地")
    @ApiModelProperty(value = "产地")
    private String origin;
    /**
     * 厂家
     */
    @ApiModelProperty(value= "厂家")
    @ApiModelProperty(value = "厂家")
    private String manu;
    /**
     * 生产日期
     */
    @ApiModelProperty(value= "生产日期")
    @ApiModelProperty(value = "生产日期")
    @TableField("manu_date")
    private String manuDate;
    /**
     * 品项数
     */
    @ApiModelProperty(value= "品项数")
    @ApiModelProperty(value = "品项数")
    @TableField("item_num")
    private String itemNum;
    /**
     * 安全库存量
     */
    @ApiModelProperty(value= "安全库存量")
    @ApiModelProperty(value = "安全库存量")
    @TableField("safe_qty")
    private Double safeQty;
    /**
     * 重量
     */
    @ApiModelProperty(value= "重量")
    @ApiModelProperty(value = "重量")
    private Double weight;
    /**
     * 长度
     */
    @ApiModelProperty(value= "长度")
    @ApiModelProperty(value = "长度")
    private Double length;
    /**
     * 体积
     */
    @ApiModelProperty(value= "体积")
    @ApiModelProperty(value = "体积")
    private Double volume;
    /**
     * 三方编码
     */
    @ApiModelProperty(value= "三方编码")
    @ApiModelProperty(value = "三方编码")
    @TableField("three_code")
    private String threeCode;
    /**
     * 供应商
     */
    @ApiModelProperty(value= "供应商")
    @ApiModelProperty(value = "供应商")
    private String supp;
    /**
     * 供应商编码
     */
    @ApiModelProperty(value= "供应商编码")
    @ApiModelProperty(value = "供应商编码")
    @TableField("supp_code")
    private String suppCode;
    /**
     * 是否批次 1: 是  0: 否
     */
    @ApiModelProperty(value= "是否批次 1: 是  0: 否  ")
    @ApiModelProperty(value = "是否批次 1: 是  0: 否  ")
    @TableField("be_batch")
    private Integer beBatch;
    /**
     * 保质期
     */
    @ApiModelProperty(value= "保质期")
    @ApiModelProperty(value = "保质期")
    @TableField("dead_time")
    private String deadTime;
    /**
     * 预警天数
     */
    @ApiModelProperty(value= "预警天数")
    @ApiModelProperty(value = "预警天数")
    @TableField("dead_warn")
    private Integer deadWarn;
    /**
     * 制购 1: 制造  2: 采购  3: 外协     、、宜科:  是否确认   1: 确认  2: 未确认
     */
    @ApiModelProperty(value= "制购 1: 制造  2: 采购  3: 外协  ")
    @ApiModelProperty(value = "制购 1: 制造  2: 采购  3: 外协  ")
    private Integer source;
    /**
     * 要求检验 1: 是  0: 否
     */
    @ApiModelProperty(value= "要求检验 1: 是  0: 否  ")
    @ApiModelProperty(value = "要求检验 1: 是  0: 否  ")
    private Integer inspect;
    /**
     * 危险品 1: 是  0: 否
     */
    @ApiModelProperty(value= "危险品 1: 是  0: 否  ")
    @ApiModelProperty(value = "危险品 1: 是  0: 否  ")
    private Integer danger;
    /**
     * 状态 1: 正常  0: 禁用
     */
    @ApiModelProperty(value= "状态 1: 正常  0: 禁用  ")
    @ApiModelProperty(value = "状态 1: 正常  0: 禁用  ")
    private Integer status;
    /**
     * 添加人员
     */
    @ApiModelProperty(value= "添加人员")
    @ApiModelProperty(value = "添加人员")
    @TableField("create_by")
    private Long createBy;
    /**
     * 添加时间
     */
    @ApiModelProperty(value= "添加时间")
    @ApiModelProperty(value = "添加时间")
    @TableField("create_time")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    /**
     * 修改人员
     */
    @ApiModelProperty(value= "修改人员")
    @ApiModelProperty(value = "修改人员")
    @TableField("update_by")
    private Long updateBy;
    /**
     * 修改时间
     */
    @ApiModelProperty(value= "修改时间")
    @ApiModelProperty(value = "修改时间")
    @TableField("update_time")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;
    /**
     * 备注
     */
    @ApiModelProperty(value= "备注")
    @ApiModelProperty(value = "备注")
    private String memo;
    @TableField("i_no")
    private Integer iNO;
    /**
     * 外部主键
@@ -311,22 +312,34 @@
    @TableField("lu_hao")
    private String luHao;
    @TableField("ware_id")
    private String wareId;
    @TableField("ware_name")
    private String wareName;
    @TableField("packing")
    private String packing;
    /**
     * 工单号
     */
    @TableField("pg_no")
    private String sPgNO;
    @TableField("temp1")
    private String temp1;
    @TableField("temp2")
    private String temp2;
    @TableField("temp3")
    private String temp3;
    @TableField("pro_type")
    private String proType;
    public OrderDetl() {}
    public OrderDetl() {
    }
    public OrderDetl(Long orderId, String orderNo, Double anfme, Double qty, String matnr, String maktx, String batch, String specs, String model, String color, String brand, String unit, Double price, String sku, Double units, String barcode, String origin, String manu, String manuDate, String itemNum, Double safeQty, Double weight, Double length, Double volume, String threeCode, String supp, String suppCode, Integer beBatch, String deadTime, Integer deadWarn, Integer source, Integer inspect, Integer danger, Integer status, Long createBy, Date createTime, Long updateBy, Date updateTime, String memo) {
        this.orderId = orderId;
@@ -370,18 +383,20 @@
        this.memo = memo;
    }
    public String getOrderId$(){
    public String getOrderId$() {
        OrderService service = SpringUtils.getBean(OrderService.class);
        Order order = service.selectById(this.orderId);
        if (!Cools.isEmpty(order)){
        if (!Cools.isEmpty(order)) {
            return String.valueOf(order.getId());
        }
        return null;
    }
    public String getBeBatch$(){
        if (null == this.beBatch){ return null; }
        switch (this.beBatch){
    public String getBeBatch$() {
        if (null == this.beBatch) {
            return null;
        }
        switch (this.beBatch) {
            case 1:
                return "是";
            case 0:
@@ -391,9 +406,11 @@
        }
    }
    public String getSource$(){
        if (null == this.source){ return null; }
        switch (this.source){
    public String getSource$() {
        if (null == this.source) {
            return null;
        }
        switch (this.source) {
            case 1:
                return "制造";
            case 2:
@@ -405,9 +422,11 @@
        }
    }
    public String getInspect$(){
        if (null == this.inspect){ return null; }
        switch (this.inspect){
    public String getInspect$() {
        if (null == this.inspect) {
            return null;
        }
        switch (this.inspect) {
            case 1:
                return "是";
            case 0:
@@ -417,9 +436,11 @@
        }
    }
    public String getDanger$(){
        if (null == this.danger){ return null; }
        switch (this.danger){
    public String getDanger$() {
        if (null == this.danger) {
            return null;
        }
        switch (this.danger) {
            case 1:
                return "是";
            case 0:
@@ -429,9 +450,11 @@
        }
    }
    public String getStatus$(){
        if (null == this.status){ return null; }
        switch (this.status){
    public String getStatus$() {
        if (null == this.status) {
            return null;
        }
        switch (this.status) {
            case 1:
                return "正常";
            case 0:
@@ -441,33 +464,33 @@
        }
    }
    public String getCreateBy$(){
    public String getCreateBy$() {
        UserService service = SpringUtils.getBean(UserService.class);
        User user = service.selectById(this.createBy);
        if (!Cools.isEmpty(user)){
        if (!Cools.isEmpty(user)) {
            return String.valueOf(user.getUsername());
        }
        return null;
    }
    public String getCreateTime$(){
        if (Cools.isEmpty(this.createTime)){
    public String getCreateTime$() {
        if (Cools.isEmpty(this.createTime)) {
            return "";
        }
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime);
    }
    public String getUpdateBy$(){
    public String getUpdateBy$() {
        UserService service = SpringUtils.getBean(UserService.class);
        User user = service.selectById(this.updateBy);
        if (!Cools.isEmpty(user)){
        if (!Cools.isEmpty(user)) {
            return String.valueOf(user.getUsername());
        }
        return null;
    }
    public String getUpdateTime$(){
        if (Cools.isEmpty(this.updateTime)){
    public String getUpdateTime$() {
        if (Cools.isEmpty(this.updateTime)) {
            return "";
        }
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime);
@@ -483,8 +506,8 @@
        return null;
    }
    public String getQty$(){
        if (getAnfme().equals(getQty())){
    public String getQty$() {
        if (getAnfme().equals(getQty())) {
            return "已完成";
        }
        return "未完成";
src/main/java/com/zy/asrs/mapper/OrderDetlMapper.java
@@ -34,4 +34,8 @@
    int increaseQtyByOrderNo(@Param("orderNo")String orderNo, @Param("matnr")String matnr, @Param("batch")String batch, @Param("qty")Double qty);
    int increaseWorkQty(@Param("orderId")Long orderId, @Param("matnr")String matnr, @Param("batch")String batch, @Param("workQty")Double workQty);
    List<OrderDetl>  listByOrderNo(@Param("orderNo") String orderNo);
}
src/main/java/com/zy/asrs/service/OrderDetlService.java
@@ -37,4 +37,6 @@
     * @return
     */
    boolean increaseWorkQty(Long orderId, String matnr, String batch, Double workQty);
    List<OrderDetl> selectItem(String orderNo);
}
src/main/java/com/zy/asrs/service/impl/OrderDetlServiceImpl.java
@@ -27,6 +27,11 @@
    }
    @Override
    public List<OrderDetl> selectItem(String orderNo) {
        return this.baseMapper.listByOrderNo(orderNo);
    }
    @Override
    public OrderDetl selectItem(Long orderId, String matnr, String batch) {
        return this.baseMapper.selectItem(orderId, matnr, batch);
    }
src/main/java/com/zy/common/service/erp/ErpSqlServer.java
@@ -1,11 +1,12 @@
package com.zy.common.service.erp;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.core.common.Cools;
import com.zy.third.erp.entity.InDetTB;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -42,14 +43,14 @@
//        sql = "update InStockBill set Fflag_finish = 1 where FBillNo = ''{0}''";
//        sql = MessageFormat.format(sql, "123456");
//        erpSqlServer.update(sql);
        HashMap<String, Object> stringStringHashMap = new HashMap<>();
        stringStringHashMap.put("BillNo","'1231312'");
        stringStringHashMap.put("test","'1231312'");
        stringStringHashMap.put("BilhahahlNo","'1231312'");
        stringStringHashMap.put("B21312illNo","'1231312'");
        stringStringHashMap.put("testnum",100);
        erpSqlServer.insert(InDetTB.class,stringStringHashMap);
        stringStringHashMap.put("BillNo", "'1231312'");
        stringStringHashMap.put("test", "'1231312'");
        stringStringHashMap.put("BilhahahlNo", "'1231312'");
        stringStringHashMap.put("B21312illNo", "'1231312'");
        stringStringHashMap.put("testnum", 100);
        erpSqlServer.insert(InDetTB.class, stringStringHashMap);
    }
    // 数据库连接
@@ -74,22 +75,42 @@
        List<T> list = new ArrayList<>();
        if (null != result) {
            for (Map<String, Object> entity : result) {
                list.add(Cools.conver(entity, cls));
                //用最笨的方法转换,也可以用下面的process方法(还没有写全)
                list.add(JSONObject.parseObject(JSONObject.toJSONString(entity), cls));
                //list.add(Cools.conver(entity, cls));
            }
        }
        return list;
    }
    @SneakyThrows
    public <T> void process(Map<String, Object> entity, Class<T> cls) {
        for (Map.Entry<String, Object> entry : entity.entrySet()) {
            String fieldName = entry.getKey();
            Object value = entry.getValue();
            Field field = cls.getDeclaredField(fieldName);
            field.setAccessible(true);
            if (value instanceof Integer && field.getType() == int.class || field.getType() == Integer.class) {
                field.setInt(cls, (Integer) value);
            } else if (value instanceof String && field.getType() == String.class) {
                field.set(cls, value);
            }
            // 其他类型可以类似处理
        }
    }
    /**
     * 扫描所有实力类属性里的TableField注解,并将里面的值作为column
     *
     * @param cls
     * @param <T>
     * @return
     */
    public <T> String selectFrontPart(Class<T> cls){
    public <T> String selectFrontPart(Class<T> cls) {
        String tableName = cls.getDeclaredAnnotation(TableName.class).value();
        List<HashMap<String,String>> columnAndField = new ArrayList<>();
        List<HashMap<String, String>> columnAndField = new ArrayList<>();
        String sql = "SELECT ";
        if (Cools.isEmpty(tableName)) {
            return null;
@@ -98,7 +119,7 @@
        for (Field f : allFields) {
            if (Modifier.isFinal(f.getModifiers())
                    || Modifier.isStatic(f.getModifiers())
                    || Modifier.isTransient(f.getModifiers())){
                    || Modifier.isTransient(f.getModifiers())) {
                continue;
            }
            String column = null;
@@ -110,16 +131,16 @@
            }
            String name = f.getName();
            HashMap<String, String> container = new HashMap<>();
            container.put(column,name);
            container.put(column, name);
            columnAndField.add(container);
        }
        for (int i = 0; i < columnAndField.size(); i++) {
            HashMap<String, String> stringStringHashMap = columnAndField.get(i);
            if (i == columnAndField.size() - 1){
            if (i == columnAndField.size() - 1) {
                for (String s : stringStringHashMap.keySet()) {
                    sql = sql + s + " AS " + stringStringHashMap.get(s);
                }
            }else {
            } else {
                for (String s : stringStringHashMap.keySet()) {
                    sql = sql + s + " AS " + stringStringHashMap.get(s) + ", ";
                }
@@ -128,40 +149,41 @@
        sql = sql + " FROM " + tableName;
        return sql;
    }
    public String addWhere(String sql, Map<String,String> condition){
    public String addWhere(String sql, Map<String, String> condition) {
        int conditionSize = 1;
        sql = sql + " WHERE ";
        for (String s : condition.keySet()) {
            if (conditionSize == condition.keySet().size()){
            if (conditionSize == condition.keySet().size()) {
                sql = sql + s + " = " + condition.get(s);
            }else {
            } else {
                sql = sql + s + " = " + condition.get(s) + " and ";
            }
            conditionSize = conditionSize + 1;
        }
        return sql;
    }
    /**
     * map的键是列名, 值等同于值
     * key: id, value: 1 等同于 WHERE id = 1
     * 如果要查询字符串需要自行加上''
     * key:name, value: 'zhs'等同于 WHERE name = 'zhs'
     *
     * @param cls
     * @param condition
     * @param <T>
     * @return
     */
    public <T> List<T> selectList(Class<T> cls, Map<String,String> condition){
    public <T> List<T> selectList(Class<T> cls, Map<String, String> condition) {
        String sql = selectFrontPart(cls);
        String finalSQL = addWhere(sql, condition);
        return select(finalSQL,cls);
    }
    public <T> List<T> selectAll(Class<T> cls){
        return select(finalSQL, cls);
    }
    public <T> List<T> selectAll(Class<T> cls) {
        String sql = selectFrontPart(cls);
        return select(sql,cls);
        return select(sql, cls);
    }
    public List<Map<String, Object>> select(String sql) {
@@ -175,7 +197,7 @@
        return executeUpdate(sql);
    }
    public <T> int delete(Class<T> cls, Map<String,String> condition) {
    public <T> int delete(Class<T> cls, Map<String, String> condition) {
        String tableName = cls.getDeclaredAnnotation(TableName.class).value();
        if (Cools.isEmpty(tableName)) {
            return 0;
@@ -184,8 +206,8 @@
        String finalSQL = addWhere(sql, condition);
        return executeUpdate(finalSQL);
    }
    public <T> int insert(Class<T> cls, Map<String,Object> condition){
    public <T> int insert(Class<T> cls, Map<String, Object> condition) {
        String tableName = cls.getDeclaredAnnotation(TableName.class).value();
        if (Cools.isEmpty(tableName)) {
            return 0;
@@ -193,9 +215,9 @@
        String sql = "INSERT INTO " + tableName + " (";
        int conditionSize = 1;
        for (String s : condition.keySet()) {
            if (conditionSize == condition.keySet().size()){
                sql = sql +s+")";
            }else {
            if (conditionSize == condition.keySet().size()) {
                sql = sql + s + ")";
            } else {
                sql = sql + s + ",";
            }
            conditionSize = conditionSize + 1;
@@ -203,25 +225,23 @@
        sql = sql + " VALUES(";
        int valuesSize = 1;
        for (String s : condition.keySet()) {
            if (valuesSize == condition.keySet().size()){
                sql = sql + condition.get(s)+")";
            }else {
            if (valuesSize == condition.keySet().size()) {
                sql = sql + condition.get(s) + ")";
            } else {
                sql = sql + condition.get(s) + ",";
            }
            valuesSize = valuesSize + 1;
        }
        return executeUpdate(sql);
    }
    /*****************************************************************************/
    /*********************************   核心层   *********************************/
    /*****************************************************************************/
    private List<Map<String, Object>> executeQuery(String sql) {
        Connection conn = null;
@@ -285,8 +305,7 @@
        Connection conn = null;
        try {
            conn = getConn();
            if(null != conn)
            {
            if (null != conn) {
                pstm = conn.prepareStatement(sql);
                pstm.setQueryTimeout(QUERY_TIMEOUT_SECONDS);
src/main/java/com/zy/third/erp/entity/InCancelTB.java
@@ -1,20 +1,18 @@
package com.zy.third.erp.entity;
import com.baomidou.mybatisplus.annotations.TableField;
import com.core.common.Cools;import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.core.common.Cools;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotations.TableName;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
@Data
@NoArgsConstructor
@@ -23,28 +21,28 @@
    private static final long serialVersionUID = 1L;
    @TableId(value = "AutoId",type = IdType.AUTO)
    @TableId(value = "AutoId", type = IdType.AUTO)
    @TableField(value = "AutoId")
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    private Integer AutoId;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableId(value = "BillNo", type = IdType.INPUT)
    @TableField("BillNo")
    private String BillNo;
    @ApiModelProperty(value= "")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("MakeDate")
    private Date MakeDate;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("LKName")
    private String LKName;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("FactArea")
    private String FactArea;
@@ -66,8 +64,8 @@
        return MakeDate;
    }
    public String getMakeDate$(){
        if (Cools.isEmpty(this.MakeDate)){
    public String getMakeDate$() {
        if (Cools.isEmpty(this.MakeDate)) {
            return "";
        }
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.MakeDate);
@@ -76,8 +74,6 @@
    public void setMakeDate(Date MakeDate) {
        this.MakeDate = MakeDate;
    }
}
src/main/java/com/zy/third/erp/entity/InDetTB.java
@@ -1,31 +1,19 @@
package com.zy.third.erp.entity;
import com.baomidou.mybatisplus.annotations.TableField;
import com.core.common.Cools;import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.core.common.Cools;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotations.TableName;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
@NoArgsConstructor
@AllArgsConstructor
@@ -39,47 +27,46 @@
    @TableId(value = "AutoId", type = IdType.AUTO)
    private Integer AutoId;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("BillNo")
    private String BillNo;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("iNo")
    private Integer iNO;
    /**
     * erp行唯一码
     */
    @ApiModelProperty(value= "erp行唯一码")
    @ApiModelProperty(value = "erp行唯一码")
    @TableField("DetId")
    private Integer detId;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("ItemId")
    private String itemid;
    private String ItemId;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("ItemCode")
    private String ItemCode;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("ItemBatch")
    private String ItemBatch;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("proType")
    private String protype;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("OrderNo")
    private String OrderNo;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("MainNum")
    private Double MainNum;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("remark")
    private String remark;
@@ -89,165 +76,61 @@
    @TableField("WareName")
    private String WareName;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("temp1")
    private String temp1;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("temp2")
    private String temp2;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("temp3")
    private String temp3;
    @ApiModelProperty(value= "")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("MakeDate")
    private Date makedate;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("LKName")
    private String LKName;
    /**
     *
     */
    @TableField("FactArea")
    private String FactArea;
    /**
     * 供应商\客户ID
     */
    @TableField("Packing")
    private String Packing;
    /**
     * 颜色
     */
    @TableField("sColor")
    private String sColor;
    /**
     * 炉号\客户图号
     */
    @TableField("LuHao")
    private String LuHao;
    /**
     * 工单号
     */
    @TableField("sPgNO")
    private String sPgNO;
//    InDetTB inDetTB = new InDetTB(
//            null,    // [非空]
//            null,    // [非空]
//            null,    // erp行唯一码[非空]
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null    //
//    );
    public String getBillNo() {
        return BillNo;
    }
    public void setBillNo(String BillNo) {
        this.BillNo = BillNo;
    }
    public Integer getINO() {
        return iNO;
    }
    public void setINO(Integer iNO) {
        this.iNO = iNO;
    }
    public Integer getDetId() {
        return detId;
    }
    public void setDetId(Integer detId) {
        this.detId = detId;
    }
    public String getItemid() {
        return itemid;
    }
    public void setItemid(String itemid) {
        this.itemid = itemid;
    }
    public String getItemCode() {
        return ItemCode;
    }
    public void setItemCode(String ItemCode) {
        this.ItemCode = ItemCode;
    }
    public String getItemBatch() {
        return ItemBatch;
    }
    public void setItemBatch(String ItemBatch) {
        this.ItemBatch = ItemBatch;
    }
    public String getProtype() {
        return protype;
    }
    public void setProtype(String protype) {
        this.protype = protype;
    }
    public Double getMainNum() {
        return MainNum;
    }
    public void setMainNum(Double MainNum) {
        this.MainNum = MainNum;
    }
    public String getOrderNo() {
        return OrderNo;
    }
    public void setOrderNo(String OrderNo) {
        this.OrderNo = OrderNo;
    }
    public Date getMakedate() {
        return makedate;
    }
    public String getMakedate$(){
        if (Cools.isEmpty(this.makedate)){
    public String getMakedate$() {
        if (Cools.isEmpty(this.makedate)) {
            return "";
        }
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.makedate);
    }
    public void setMakedate(Date makedate) {
        this.makedate = makedate;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public String getTemp1() {
        return temp1;
    }
    public void setTemp1(String temp1) {
        this.temp1 = temp1;
    }
    public String getTemp2() {
        return temp2;
    }
    public void setTemp2(String temp2) {
        this.temp2 = temp2;
    }
    public String getTemp3() {
        return temp3;
    }
    public void setTemp3(String temp3) {
        this.temp3 = temp3;
    }
src/main/java/com/zy/third/erp/entity/InHedTB.java
@@ -1,26 +1,14 @@
package com.zy.third.erp.entity;
import com.baomidou.mybatisplus.annotations.TableField;
import com.core.common.Cools;import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import java.text.SimpleDateFormat;
import java.util.Date;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotations.TableName;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName("erp_InHedTB")
@@ -32,22 +20,21 @@
    @TableId(value = "AutoId", type = IdType.AUTO)
    private Integer AutoId;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableId(value = "BillNo", type = IdType.INPUT)
    @TableField("BillNo")
    private String BillNo;
    /**
     * StockIn:采购入库
ProductIn:成品入库单
ItemMoveIn:调拨入库
ItemSwitchIn:形态转换入库
CheckMoreIn:盘盈入库单
     * ProductIn:成品入库单
     * ItemMoveIn:调拨入库
     * ItemSwitchIn:形态转换入库
     * CheckMoreIn:盘盈入库单
     */
//    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @TableField("BillDate")
    private String billDate;
    private Date BillDate;
    @TableField("IoKindID")
    private String IoKindID;
@@ -58,18 +45,18 @@
    /**
     * 供应商、部门ID
     */
    @ApiModelProperty(value= "供应商、部门ID")
    @ApiModelProperty(value = "供应商、部门ID")
    @TableField("ObjectId")
    private String OjectId;
    private String ObjectId;
    /**
     * 供应商、部门名称
     */
    @TableField("ObjectName")
    @ApiModelProperty(value= "供应商、部门名称")
    private String OjbectName;
    @ApiModelProperty(value = "供应商、部门名称")
    private String ObjectName;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("Remark")
    private String remark;
@@ -79,128 +66,33 @@
    @TableField("WareName")
    private String wareName;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("Temp1")
    private String Temp1;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("Temp2")
    private String Temp2;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("Temp3")
    private String Temp3;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
//    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @TableField("MakeDate")
    private String makedate;
    private Date MakeDate;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("LKName")
    private String LKName;
//    InHedTB inHedTB = new InHedTB(
//            null,    // [非空]
//            null,    // StockIn:采购入库
//            null,    // 供应商、部门ID
//            null,    // 供应商、部门名称
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null    //
//    );
    public String getBillNo() {
        return BillNo;
    }
    public void setBillNo(String BillNo) {
        this.BillNo = BillNo;
    }
    public String getIoKindID() {
        return IoKindID;
    }
    public void setIoKindID(String IoKindID) {
        this.IoKindID = IoKindID;
    }
    public String getOjectId() {
        return OjectId;
    }
    public void setOjectId(String OjectId) {
        this.OjectId = OjectId;
    }
    public String getOjbectName() {
        return OjbectName;
    }
    public void setOjbectName(String OjbectName) {
        this.OjbectName = OjbectName;
    }
    public String getMakedate() {
        return makedate;
    }
    public void setMakedate(String makedate) {
        this.makedate = makedate;
    }
//    public Date getMakedate() {
//        return makedate;
//    }
//
//    public String getMakedate$(){
//        if (Cools.isEmpty(this.makedate)){
//            return "";
//        }
//        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.makedate);
//    }
//
//    public void setMakedate(Date makedate) {
//        this.makedate = makedate;
//    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public String getTemp1() {
        return Temp1;
    }
    public void setTemp1(String Temp1) {
        this.Temp1 = Temp1;
    }
    public String getTemp2() {
        return Temp2;
    }
    public void setTemp2(String Temp2) {
        this.Temp2 = Temp2;
    }
    public String getTemp3() {
        return Temp3;
    }
    public void setTemp3(String Temp3) {
        this.Temp3 = Temp3;
    }
    /**
     *
     */
    @TableField("FactArea")
    private String FactArea;
}
src/main/java/com/zy/third/erp/entity/ItemTB.java
@@ -1,19 +1,18 @@
package com.zy.third.erp.entity;
import com.baomidou.mybatisplus.annotations.TableField;
import com.core.common.Cools;import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.core.common.Cools;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import com.baomidou.mybatisplus.annotations.TableName;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
@Data
@NoArgsConstructor
@@ -25,208 +24,77 @@
    @TableId(value = "AutoId", type = IdType.AUTO)
    private Integer AutoId;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableId(value = "ItemId", type = IdType.INPUT)
    @TableField("ItemId")
    private String ItemId;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("ItemCode")
    private String ItemCode;
    @TableField("ItemName")
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    private String ItemName;
    @TableField("ItemSpc")
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    private String ItemSpc;
    @TableField("ItemPic")
    private String itemPic;
    @TableField("ItemUnit")
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    private String ItemUnit;
    /**
     * 毛坯、半成品、成品
     */
    @TableField("ItemKind")
    @ApiModelProperty(value= "毛坯、半成品、成品")
    @ApiModelProperty(value = "毛坯、半成品、成品")
    private String ItemKind;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("Remark")
    private String Remark;
    /**
     * 00:新增  22:删除
     */
    @ApiModelProperty(value= "00:新增  22:删除")
    @ApiModelProperty(value = "00:新增  22:删除")
    @TableField("Flag")
    private String Flag;
    @ApiModelProperty(value= "")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss.fff")
    @ApiModelProperty(value = "")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss.fff")
    @TableField("MakeDate")
    private Date MakeDate;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("Temp1")
    private String Temp1;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("Temp2")
    private String Temp2;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("Temp3")
    private String Temp3;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("LKName")
    private String LKName;
    /**
     * 订单号
     */
    @TableField("order_no")
    private String orderNo;
    /**
     * 炉号\客户图号
     */
    @TableField("lu_hao")
    private String luHao;
    /**
     * 工单号
     */
    @TableField("pg_no")
    private String sPgNO;
//    ItemTB itemTB = new ItemTB(
//            null,    // [非空]
//            null,    // [非空]
//            null,    // [非空]
//            null,    //
//            null,    // [非空]
//            null,    // 毛坯、半成品、成品
//            null,    //
//            null,    // 00:新增  22:删除
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null    //
//    );
    public String getItemId() {
        return ItemId;
    }
    public void setItemId(String ItemID) {
        this.ItemId = ItemID;
    }
    public String getItemCode() {
        return ItemCode;
    }
    public void setItemCode(String ItemCode) {
        this.ItemCode = ItemCode;
    }
    public String getItemName() {
        return ItemName;
    }
    public void setItemName(String ItemName) {
        this.ItemName = ItemName;
    }
    public String getItemSpc() {
        return ItemSpc;
    }
    public void setItemSpc(String ItemSpc) {
        this.ItemSpc = ItemSpc;
    }
    public String getItemUnit() {
        return ItemUnit;
    }
    public void setItemUnit(String ItemUnit) {
        this.ItemUnit = ItemUnit;
    }
    public String getItemKind() {
        return ItemKind;
    }
    public void setItemKind(String ItemKind) {
        this.ItemKind = ItemKind;
    }
    public String getRemark() {
        return Remark;
    }
    public void setRemark(String remark) {
        this.Remark = remark;
    }
    public String getFlag() {
        return Flag;
    }
    public void setFlag(String flag) {
        this.Flag = flag;
    }
    public Date getMakeDate() {
        return MakeDate;
    }
    public String getMakedate$(){
        if (Cools.isEmpty(this.MakeDate)){
    public String getMakedate$() {
        if (Cools.isEmpty(this.MakeDate)) {
            return "";
        }
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.MakeDate);
    }
    public void setMakeDate(Date makeDate) {
        this.MakeDate = makeDate;
    }
    public String getTemp1() {
        return Temp1;
    }
    public void setTemp1(String temp1) {
        this.Temp1 = temp1;
    }
    public String getTemp2() {
        return Temp2;
    }
    public void setTemp2(String temp2) {
        this.Temp2 = temp2;
    }
    public String getTemp3() {
        return Temp3;
    }
    public void setTemp3(String temp3) {
        this.Temp3 = temp3;
    }
}
src/main/java/com/zy/third/erp/entity/OutCancelTB.java
New file
@@ -0,0 +1,47 @@
package com.zy.third.erp.entity;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import com.core.common.Cools;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
@Data
@TableName("erp_OutCancelTB")
public class OutCancelTB implements Serializable {
    private static final long serialVersionUID = 1L;
    @TableId(value = "AutoId", type = IdType.AUTO)
    private Integer AutoId;
    @ApiModelProperty(value = "")
    @TableField("BillNo")
    private String BillNo;
    @ApiModelProperty(value = "")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("MakeDate")
    private Date MakeDate;
    @ApiModelProperty(value = "")
    @TableField("LKName")
    private String LKName;
    public String getMakedate$() {
        if (Cools.isEmpty(this.MakeDate)) {
            return "";
        }
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.MakeDate);
    }
}
src/main/java/com/zy/third/erp/entity/OutDetTB.java
New file
@@ -0,0 +1,132 @@
package com.zy.third.erp.entity;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import com.core.common.Cools;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("erp_OutDetTB")
public class OutDetTB implements Serializable {
    private static final long serialVersionUID = 1L;
    @TableId(value = "AutoId", type = IdType.AUTO)
    private Integer AutoId;
    @ApiModelProperty(value = "")
    @TableField("BillNo")
    private String BillNo;
    @ApiModelProperty(value = "")
    @TableField("iNo")
    private Integer iNO;
    @ApiModelProperty(value = "")
    @TableField("DetId")
    private Integer detId;
    @ApiModelProperty(value = "")
    @TableField("ItemId")
    private String ItemId;
    @ApiModelProperty(value = "")
    @TableField("ItemCode")
    private String ItemCode;
    @ApiModelProperty(value = "")
    @TableField("ItemBatch")
    private String ItemBatch;
    @ApiModelProperty(value = "")
    @TableField("proType")
    private String proType;
    @ApiModelProperty(value = "")
    @TableField("OrderNo")
    private String OrderNo;
    @ApiModelProperty(value = "")
    @TableField("MainNum")
    private Double MainNum;
    @TableField("remark")
    private String remark;
    @TableField("WareId")
    private String wareId;
    @TableField("WareName")
    private String wareName;
    @ApiModelProperty(value = "")
    private String temp1;
    @ApiModelProperty(value = "")
    private String temp2;
    @ApiModelProperty(value = "")
    private String temp3;
    @ApiModelProperty(value = "")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("MakeDate")
    private Date makedate;
//    @ApiModelProperty(value= "")
//    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
//    @TableField("DelDate")
//    private Date delDate;
    @ApiModelProperty(value = "")
    @TableField("LKName")
    private String LKName;
    @TableField("FactArea")
    private String FactArea;
    /**
     * 供应商\客户ID
     */
    @TableField("Packing")
    private String Packing;
    /**
     * 颜色
     */
    @TableField("sColor")
    private String sColor;
    /**
     * 炉号\客户图号
     */
    @TableField("LuHao")
    private String LuHao;
    /**
     * 工单号
     */
    @TableField("sPgNO")
    private String sPgNO;
    public String getMakedate$() {
        if (Cools.isEmpty(this.makedate)) {
            return "";
        }
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.makedate);
    }
}
src/main/java/com/zy/third/erp/entity/OutHedTB.java
New file
@@ -0,0 +1,100 @@
package com.zy.third.erp.entity;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("erp_OutHedTB")
public class OutHedTB implements Serializable {
    private static final long serialVersionUID = 1L;
    @TableId(value = "AutoId", type = IdType.AUTO)
    private Integer AutoId;
    @ApiModelProperty(value = "")
    @TableId(value = "BillNo", type = IdType.INPUT)
    @TableField("BillNo")
    private String BillNo;
    @TableField("BillDate")
//    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date BillDate;
    /**
     * SendMatOut:发料出库
     * OtherOut:其它出库单
     * ItemMoveOut:调拨出库
     * ItemSwitchOut:形态转换出库
     * CheckLossOut:盘盈出库单
     */
    @ApiModelProperty(value = "SendMatOut:发料出库 ")
    @TableField("IoKindID")
    private String IoKindID;
    @TableField("IoKindName")
    private String ioKindName;
    /**
     * 部门ID
     */
    @ApiModelProperty(value = "部门ID")
    @TableField("ObjectId")
    private String ObjectId;
    /**
     * 部门名称
     */
    @ApiModelProperty(value = "部门名称")
    @TableField("ObjectName")
    private String ObjectName;
    @ApiModelProperty(value = "")
    @TableField("Remark")
    private String remark;
    @TableField("WareId")
    private String wareId;
    @TableField("WareName")
    private String wareName;
    @ApiModelProperty(value = "")
    @TableField("Temp1")
    private String Temp1;
    @ApiModelProperty(value = "")
    @TableField("Temp2")
    private String Temp2;
    @ApiModelProperty(value = "")
    @TableField("Temp3")
    private String Temp3;
    @ApiModelProperty(value = "")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("MakeDate")
    private Date MakeDate;
    @ApiModelProperty(value = "")
    @TableField("LKName")
    private String LKName;
    @TableField("FactArea")
    private String FactArea;
}
src/main/java/com/zy/third/erp/task/ERPInCancelScheduler.java
@@ -7,6 +7,7 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
@@ -19,11 +20,13 @@
    private Boolean erpEnabled;
    @Autowired
    private ERPInCancelSchedulerMS inMS;
    private ERPInOrOutCancelService inMS;
    @Autowired
    private ErpSqlServer erpSqlServer;
    @Transactional(rollbackFor = Throwable.class)
    @Scheduled(cron = "${erp.refreshtime}")
    public void InCancelScheduler() {
        log.info("InCancelScheduler开始了");
@@ -32,15 +35,25 @@
        List<InCancelTB> ins = erpSqlServer.select(sqlInCancelTB, InCancelTB.class);
        for (InCancelTB in : ins) {
            System.out.println(in);
            com.zy.third.lk.entity.InCancelTB lkCancel = inMS.tryCancel(in);
            com.zy.third.lk.entity.InCancelTB lkCancel = inMS.tryCancel(in.getBillNo());
            if (lkCancel != null) {
                HashMap<String, String> condition = new HashMap<>();
                condition.put("BillNo", "'" + in.getBillNo() + "'");
                erpSqlServer.delete(InCancelTB.class, condition);
                int delete = erpSqlServer.delete(InCancelTB.class, condition);
                if (delete > 0) {
                    log.info("将入库取消通知单删除成功,{}", lkCancel.getBillNo());
                } else {
                    log.error("将入库取消通知单删除失败,{}", lkCancel.getBillNo());
                }
                HashMap<String, Object> content = new HashMap<>();
                content.put("BillNo", "'" + lkCancel.getBillNo() + "'");
                content.put("opFlag", lkCancel.getOpFlag());
                erpSqlServer.insert(com.zy.third.lk.entity.InCancelTB.class, content);
                int insert = erpSqlServer.insert(com.zy.third.lk.entity.InCancelTB.class, content);
                if (insert > 0) {
                    log.info("将入库取消通知单写入成功,{}", lkCancel.getBillNo());
                } else {
                    log.error("将入库取消通知单写入失败,{}", lkCancel.getBillNo());
                }
            } else {
                log.error("将入库取消通知单写入失败");
            }
src/main/java/com/zy/third/erp/task/ERPInCancelSchedulerMS.java
File was deleted
src/main/java/com/zy/third/erp/task/ERPInHedTBScheduler.java
@@ -26,19 +26,21 @@
    @Autowired
    private ERPInOrOutTBSchedulerMS inMS;
    private ERPInOrOutService inMS;
    @Autowired
    private ErpSqlServer erpSqlServer;
    @Transactional(rollbackFor = Throwable.class)
    @Scheduled(cron = "${erp.refreshtime}")
    public void InHedTBScheduler() {
        log.info("InHedTBScheduler开始了");
        if (!erpEnabled) return;
        String sqlInHed = "select * from erp_InHedTB where LKName='中扬二期'";
        List<InHedTB> inHeds = erpSqlServer.select(sqlInHed, InHedTB.class);
        if (inHeds.size() > 0) {
        if (!inHeds.isEmpty()) {
            for (InHedTB inHed : inHeds) {
                System.out.println(inHed);
                HashMap<String, String> condition = new HashMap<>();
@@ -47,7 +49,7 @@
                HashMap<String, Object> hedAndDet = new HashMap<>();
                hedAndDet.put("hed", inHed);
                hedAndDet.put("det", inDetTBS);
                boolean result = inMS.createOrder(inHed, inDetTBS);
                boolean result = inMS.createInOrder(inHed, inDetTBS);
                if (result) {
                    move(hedAndDet);
                } else {
@@ -58,7 +60,8 @@
        }
    }
    @Transactional
    @Transactional(rollbackFor = Throwable.class)
    public void move(HashMap<String, Object> hedAndDet) {
        InHedTB hed = (InHedTB) hedAndDet.get("hed");
        ArrayList<InDetTB> dets = (ArrayList<InDetTB>) hedAndDet.get("det");
@@ -71,7 +74,6 @@
            condition2.put("BillNo", "'" + det.getBillNo() + "'");
            condition2.put("iNo", String.valueOf(det.getINO()));
            erpSqlServer.delete(InDetTB.class, condition2);
        }
    }
src/main/java/com/zy/third/erp/task/ERPInOrOutCancelService.java
New file
@@ -0,0 +1,66 @@
package com.zy.third.erp.task;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.zy.asrs.entity.Order;
import com.zy.asrs.entity.OrderDetl;
import com.zy.asrs.service.OrderDetlService;
import com.zy.asrs.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.List;
import java.util.Optional;
@Slf4j
@Component
public class ERPInOrOutCancelService {
    @Autowired
    private OrderService orderService;
    @Autowired
    private OrderDetlService orderDetlService;
    public com.zy.third.lk.entity.InCancelTB tryCancel(String orderNo) {
        com.zy.third.lk.entity.InCancelTB lkCancel = new com.zy.third.lk.entity.InCancelTB();
        List<Order> targets = orderService.selectList(new EntityWrapper<Order>()
                .eq("order_no",orderNo));
        log.info("要取消的订单:{}", targets);
        if (targets.isEmpty()) {
            lkCancel.setBillNo(orderNo);
            //erp方要求,订单找不到,返回1
            lkCancel.setOpFlag(1);
            lkCancel.setMakeDate(new Date());
            return lkCancel;
        } else {
            //默认订单id不能重复
            Order order = targets.get(0);
            List<OrderDetl> detlList = orderDetlService.selectItem(order.getOrderNo());
            log.info("要取消的订单详情:{}", detlList);
            Optional<OrderDetl> any = detlList.stream().filter(s -> s.getQty().compareTo(0D) > 0).findAny();
            if (order.getSettle() > 1L || any.isPresent()) {
                lkCancel.setBillNo(orderNo);
                lkCancel.setOpFlag(2);
                lkCancel.setMakeDate(new Date());
                return lkCancel;
            }
            orderService.addToLogTable(order);
            orderService.delete(new EntityWrapper<Order>()
                    .eq("order_no", order.getOrderNo()));
            detlList.stream().forEach(d -> orderDetlService.addToLogTable(d));
            orderDetlService.delete(new EntityWrapper<OrderDetl>()
                    .eq("order_no", order.getOrderNo()));
            lkCancel.setBillNo(orderNo);
            lkCancel.setOpFlag(1);
            lkCancel.setMakeDate(new Date());
            return lkCancel;
        }
    }
}
src/main/java/com/zy/third/erp/task/ERPInOrOutService.java
New file
@@ -0,0 +1,240 @@
package com.zy.third.erp.task;
import com.core.common.Cools;
import com.core.common.DateUtils;
import com.core.common.SnowflakeIdWorker;
import com.core.exception.CoolException;
import com.zy.asrs.entity.DocType;
import com.zy.asrs.entity.Mat;
import com.zy.asrs.entity.Order;
import com.zy.asrs.entity.OrderDetl;
import com.zy.asrs.service.DocTypeService;
import com.zy.asrs.service.MatService;
import com.zy.asrs.service.OrderDetlService;
import com.zy.asrs.service.OrderService;
import com.zy.third.erp.entity.InDetTB;
import com.zy.third.erp.entity.InHedTB;
import com.zy.third.erp.entity.OutDetTB;
import com.zy.third.erp.entity.OutHedTB;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
@Slf4j
@Component
public class ERPInOrOutService {
    @Autowired
    private OrderService orderService;
    @Autowired
    private OrderDetlService orderDetlService;
    @Autowired
    private SnowflakeIdWorker snowflakeIdWorker;
    @Autowired
    private DocTypeService docTypeService;
    @Autowired
    private MatService matService;
    /**
     * @return
     */
    @Transactional(rollbackFor = Throwable.class)
    public boolean createInOrder(InHedTB inHedTB, List<InDetTB> inDetTBs) {
        Order order = orderService.selectByNo(inHedTB.getBillNo());
        // 如果单据不存在则添加;如果单据存在,作业中无法修改,反之则修改单据
        if (!Cools.isEmpty(order)) {
            if (order.getSettle() > 1L) {
                throw new CoolException(inHedTB.getBillNo() + "正在出库,无法修改单据");
            }
            orderService.remove(order.getId());
        }
        DocType docType = docTypeService.selectOrAdd(inHedTB.getIoKindID(), Boolean.FALSE);
        Date now = new Date();
        // 单据主档
        order = new Order(
                String.valueOf(snowflakeIdWorker.nextId()),    // 编号[非空]
                inHedTB.getBillNo(),    // 订单编号
                DateUtils.convert(inHedTB.getBillDate()),    // 单据日期
                docType.getDocId(),    // 单据类型
                null,    // 项目编号
                null,    //
                null,    // 调拨项目编号
                null,    // 初始票据号
                null,    // 票据号
                inHedTB.getObjectId(),    // 客户编号
                inHedTB.getObjectName(),    // 客户
                null,    // 联系方式
                null,    // 操作人员
                null,    // 合计金额
                null,    // 优惠率
                null,    // 优惠金额
                null,    // 销售或采购费用合计
                null,    // 实付金额
                null,    // 付款类型
                null,    // 业务员
                null,    // 结算天数
                null,    // 邮费支付类型
                null,    // 邮费
                null,    // 付款时间
                null,    // 发货时间
                null,    // 物流名称
                null,    // 物流单号
                1L,    // 订单状态
                1,    // 状态
                9527L,    // 添加人员
                now,    // 添加时间
                9527L,    // 修改人员
                inHedTB.getMakeDate(),    // 修改时间
                inHedTB.getRemark()    // 备注
        );
        if (!orderService.insert(order)) {
            throw new CoolException("生成单据主档失败,请联系管理员");
        }
        for (InDetTB outDetTB : inDetTBs) {
            Mat mat = matService.selectByMatnr(outDetTB.getItemCode());
            if (Cools.isEmpty(mat)) {
                throw new CoolException(outDetTB.getItemCode() + "编号商品检索失败,请先添加商品");
            }
            OrderDetl orderDetl = new OrderDetl();
            orderDetl.sync(mat);
            orderDetl.setOrderNo(outDetTB.getBillNo());
            orderDetl.setOutOrderNo(outDetTB.getOrderNo());
            orderDetl.setAutoId(outDetTB.getAutoId());
            orderDetl.setLuHao(outDetTB.getLuHao());
            orderDetl.setSpecs(outDetTB.getSPgNO());
            orderDetl.setPacking(outDetTB.getPacking());
            orderDetl.setWareId(outDetTB.getWareId());
            orderDetl.setWareName(outDetTB.getWareName());
            orderDetl.setBatch(outDetTB.getItemBatch());
            orderDetl.setAnfme(outDetTB.getMainNum());
            orderDetl.setINO(outDetTB.getINO());
            orderDetl.setOrderId(order.getId());
            orderDetl.setTemp1(outDetTB.getTemp1());
            orderDetl.setTemp2(outDetTB.getTemp2());
            orderDetl.setTemp3(outDetTB.getTemp3());
            orderDetl.setOrderNo(order.getOrderNo());
            orderDetl.setThreeCode(outDetTB.getDetId() + "");
            orderDetl.setCreateBy(9527L);
            orderDetl.setCreateTime(now);
            orderDetl.setUpdateBy(9527L);
            orderDetl.setUpdateTime(now);
            orderDetl.setStatus(1);
            orderDetl.setQty(0.0D);
            if (!orderDetlService.insert(orderDetl)) {
                throw new CoolException("生成单据明细失败,请联系管理员");
            }
        }
        return true;
    }
    /**
     * @return
     */
    @Transactional(rollbackFor = Throwable.class)
    public boolean createOutOrder(OutHedTB inHedTB, List<OutDetTB> inDetTBs) {
        Order order = orderService.selectByNo(inHedTB.getBillNo());
        // 如果单据不存在则添加;如果单据存在,作业中无法修改,反之则修改单据
        if (!Cools.isEmpty(order)) {
            if (order.getSettle() > 1L) {
                throw new CoolException(inHedTB.getBillNo() + "正在出库,无法修改单据");
            }
            orderService.remove(order.getId());
        }
        DocType docType = docTypeService.selectOrAdd(inHedTB.getIoKindID(), Boolean.FALSE);
        Date now = new Date();
        // 单据主档
        order = new Order(
                String.valueOf(snowflakeIdWorker.nextId()),    // 编号[非空]
                inHedTB.getBillNo(),    // 订单编号
                DateUtils.convert(inHedTB.getBillDate()),    // 单据日期
                docType.getDocId(),    // 单据类型
                null,    // 项目编号
                null,    //
                null,    // 调拨项目编号
                null,    // 初始票据号
                null,    // 票据号
                inHedTB.getObjectId(),    // 客户编号
                inHedTB.getObjectName(),    // 客户
                null,    // 联系方式
                null,    // 操作人员
                null,    // 合计金额
                null,    // 优惠率
                null,    // 优惠金额
                null,    // 销售或采购费用合计
                null,    // 实付金额
                null,    // 付款类型
                null,    // 业务员
                null,    // 结算天数
                null,    // 邮费支付类型
                null,    // 邮费
                null,    // 付款时间
                null,    // 发货时间
                null,    // 物流名称
                null,    // 物流单号
                1L,    // 订单状态
                1,    // 状态
                9527L,    // 添加人员
                now,    // 添加时间
                9527L,    // 修改人员
                inHedTB.getMakeDate(),    // 修改时间
                inHedTB.getRemark()    // 备注
        );
        if (!orderService.insert(order)) {
            throw new CoolException("生成单据主档失败,请联系管理员");
        }
        for (OutDetTB outDetTB : inDetTBs) {
            Mat mat = matService.selectByMatnr(outDetTB.getItemCode());
            if (Cools.isEmpty(mat)) {
                throw new CoolException(outDetTB.getItemCode() + "编号商品检索失败,请先添加商品");
            }
            OrderDetl orderDetl = new OrderDetl();
            orderDetl.sync(mat);
            orderDetl.setOrderNo(outDetTB.getBillNo());
            orderDetl.setOutOrderNo(outDetTB.getOrderNo());
            orderDetl.setAutoId(outDetTB.getAutoId());
            orderDetl.setLuHao(outDetTB.getLuHao());
            orderDetl.setSpecs(outDetTB.getSPgNO());
            orderDetl.setPacking(outDetTB.getPacking());
            orderDetl.setWareId(outDetTB.getWareId());
            orderDetl.setWareName(outDetTB.getWareName());
            orderDetl.setBatch(outDetTB.getItemBatch());
            orderDetl.setAnfme(outDetTB.getMainNum());
            orderDetl.setINO(outDetTB.getINO());
            orderDetl.setOrderId(order.getId());
            orderDetl.setTemp1(outDetTB.getTemp1());
            orderDetl.setTemp2(outDetTB.getTemp2());
            orderDetl.setTemp3(outDetTB.getTemp3());
            orderDetl.setOrderNo(order.getOrderNo());
            orderDetl.setThreeCode(outDetTB.getDetId() + "");
            orderDetl.setCreateBy(9527L);
            orderDetl.setCreateTime(now);
            orderDetl.setUpdateBy(9527L);
            orderDetl.setUpdateTime(now);
            orderDetl.setStatus(1);
            orderDetl.setQty(0.0D);
            if (!orderDetlService.insert(orderDetl)) {
                throw new CoolException("生成单据明细失败,请联系管理员");
            }
        }
        return true;
    }
}
src/main/java/com/zy/third/erp/task/ERPInOrOutTBSchedulerMS.java
File was deleted
src/main/java/com/zy/third/erp/task/ERPItemScheduler.java
@@ -7,6 +7,7 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@@ -20,11 +21,14 @@
    private Boolean erpEnabled;
    @Autowired
    private ERPItemSchedulerMS erpItemSchedulerMS;
    private ERPItemService erpItemService;
    @Autowired
    private ErpSqlServer erpSqlServer;
    @Transactional(rollbackFor = Throwable.class)
    @Scheduled(cron = "${erp.refreshtime}")
    public void ItemScheduler() {
        log.info("ItemScheduler开始了");
@@ -36,11 +40,11 @@
                System.out.println(itemTB);
                //00代表新增
                if (itemTB.getFlag().equals("00")) {
                    erpItemSchedulerMS.addToMainDatabase(itemTB);
                    erpItemService.addToMainDatabase(itemTB);
                }
                //22代表删除
                if (itemTB.getFlag().equals("22")) {
                    erpItemSchedulerMS.deleteFromMainDatabase(itemTB);
                    erpItemService.deleteFromMainDatabase(itemTB);
                }
                moveToBak(itemTB);
            }
src/main/java/com/zy/third/erp/task/ERPItemService.java
File was renamed from src/main/java/com/zy/third/erp/task/ERPItemSchedulerMS.java
@@ -20,7 +20,7 @@
@Slf4j
@Component
public class ERPItemSchedulerMS {
public class ERPItemService {
    @Autowired
    private MatService matService;
@@ -98,20 +98,16 @@
    }
    private Mat sync(Mat mat, ItemTB itemTB) {
        mat.setThreeCode(itemTB.getItemId());
        mat.setUuid(itemTB.getItemId());
        mat.setMatnr(itemTB.getItemCode());
        mat.setMaktx(itemTB.getItemName());
        mat.setSpecs(itemTB.getItemSpc());
        mat.setUnit(itemTB.getItemUnit());
        mat.setMemo(itemTB.getRemark());
        mat.setCreateTime(itemTB.getMakeDate());
        mat.setAutoId(itemTB.getAutoId());
        mat.setTemp1(itemTB.getTemp1());
        mat.setTemp2(itemTB.getTemp2());
        mat.setTemp3(itemTB.getTemp3());
        mat.setLuHao(itemTB.getLuHao());
        mat.setSPgNO(itemTB.getSPgNO());
        mat.setOutOrderNo(itemTB.getOrderNo());
        return mat;
    }
@@ -122,7 +118,7 @@
     */
    protected void deleteFromMainDatabase(ItemTB itemTB) {
        EntityWrapper<Mat> matCodeEntityWrapper = new EntityWrapper<>();
        matCodeEntityWrapper.eq("matnr", itemTB.getItemId());
        matCodeEntityWrapper.eq("matnr", itemTB.getItemCode());
        matMapper.delete(matCodeEntityWrapper);
    }
src/main/java/com/zy/third/erp/task/ERPOutCancelScheduler.java
New file
@@ -0,0 +1,63 @@
package com.zy.third.erp.task;
import com.zy.common.service.erp.ErpSqlServer;
import com.zy.third.erp.entity.InCancelTB;
import com.zy.third.erp.entity.OutCancelTB;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
@Slf4j
@Component
public class ERPOutCancelScheduler {
    @Value("${erp.enabled}")
    private Boolean erpEnabled;
    @Autowired
    private ERPInOrOutCancelService inMS;
    @Autowired
    private ErpSqlServer erpSqlServer;
    @Transactional(rollbackFor = Throwable.class)
    @Scheduled(cron = "${erp.refreshtime}")
    public void InCancelScheduler() {
        log.info("InCancelScheduler开始了");
        if (!erpEnabled) return;
        String sqlInCancelTB = "select * from erp_OutCancelTB where LKName='中扬二期'";
        List<OutCancelTB> ins = erpSqlServer.select(sqlInCancelTB, OutCancelTB.class);
        for (OutCancelTB in : ins) {
            System.out.println(in);
            com.zy.third.lk.entity.InCancelTB lkCancel = inMS.tryCancel(in.getBillNo());
            if (lkCancel != null) {
                HashMap<String, String> condition = new HashMap<>();
                condition.put("BillNo", "'" + in.getBillNo() + "'");
                int delete = erpSqlServer.delete(InCancelTB.class, condition);
                if (delete > 0) {
                    log.info("将入库取消通知单删除成功,{}", lkCancel.getBillNo());
                } else {
                    log.error("将入库取消通知单删除失败,{}", lkCancel.getBillNo());
                }
                HashMap<String, Object> content = new HashMap<>();
                content.put("BillNo", "'" + lkCancel.getBillNo() + "'");
                content.put("opFlag", lkCancel.getOpFlag());
                int insert = erpSqlServer.insert(com.zy.third.lk.entity.InCancelTB.class, content);
                if (insert > 0) {
                    log.info("将入库取消通知单写入成功,{}", lkCancel.getBillNo());
                } else {
                    log.error("将入库取消通知单写入失败,{}", lkCancel.getBillNo());
                }
            } else {
                log.error("将入库取消通知单写入失败");
            }
        }
    }
}
src/main/java/com/zy/third/erp/task/ERPOutHedTBScheduler.java
@@ -1,8 +1,8 @@
package com.zy.third.erp.task;
import com.zy.common.service.erp.ErpSqlServer;
import com.zy.third.erp.entity.InDetTB;
import com.zy.third.erp.entity.InHedTB;
import com.zy.third.erp.entity.OutDetTB;
import com.zy.third.erp.entity.OutHedTB;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -16,7 +16,8 @@
/**
 * 入库单据
 */@Slf4j
 */
@Slf4j
@Component
public class ERPOutHedTBScheduler {
@@ -25,28 +26,30 @@
    @Autowired
    private ERPInOrOutTBSchedulerMS inMS;
    private ERPInOrOutService inMS;
    @Autowired
    private ErpSqlServer erpSqlServer;
    @Transactional(rollbackFor = Throwable.class)
    @Scheduled(cron = "${erp.refreshtime}")
    public void OutHedTBScheduler() {
        log.info("OutHedTBScheduler开始了");
        if (!erpEnabled) return;
        String sqlInHed = "select * from erp_OutHedTB where LKName='中扬二期'";
        List<InHedTB> inHeds = erpSqlServer.select(sqlInHed, InHedTB.class);
        if (inHeds.size() > 0) {
            for (InHedTB inHed : inHeds) {
        List<OutHedTB> inHeds = erpSqlServer.select(sqlInHed, OutHedTB.class);
        if (!inHeds.isEmpty()) {
            for (OutHedTB inHed : inHeds) {
                System.out.println(inHed);
                HashMap<String, String> condition = new HashMap<>();
                condition.put("BillNo", "'" + inHed.getBillNo() + "'");
                List<InDetTB> inDetTBS = erpSqlServer.selectList(InDetTB.class, condition);
                List<OutDetTB> inDetTBS = erpSqlServer.selectList(OutDetTB.class, condition);
                HashMap<String, Object> hedAndDet = new HashMap<>();
                hedAndDet.put("hed", inHed);
                hedAndDet.put("det", inDetTBS);
                boolean result = inMS.createOrder(inHed, inDetTBS);
                boolean result = inMS.createOutOrder(inHed, inDetTBS);
                if (result) {
                    move(hedAndDet);
                } else {
@@ -57,20 +60,18 @@
        }
    }
    @Transactional
    @Transactional(rollbackFor = Throwable.class)
    public void move(HashMap<String, Object> hedAndDet) {
        InHedTB hed = (InHedTB) hedAndDet.get("hed");
        ArrayList<InDetTB> dets = (ArrayList<InDetTB>) hedAndDet.get("det");
        OutHedTB hed = (OutHedTB) hedAndDet.get("hed");
        ArrayList<OutDetTB> dets = (ArrayList<OutDetTB>) hedAndDet.get("det");
        HashMap<String, String> condition = new HashMap<>();
        condition.put("BillNo", "'" + hed.getBillNo() + "'");
        erpSqlServer.delete(InHedTB.class, condition);
        for (InDetTB det : dets) {
        erpSqlServer.delete(OutHedTB.class, condition);
        for (OutDetTB det : dets) {
            HashMap<String, String> condition2 = new HashMap<>();
            condition2.put("BillNo", "'" + det.getBillNo() + "'");
            condition2.put("iNo", String.valueOf(det.getINO()));
            erpSqlServer.delete(InDetTB.class, condition2);
            erpSqlServer.delete(OutDetTB.class, condition2);
        }
    }
src/main/java/com/zy/third/lk/entity/ErpLKStorage.java
@@ -1,7 +1,8 @@
package com.zy.third.lk.entity;
import com.baomidou.mybatisplus.annotations.TableField;
import com.core.common.Cools;import io.swagger.annotations.ApiModelProperty;
import com.core.common.Cools;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
@@ -25,43 +26,43 @@
    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("WareId")
    private String wareId;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("WareName")
    private String wareName;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("ItemId")
    private String itemId;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("ItemCode")
    private String itemCode;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("ItemName")
    private String itemName;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("ItemSpc")
    private String itemSpc;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("ItemUnit")
    private String itemUnit;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("ProType")
    private String protype;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("ItemBatch")
    private String itemBatch;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("NumIs")
    private Double numis;
src/main/java/com/zy/third/lk/entity/InDetTB.java
@@ -106,6 +106,35 @@
    private Date makedate;
    /**
     *
     */
    @TableField("FactArea")
    private String FactArea;
    /**
     * 供应商\客户ID
     */
    @TableField("Packing")
    private String Packing;
    /**
     * 颜色
     */
    @TableField("sColor")
    private String sColor;
    /**
     * 炉号\客户图号
     */
    @TableField("LuHao")
    private String LuHao;
    /**
     * 工单号
     */
    @TableField("sPgNO")
    private String sPgNO;
    public String getMakedate$() {
        if (Cools.isEmpty(this.makedate)) {
            return "";
src/main/java/com/zy/third/lk/entity/InDetTBBak.java
New file
@@ -0,0 +1,142 @@
package com.zy.third.lk.entity;
import com.baomidou.mybatisplus.annotations.TableField;
import com.core.common.Cools;
import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.enums.IdType;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import java.text.SimpleDateFormat;
import java.util.Date;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotations.TableName;
import java.io.Serializable;
@Data
@TableName("lk_InDetTB_bak")
public class InDetTBBak implements Serializable {
    private static final long serialVersionUID = 1L;
    @TableId(value = "AutoId", type = IdType.AUTO)
    private Integer autoId;
    @ApiModelProperty(value = "")
    @TableField("BillNo")
    private String BillNo;
    @ApiModelProperty(value = "")
    @TableField("iNo")
    private Integer iNO;
    @ApiModelProperty(value = "")
    @TableField("DetId")
    private Integer detId;
    @ApiModelProperty(value = "")
    @TableField("ItemId")
    private String itemid;
    @ApiModelProperty(value = "")
    @TableField("ItemCode")
    private String ItemCode;
    @ApiModelProperty(value = "")
    @TableField("ItemBatch")
    private String ItemBatch;
    @ApiModelProperty(value = "")
    @TableField("proType")
    private String protype;
    @ApiModelProperty(value = "")
    @TableField("OrderNo")
    private String OrderNo;
    @ApiModelProperty(value = "")
    @TableField("MainNum")
    private Double MainNum;
    @ApiModelProperty(value = "")
    @TableField("remark")
    private String remark;
    @TableField("WareId")
    private String wareId;
    @TableField("WareName")
    private String wareName;
    @ApiModelProperty(value = "")
    private String temp1;
    @ApiModelProperty(value = "")
    private String temp2;
    @ApiModelProperty(value = "")
    private String temp3;
    @ApiModelProperty(value = "")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("MakeDate")
    private Date makedate;
    @TableField("DelDate")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date DelDate;
    /**
     *
     */
    @TableField("FactArea")
    private String FactArea;
    /**
     * 供应商\客户ID
     */
    @TableField("Packing")
    private String Packing;
    /**
     * 颜色
     */
    @TableField("sColor")
    private String sColor;
    /**
     * 炉号\客户图号
     */
    @TableField("LuHao")
    private String LuHao;
    /**
     * 工单号
     */
    @TableField("sPgNO")
    private String sPgNO;
    public String getMakedate$() {
        if (Cools.isEmpty(this.makedate)) {
            return "";
        }
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.makedate);
    }
}
src/main/java/com/zy/third/lk/entity/InHedTBBak.java
New file
@@ -0,0 +1,118 @@
package com.zy.third.lk.entity;
import com.baomidou.mybatisplus.annotations.TableField;
import com.core.common.Cools;
import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.enums.IdType;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import java.text.SimpleDateFormat;
import java.util.Date;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotations.TableName;
import java.io.Serializable;
@Data
@TableName("lk_InHedTB_bak")
public class InHedTBBak implements Serializable {
    private static final long serialVersionUID = 1L;
    @TableId(value = "AutoId", type = IdType.AUTO)
    private Integer autoId;
    @ApiModelProperty(value = "")
    @TableField("BillNo")
    private String BillNo;
    @TableField("BillDate")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date billDate;
    /**
     * StockIn:采购入库
     * ProductIn:成品入库单
     * ItemMoveIn:调拨入库
     * ItemSwitchIn:形态转换入库
     * CheckMoreIn:盘盈入库单
     */
    @ApiModelProperty(value = "StockIn:采购入库 ")
    @TableField("IoKindID")
    private String IoKindID;
    @TableField("IoKindName")
    private String ioKindName;
    /**
     * 供应商、部门ID
     */
    @ApiModelProperty(value = "供应商、部门ID")
    @TableField("ObjectId")
    private String ObjectId;
    /**
     * 供应商、部门名称
     */
    @ApiModelProperty(value = "供应商、部门名称")
    @TableField("ObjectName")
    private String ObjectName;
    @ApiModelProperty(value = "")
    @TableField("Remark")
    private String remark;
    @TableField("WareId")
    private String wareId;
    @TableField("WareName")
    private String wareName;
    @ApiModelProperty(value = "")
    @TableField("Temp1")
    private String temp1;
    @ApiModelProperty(value = "")
    @TableField("Temp2")
    private String temp2;
    @ApiModelProperty(value = "")
    @TableField("Temp3")
    private String temp3;
    @ApiModelProperty(value = "")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("MakeDate")
    private Date makedate;
    @TableField("DelDate")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date delDate;
    @TableField("bPass")
    private Boolean bPass;
    @TableField("bStartIn")
    private Boolean bStartIn;
    public String getMakedate$() {
        if (Cools.isEmpty(this.makedate)) {
            return "";
        }
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.makedate);
    }
}
src/main/java/com/zy/third/lk/entity/OutDetTB.java
@@ -21,7 +21,7 @@
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("lk_OutDetTb")
@TableName("lk_OutDetTB")
public class OutDetTB implements Serializable {
    private static final long serialVersionUID = 1L;
@@ -94,6 +94,34 @@
    @TableField("DelDate")
    private Date delDate;
    /**
     *
     */
    @TableField("FactArea")
    private String FactArea;
    /**
     * 供应商\客户ID
     */
    @TableField("Packing")
    private String Packing;
    /**
     * 颜色
     */
    @TableField("sColor")
    private String sColor;
    /**
     * 炉号\客户图号
     */
    @TableField("LuHao")
    private String LuHao;
    /**
     * 工单号
     */
    @TableField("sPgNO")
    private String sPgNO;
    public String getMakedate$() {
        if (Cools.isEmpty(this.makedate)) {
src/main/java/com/zy/third/lk/entity/OutDetTBBak.java
@@ -9,13 +9,15 @@
import java.text.SimpleDateFormat;
import java.util.Date;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import com.baomidou.mybatisplus.annotations.TableName;
import java.io.Serializable;
@TableName("lk_OutDetTb_bak")
@TableName("lk_OutDetTB_bak")
@Data
public class OutDetTBBak implements Serializable {
    private static final long serialVersionUID = 1L;
@@ -87,6 +89,33 @@
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date delDate;
    /**
     *
     */
    @TableField("FactArea")
    private String FactArea;
    /**
     * 供应商\客户ID
     */
    @TableField("Packing")
    private String Packing;
    /**
     * 颜色
     */
    @TableField("sColor")
    private String sColor;
    /**
     * 炉号\客户图号
     */
    @TableField("LuHao")
    private String LuHao;
    /**
     * 工单号
     */
    @TableField("sPgNO")
    private String sPgNO;
    public String getMakedate$() {
        if (Cools.isEmpty(this.makedate)) {
src/main/java/com/zy/third/lk/entity/OutHedTBBak.java
@@ -1,7 +1,8 @@
package com.zy.third.lk.entity;
import com.baomidou.mybatisplus.annotations.TableField;
import com.core.common.Cools;import io.swagger.annotations.ApiModelProperty;
import com.core.common.Cools;
import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.enums.IdType;
@@ -11,6 +12,7 @@
import org.springframework.format.annotation.DateTimeFormat;
import com.baomidou.mybatisplus.annotations.TableName;
import java.io.Serializable;
@TableName("lk_OutHedTb_bak")
@@ -18,10 +20,10 @@
    private static final long serialVersionUID = 1L;
    @TableId(value = "AutoId",type = IdType.AUTO)
    @TableId(value = "AutoId", type = IdType.AUTO)
    private Integer AutoId;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("BillNo")
    private String BillNo;
@@ -30,28 +32,27 @@
    /**
     * SendMatOut:发料出库
OtherOut:其它出库单
ItemMoveOut:调拨出库
ItemSwitchOut:形态转换出库
CheckLossOut:盘盈出库单
     * OtherOut:其它出库单
     * ItemMoveOut:调拨出库
     * ItemSwitchOut:形态转换出库
     * CheckLossOut:盘盈出库单
     */
    @ApiModelProperty(value= "SendMatOut:发料出库 ")
    @ApiModelProperty(value = "SendMatOut:发料出库 ")
    @TableField("IoKindID")
    private String IoKindID;
    @TableField("IoKindName")
    private String ioKindName;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("ObjectId")
    private String ObjectId;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("ObjectName")
    private String ObjectName;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("Remark")
    private String Remark;
@@ -61,21 +62,21 @@
    @TableField("WareName")
    private String WareName;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("Temp1")
    private String Temp1;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("Temp2")
    private String Temp2;
    @ApiModelProperty(value= "")
    @ApiModelProperty(value = "")
    @TableField("Temp3")
    private String Temp3;
    @ApiModelProperty(value= "")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("MakeDate")
    private Date makedate;
@@ -89,15 +90,12 @@
    private Boolean bStartIn;
    public String getMakedate$(){
        if (Cools.isEmpty(this.makedate)){
    public String getMakedate$() {
        if (Cools.isEmpty(this.makedate)) {
            return "";
        }
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.makedate);
    }
}
src/main/java/com/zy/third/lk/task/LKInTBScheduler.java
@@ -1,19 +1,15 @@
package com.zy.third.lk.task;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.Cools;
import com.core.exception.CoolException;
import com.zy.asrs.entity.DocType;
import com.zy.asrs.entity.Mat;
import com.zy.asrs.entity.Order;
import com.zy.asrs.entity.OrderDetl;
import com.zy.asrs.entity.param.OpenOrderCompleteParam;
import com.zy.asrs.entity.result.OpenOrderCompeteResult;
import com.zy.asrs.service.DocTypeService;
import com.zy.asrs.service.MatService;
import com.zy.asrs.service.OrderDetlService;
import com.zy.asrs.service.OrderService;
import com.zy.common.model.DetlDto;
import com.zy.common.service.erp.ErpSqlServer;
import com.zy.third.lk.entity.*;
import lombok.extern.slf4j.Slf4j;
@@ -22,9 +18,9 @@
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 入库更新完成回报
@@ -48,7 +44,7 @@
    @Autowired
    private ErpSqlServer erpSqlServer;
    @Transactional
    @Transactional(rollbackFor = Throwable.class)
    @Scheduled(cron = "${erp.refreshtime}")
    public void pakinOrderComplete() {
        log.info("开始入库更新完成回报");
@@ -90,38 +86,27 @@
     * @param orderDetl
     * @return
     */
    @Transactional
    @Transactional(rollbackFor = Throwable.class)
    public boolean insertInDet(OrderDetl orderDetl) {
        String sqlInDetTb = "select * from lk_InDetTB where BillNo='" + orderDetl.getOrderNo() + "' and " +
                " ItemId='" + orderDetl.getMatnr() + "' and ItemBatch='" + orderDetl.getBatch() + "' and proType='" + orderDetl.getSpecs() + "'";
        List<InDetTB> inDets = erpSqlServer.select(sqlInDetTb, InDetTB.class);
        String sqlInDetTbBak = "select * from lk_InDetTB_Bak where BillNo='" + orderDetl.getOrderNo() + "' and " +
                " ItemId='" + orderDetl.getMatnr() + "' and ItemBatch='" + orderDetl.getBatch() + "' and proType='" + orderDetl.getSpecs() + "'";
        List<InDetTB> inDetBaks = erpSqlServer.select(sqlInDetTbBak, InDetTB.class);
        if (inDets.size() > 0 || inDetBaks.size() > 0) {
        List<InDetTBBak> inDetBaks = erpSqlServer.select(sqlInDetTbBak, InDetTBBak.class);
        if (!inDets.isEmpty() || !inDetBaks.isEmpty()) {
            log.error("该单号料号中间表表身已存在:" + orderDetl.getOrderNo() + "==>>" + orderDetl.getOrderNo());
            return true;
        }
        Mat mat = matService.selectByMatnr(orderDetl.getMatnr());
        HashMap<String, Object> content = new HashMap<>();
        content.put("BillNo", "'" + orderDetl.getOrderNo() + "'");
        content.put("ItemId", "'" + orderDetl.getThreeCode() + "'");
        content.put("ItemCode", "'" + orderDetl.getMatnr() + "'");
        content.put("proType", "'" + orderDetl.getSpecs() + "'");
        content.put("remark", "'" + orderDetl.getMemo() + "'");
        content.put("OrderNo", "'" + orderDetl.getOutOrderNo() + "'");
        content.put("ItemBatch", "'" + orderDetl.getBatch() + "'");
        content.put("iNo", orderDetl.getId());
        content.put("DetId", orderDetl.getAutoId());
        content.put("MainNum", orderDetl.getQty());
        content.put("LKName", "'中扬二期'");
        Map<String, Object> content = getMap(orderDetl);
        int insert = erpSqlServer.insert(InDetTB.class, content);
        if (insert == 1) {
            log.info("入库单表身回传成功:" + content.toString());
            log.info("入库单表身回传成功:{}", content);
            return true;
        } else {
            log.error("入库回传失败,实体类打印:" + content.toString());
            log.error("入库回传失败,实体类打印:{}", content);
            return false;
        }
@@ -133,13 +118,13 @@
     * @param order
     * @return
     */
    @Transactional
    @Transactional(rollbackFor = Throwable.class)
    public boolean insertInHed(Order order) {
        String sqlInHedTb = "select * from lk_InHedTB where LKName='中扬二期' and BillNo='" + order.getOrderNo() + "'";
        List<InHedTB> outHeds = erpSqlServer.select(sqlInHedTb, InHedTB.class);
        String sqlInHedTbBak = "select * from lk_InHedTB_Bak where LKName='中扬二期' and BillNo='" + order.getOrderNo() + "'";
        List<InHedTB> inHedBaks = erpSqlServer.select(sqlInHedTbBak, InHedTB.class);
        if (outHeds.size() > 0 || inHedBaks.size() > 0) {
        List<InHedTBBak> inHedBaks = erpSqlServer.select(sqlInHedTbBak, InHedTBBak.class);
        if (!outHeds.isEmpty() || !inHedBaks.isEmpty()) {
            log.error("该单号料号中间表表头已存在:" + order.getOrderNo());
            return true;
        }
@@ -149,15 +134,15 @@
        content.put("ObjectId", "'" + order.getCstmr() + "'");
        content.put("ObjectName", "'" + order.getCstmrName() + "'");
        content.put("Remark", "'" + order.getMemo() + "'");
        content.put("LKName", "'中扬'");
        content.put("LKName", "'中扬二期'");
        int insert = erpSqlServer.insert(InHedTB.class, content);
        String sql = "UPDATE lk_InHedTB SET bPass = 1, LKName='中扬二期' WHERE BillNo = '" + order.getOrderNo() + "'";
        int update = erpSqlServer.update(sql);
        if (update == 1) {
            log.info("入库单表头回传成功:" + content.toString());
            log.info("入库单表头回传成功:" + content);
            return true;
        } else {
            log.error("入库单表头回传失败:" + content.toString());
            log.error("入库单表头回传失败:" + content);
            return false;
        }
    }
@@ -168,7 +153,7 @@
     * @param orderDetl
     * @return
     */
    @Transactional
    @Transactional(rollbackFor = Throwable.class)
    public boolean insertOutDet(OrderDetl orderDetl) {
        String sqlInDetTb = "select * from lk_OutDetTB where BillNo='" + orderDetl.getOrderNo() + "' and " +
                " ItemId='" + orderDetl.getMatnr() + "' and ItemBatch='" + orderDetl.getBatch() + "' and proType='" + orderDetl.getSpecs() + "'";
@@ -176,23 +161,12 @@
        String sqlInDetTbBak = "select * from lk_OutDetTB_Bak where BillNo='" + orderDetl.getOrderNo() + "' and " +
                " ItemId='" + orderDetl.getMatnr() + "' and ItemBatch='" + orderDetl.getBatch() + "' and proType='" + orderDetl.getSpecs() + "'";
        List<OutDetTBBak> inDetBaks = erpSqlServer.select(sqlInDetTbBak, OutDetTBBak.class);
        if (inDets.size() > 0 || inDetBaks.size() > 0) {
        if (!inDets.isEmpty() || !inDetBaks.isEmpty()) {
            log.error("该单号料号中间表表身已存在:" + orderDetl.getOrderNo() + "==>>" + orderDetl.getOrderNo());
            return true;
        }
        Mat mat = matService.selectByMatnr(orderDetl.getMatnr());
        HashMap<String, Object> content = new HashMap<>();
        content.put("BillNo", "'" + orderDetl.getOrderNo() + "'");
        content.put("ItemId", "'" + orderDetl.getThreeCode() + "'");
        content.put("ItemCode", "'" + orderDetl.getMatnr() + "'");
        content.put("proType", "'" + orderDetl.getSpecs() + "'");
        content.put("remark", "'" + orderDetl.getMemo() + "'");
        content.put("OrderNo", "'" + orderDetl.getOutOrderNo() + "'");
        content.put("ItemBatch", "'" + orderDetl.getBatch() + "'");
        content.put("iNo", orderDetl.getId());
        content.put("DetId", orderDetl.getAutoId());
        content.put("MainNum", orderDetl.getQty());
        content.put("LKName", "'中扬二期'");
        Map<String, Object> content = getMap(orderDetl);
        int insert = erpSqlServer.insert(InDetTB.class, content);
        if (insert == 1) {
@@ -211,13 +185,13 @@
     * @param order
     * @return
     */
    @Transactional
    @Transactional(rollbackFor = Throwable.class)
    public boolean insertOutHed(Order order) {
        String sqlInHedTb = "select * from lk_OutHedTB where LKName='中扬二期' and BillNo='" + order.getOrderNo() + "'";
        List<OutHedTB> outHeds = erpSqlServer.select(sqlInHedTb, OutHedTB.class);
        String sqlInHedTbBak = "select * from lk_OutHedTB_Bak where LKName='中扬二期' and BillNo='" + order.getOrderNo() + "'";
        List<OutHedTBBak> inHedBaks = erpSqlServer.select(sqlInHedTbBak, OutHedTBBak.class);
        if (outHeds.size() > 0 || inHedBaks.size() > 0) {
        if (!outHeds.isEmpty() || !inHedBaks.isEmpty()) {
            log.error("该单号料号中间表表头已存在:" + order.getOrderNo());
            return true;
        }
@@ -227,16 +201,40 @@
        content.put("ObjectId", "'" + order.getCstmr() + "'");
        content.put("ObjectName", "'" + order.getCstmrName() + "'");
        content.put("Remark", "'" + order.getMemo() + "'");
        content.put("LKName", "'中扬'");
        int insert = erpSqlServer.insert(InHedTB.class, content);
        String sql = "UPDATE lk_InHedTB SET bPass = 1, LKName='中扬二期' WHERE BillNo = '" + order.getOrderNo() + "'";
        content.put("LKName", "'中扬二期'");
        int insert = erpSqlServer.insert(OutHedTB.class, content);
        String sql = "UPDATE lk_OutHedTB SET bPass = 1, LKName='中扬二期' WHERE BillNo = '" + order.getOrderNo() + "'";
        int update = erpSqlServer.update(sql);
        if (update == 1) {
            log.info("入库单表头回传成功:" + content.toString());
            log.info("入库单表头回传成功:" + content);
            return true;
        } else {
            log.error("入库单表头回传失败:" + content.toString());
            log.error("入库单表头回传失败:" + content);
            return false;
        }
    }
    private Map<String, Object> getMap(OrderDetl orderDetl) {
        Map<String, Object> content = new HashMap<>();
        content.put("BillNo", "'" + orderDetl.getOrderNo() + "'");
        content.put("iNO", "'" + orderDetl.getINO() + "'");
        content.put("detId", orderDetl.getThreeCode());
        content.put("ItemId", "'" + orderDetl.getThreeCode() + "'");
        content.put("ItemCode", "'" + orderDetl.getMatnr() + "'");
        content.put("ItemBatch", "'" + orderDetl.getBatch() + "'");
        content.put("proType", "'" + orderDetl.getProType() + "'");
        content.put("remark", "'" + orderDetl.getMemo() + "'");
        content.put("OrderNo", "'" + orderDetl.getOutOrderNo() + "'");
        content.put("MainNum", orderDetl.getQty());
        content.put("WareId", "'" + orderDetl.getWareId() + "'");
        content.put("WareName", "'" + orderDetl.getWareName() + "'");
        content.put("Packing", "'" + orderDetl.getPacking() + "'");
        content.put("LuHao", "'" + orderDetl.getLuHao() + "'");
        content.put("sPgNO", "'" + orderDetl.getSPgNO() + "'");
        content.put("temp1", "'" + orderDetl.getTemp1() + "'");
        content.put("temp2", "'" + orderDetl.getTemp2() + "'");
        content.put("temp3", "'" + orderDetl.getTemp3() + "'");
        content.put("LKName", "'中扬二期'");
        return content;
    }
}
src/main/java/update20240719.sql
New file
@@ -0,0 +1,168 @@
ALTER TABLE [dbo].[man_mat] ADD [temp1] varchar(255) NULL
    GO
ALTER TABLE [dbo].[man_mat] ADD [temp2] varchar(255) NULL
    GO
ALTER TABLE [dbo].[man_mat] ADD [temp3] varchar(255) NULL
ALTER TABLE [dbo].[man_order] ALTER COLUMN [cstmr] varchar(50) NULL
ALTER TABLE [dbo].[man_order_log] ALTER COLUMN [cstmr] varchar(50) NULL
ALTER TABLE [dbo].[man_order_detl] ADD [auto_id] int NULL
    GO
ALTER TABLE [dbo].[man_order_detl] ADD [out_order_no] varchar(255) NULL
    GO
ALTER TABLE [dbo].[man_order_detl] ADD [lu_hao] varchar(255) NULL
    GO
ALTER TABLE [dbo].[man_order_detl] ADD [ware_id] varchar(255) NULL
    GO
ALTER TABLE [dbo].[man_order_detl] ADD [ware_name] varchar(255) NULL
    GO
ALTER TABLE [dbo].[man_order_detl] ADD [packing] varchar(255) NULL
    GO
ALTER TABLE [dbo].[man_order_detl] ADD [pg_no] varchar(255) NULL
    GO
ALTER TABLE [dbo].[man_order_detl] ADD [temp1] varchar(255) NULL
    GO
ALTER TABLE [dbo].[man_order_detl] ADD [temp2] varchar(255) NULL
    GO
ALTER TABLE [dbo].[man_order_detl] ADD [temp3] varchar(255) NULL
    GO
ALTER TABLE [dbo].[man_order_detl] ADD [pro_type] varchar(255) NULL
    GO
    EXEC sp_addextendedproperty
    'MS_Description', N'外部主键id',
    'SCHEMA', N'dbo',
    'TABLE', N'man_order_detl',
    'COLUMN', N'auto_id'
    GO
    EXEC sp_addextendedproperty
    'MS_Description', N'订单号    ',
    'SCHEMA', N'dbo',
    'TABLE', N'man_order_detl',
    'COLUMN', N'out_order_no'
    GO
    EXEC sp_addextendedproperty
    'MS_Description', N'炉号\客户图号',
    'SCHEMA', N'dbo',
    'TABLE', N'man_order_detl',
    'COLUMN', N'lu_hao'
    GO
    EXEC sp_addextendedproperty
    'MS_Description', N'仓库ID',
    'SCHEMA', N'dbo',
    'TABLE', N'man_order_detl',
    'COLUMN', N'ware_id'
    GO
    EXEC sp_addextendedproperty
    'MS_Description', N'仓库',
    'SCHEMA', N'dbo',
    'TABLE', N'man_order_detl',
    'COLUMN', N'ware_name'
    GO
    EXEC sp_addextendedproperty
    'MS_Description', N'供应商\客户ID',
    'SCHEMA', N'dbo',
    'TABLE', N'man_order_detl',
    'COLUMN', N'packing'
    GO
    EXEC sp_addextendedproperty
    'MS_Description', N'工单号',
    'SCHEMA', N'dbo',
    'TABLE', N'man_order_detl',
    'COLUMN', N'pg_no'
    GO
    EXEC sp_addextendedproperty
    'MS_Description', N'备用字段',
    'SCHEMA', N'dbo',
    'TABLE', N'man_order_detl',
    'COLUMN', N'temp1'
    GO
    EXEC sp_addextendedproperty
    'MS_Description', N'备用字段',
    'SCHEMA', N'dbo',
    'TABLE', N'man_order_detl',
    'COLUMN', N'temp2'
    GO
    EXEC sp_addextendedproperty
    'MS_Description', N'备用字段',
    'SCHEMA', N'dbo',
    'TABLE', N'man_order_detl',
    'COLUMN', N'temp3'
    GO
    EXEC sp_addextendedproperty
    'MS_Description', N'属性',
    'SCHEMA', N'dbo',
    'TABLE', N'man_order_detl',
    'COLUMN', N'pro_type'
ALTER TABLE [dbo].[man_order_detl_log] ADD [auto_id] int NULL
    GO
ALTER TABLE [dbo].[man_order_detl_log] ADD [out_order_no] varchar(255) NULL
    GO
ALTER TABLE [dbo].[man_order_detl_log] ADD [lu_hao] varchar(255) NULL
    GO
ALTER TABLE [dbo].[man_order_detl_log] ADD [ware_id] varchar(255) NULL
    GO
ALTER TABLE [dbo].[man_order_detl_log] ADD [ware_name] varchar(255) NULL
    GO
ALTER TABLE [dbo].[man_order_detl_log] ADD [packing] varchar(255) NULL
    GO
ALTER TABLE [dbo].[man_order_detl_log] ADD [pg_no] varchar(255) NULL
    GO
ALTER TABLE [dbo].[man_order_detl_log] ADD [temp1] varchar(255) NULL
    GO
ALTER TABLE [dbo].[man_order_detl_log] ADD [temp2] varchar(255) NULL
    GO
ALTER TABLE [dbo].[man_order_detl_log] ADD [temp3] varchar(255) NULL
    GO
ALTER TABLE [dbo].[man_order_detl_log] ADD [pro_type] varchar(255) NULL
    GO
ALTER TABLE [dbo].[man_doc_type] ADD [doc_code] varchar(255) NULL
ALTER TABLE [dbo].[man_order_detl] ADD [i_no] int NULL
ALTER TABLE [dbo].[man_order_detl_log] ADD [i_no] int NULL
src/main/resources/mapper/OrderDetlMapper.xml
@@ -200,4 +200,10 @@
        </choose>
    </update>
    <select id="listByOrderNo" resultMap="BaseResultMap">
        select * from man_order_detl
        where 1=1
        and order_no = #{orderNo}
    </select>
</mapper>