From c0cfe836fba8c4fd03b21ad66d77aa984c210117 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@63.com> Date: 星期二, 20 十二月 2022 13:25:19 +0800 Subject: [PATCH] # --- src/main/resources/mapper/OrderMapper.xml | 72 ++ src/main/java/com/zy/asrs/entity/OrderDetl.java | 451 +++++++++++++++ src/main/java/com/zy/common/service/erp/ErpService.java | 0 src/main/java/com/zy/core/thread/LedThread.java | 5 src/main/java/com/zy/asrs/mapper/OrderDetlMapper.java | 42 + src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 26 src/main/java/com/zy/common/service/erp/entity/VoucherDetail.java | 19 src/main/java/com/zy/common/service/erp/ErpSqlServer.java | 236 ++++++++ src/main/java/com/zy/asrs/entity/Order.java | 441 +++++++++++++++ src/main/java/com/zy/common/model/MatDto.java | 24 src/main/resources/mapper/OrderDetlMapper.xml | 215 +++++++ src/main/java/com/zy/common/service/erp/dto/VoucherDto.java | 20 src/main/java/com/zy/common/service/erp/ErpDbProperties.java | 30 + src/main/java/com/zy/common/service/erp/entity/Goods.java | 45 + src/main/java/com/zy/asrs/mapper/OrderMapper.java | 21 src/main/resources/application.yml | 7 src/main/java/com/zy/common/service/erp/entity/Voucher.java | 45 + 17 files changed, 1,680 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/zy/asrs/entity/Order.java b/src/main/java/com/zy/asrs/entity/Order.java new file mode 100644 index 0000000..99abc64 --- /dev/null +++ b/src/main/java/com/zy/asrs/entity/Order.java @@ -0,0 +1,441 @@ +package com.zy.asrs.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 com.core.common.SpringUtils; +import com.zy.asrs.service.DocTypeService; +import com.zy.asrs.service.OrderSettleService; +import com.zy.system.entity.User; +import com.zy.system.service.UserService; +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("man_order") +public class Order implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value= "ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 缂栧彿 + */ + @ApiModelProperty(value= "缂栧彿") + private String uuid; + + /** + * 璁㈠崟缂栧彿 + */ + @ApiModelProperty(value= "璁㈠崟缂栧彿") + @TableField("order_no") + private String orderNo; + + /** + * 鍗曟嵁鏃ユ湡 + */ + @ApiModelProperty(value= "鍗曟嵁鏃ユ湡") + @TableField("order_time") + private String orderTime; + + /** + * 鍗曟嵁绫诲瀷 + */ + @ApiModelProperty(value= "鍗曟嵁绫诲瀷") + @TableField("doc_type") + private Long docType; + + /** + * 椤圭洰缂栧彿 + */ + @ApiModelProperty(value= "椤圭洰缂栧彿") + @TableField("item_id") + private Long itemId; + + @ApiModelProperty(value= "") + @TableField("item_name") + private String itemName; + + /** + * 璋冩嫧椤圭洰缂栧彿 + */ + @ApiModelProperty(value= "璋冩嫧椤圭洰缂栧彿") + @TableField("allot_item_id") + private Long allotItemId; + + /** + * 鍒濆绁ㄦ嵁鍙� + */ + @ApiModelProperty(value= "鍒濆绁ㄦ嵁鍙�") + @TableField("def_number") + private String defNumber; + + /** + * 绁ㄦ嵁鍙� + */ + @ApiModelProperty(value= "绁ㄦ嵁鍙�") + private String number; + + /** + * 瀹㈡埛缂栧彿 + */ + @ApiModelProperty(value= "瀹㈡埛缂栧彿") + private Long cstmr; + + /** + * 瀹㈡埛 + */ + @ApiModelProperty(value= "瀹㈡埛") + @TableField("cstmr_name") + private String cstmrName; + + /** + * 鑱旂郴鏂瑰紡 + */ + @ApiModelProperty(value= "鑱旂郴鏂瑰紡") + private String tel; + + /** + * 鎿嶄綔浜哄憳 + */ + @ApiModelProperty(value= "鎿嶄綔浜哄憳") + @TableField("oper_memb") + private String operMemb; + + /** + * 鍚堣閲戦 + */ + @ApiModelProperty(value= "鍚堣閲戦") + @TableField("total_fee") + private Double totalFee; + + /** + * 浼樻儬鐜� + */ + @ApiModelProperty(value= "浼樻儬鐜�") + private Double discount; + + /** + * 浼樻儬閲戦 + */ + @ApiModelProperty(value= "浼樻儬閲戦") + @TableField("discount_fee") + private Double discountFee; + + /** + * 閿�鍞垨閲囪喘璐圭敤鍚堣 + */ + @ApiModelProperty(value= "閿�鍞垨閲囪喘璐圭敤鍚堣") + @TableField("other_fee") + private Double otherFee; + + /** + * 瀹炰粯閲戦 + */ + @ApiModelProperty(value= "瀹炰粯閲戦") + @TableField("act_fee") + private Double actFee; + + /** + * 浠樻绫诲瀷 1: 鐜伴噾 2: 璁拌处 + */ + @ApiModelProperty(value= "浠樻绫诲瀷 1: 鐜伴噾 2: 璁拌处 ") + @TableField("pay_type") + private Integer payType; + + /** + * 涓氬姟鍛� + */ + @ApiModelProperty(value= "涓氬姟鍛�") + private String salesman; + + /** + * 缁撶畻澶╂暟 + */ + @ApiModelProperty(value= "缁撶畻澶╂暟") + @TableField("account_day") + private Integer accountDay; + + /** + * 閭垂鏀粯绫诲瀷 1: 鍦ㄧ嚎鏀粯 2: 璐у埌浠樻 + */ + @ApiModelProperty(value= "閭垂鏀粯绫诲瀷 1: 鍦ㄧ嚎鏀粯 2: 璐у埌浠樻 ") + @TableField("post_fee_type") + private Integer postFeeType; + + /** + * 閭垂 + */ + @ApiModelProperty(value= "閭垂") + @TableField("post_fee") + private Double postFee; + + /** + * 浠樻鏃堕棿 + */ + @ApiModelProperty(value= "浠樻鏃堕棿") + @TableField("pay_time") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + private Date payTime; + + /** + * 鍙戣揣鏃堕棿 + */ + @ApiModelProperty(value= "鍙戣揣鏃堕棿") + @TableField("send_time") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + private Date sendTime; + + /** + * 鐗╂祦鍚嶇О + */ + @ApiModelProperty(value= "鐗╂祦鍚嶇О") + @TableField("ship_name") + private String shipName; + + /** + * 鐗╂祦鍗曞彿 + */ + @ApiModelProperty(value= "鐗╂祦鍗曞彿") + @TableField("ship_code") + private String shipCode; + + /** + * 璁㈠崟鐘舵�� + */ + @ApiModelProperty(value= "璁㈠崟鐘舵��") + private Long settle; + + /** + * 鐘舵�� 1: 姝e父 0: 绂佺敤 + */ + @ApiModelProperty(value= "鐘舵�� 1: 姝e父 0: 绂佺敤 ") + private Integer status; + + /** + * 娣诲姞浜哄憳 + */ + @ApiModelProperty(value= "娣诲姞浜哄憳") + @TableField("create_by") + private Long createBy; + + /** + * 娣诲姞鏃堕棿 + */ + @ApiModelProperty(value= "娣诲姞鏃堕棿") + @TableField("create_time") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + private Date createTime; + + /** + * 淇敼浜哄憳 + */ + @ApiModelProperty(value= "淇敼浜哄憳") + @TableField("update_by") + private Long updateBy; + + /** + * 淇敼鏃堕棿 + */ + @ApiModelProperty(value= "淇敼鏃堕棿") + @TableField("update_time") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + private Date updateTime; + + /** + * 澶囨敞 + */ + @ApiModelProperty(value= "澶囨敞") + private String memo; + + 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) { + this.uuid = uuid; + this.orderNo = orderNo; + this.orderTime = orderTime; + this.docType = docType; + this.itemId = itemId; + this.itemName = itemName; + this.allotItemId = allotItemId; + this.defNumber = defNumber; + this.number = number; + this.cstmr = cstmr; + this.cstmrName = cstmrName; + this.tel = tel; + this.operMemb = operMemb; + this.totalFee = totalFee; + this.discount = discount; + this.discountFee = discountFee; + this.otherFee = otherFee; + this.actFee = actFee; + this.payType = payType; + this.salesman = salesman; + this.accountDay = accountDay; + this.postFeeType = postFeeType; + this.postFee = postFee; + this.payTime = payTime; + this.sendTime = sendTime; + this.shipName = shipName; + this.shipCode = shipCode; + this.settle = settle; + this.status = status; + this.createBy = createBy; + this.createTime = createTime; + this.updateBy = updateBy; + this.updateTime = updateTime; + this.memo = memo; + } + +// Order order = new Order( +// null, // 缂栧彿[闈炵┖] +// null, // 璁㈠崟缂栧彿 +// null, // 鍗曟嵁鏃ユ湡 +// null, // 鍗曟嵁绫诲瀷 +// null, // 椤圭洰缂栧彿 +// null, // +// null, // 璋冩嫧椤圭洰缂栧彿 +// null, // 鍒濆绁ㄦ嵁鍙� +// null, // 绁ㄦ嵁鍙� +// null, // 瀹㈡埛缂栧彿 +// null, // 瀹㈡埛 +// null, // 鑱旂郴鏂瑰紡 +// null, // 鎿嶄綔浜哄憳 +// null, // 鍚堣閲戦 +// null, // 浼樻儬鐜� +// null, // 浼樻儬閲戦 +// null, // 閿�鍞垨閲囪喘璐圭敤鍚堣 +// null, // 瀹炰粯閲戦 +// null, // 浠樻绫诲瀷 +// null, // 涓氬姟鍛� +// null, // 缁撶畻澶╂暟 +// null, // 閭垂鏀粯绫诲瀷 +// null, // 閭垂 +// null, // 浠樻鏃堕棿 +// null, // 鍙戣揣鏃堕棿 +// null, // 鐗╂祦鍚嶇О +// null, // 鐗╂祦鍗曞彿 +// null, // 璁㈠崟鐘舵�� +// null, // 鐘舵�� +// null, // 娣诲姞浜哄憳 +// null, // 娣诲姞鏃堕棿 +// null, // 淇敼浜哄憳 +// null, // 淇敼鏃堕棿 +// null // 澶囨敞 +// ); + + public String getDocType$(){ + DocTypeService service = SpringUtils.getBean(DocTypeService.class); + DocType docType = service.selectById(this.docType); + if (!Cools.isEmpty(docType)){ + return String.valueOf(docType.getDocName()); + } + return null; + } + + public String getPayType$(){ + if (null == this.payType){ return null; } + switch (this.payType){ + case 1: + return "鐜伴噾"; + case 2: + return "璁拌处"; + default: + return String.valueOf(this.payType); + } + } + + public String getPostFeeType$(){ + if (null == this.postFeeType){ return null; } + switch (this.postFeeType){ + case 1: + return "鍦ㄧ嚎鏀粯"; + case 2: + return "璐у埌浠樻"; + default: + return String.valueOf(this.postFeeType); + } + } + + public String getPayTime$(){ + if (Cools.isEmpty(this.payTime)){ + return ""; + } + return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.payTime); + } + + public String getSendTime$(){ + if (Cools.isEmpty(this.sendTime)){ + return ""; + } + return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.sendTime); + } + + public String getSettle$(){ + OrderSettleService service = SpringUtils.getBean(OrderSettleService.class); + OrderSettle orderSettle = service.selectById(this.settle); + if (!Cools.isEmpty(orderSettle)){ + return String.valueOf(orderSettle.getSettleName()); + } + return null; + } + + public String getStatus$(){ + if (null == this.status){ return null; } + switch (this.status){ + case 1: + return "姝e父"; + case 0: + return "绂佺敤"; + default: + return String.valueOf(this.status); + } + } + + public String getCreateBy$(){ + UserService service = SpringUtils.getBean(UserService.class); + User user = service.selectById(this.createBy); + if (!Cools.isEmpty(user)){ + return String.valueOf(user.getUsername()); + } + return null; + } + + public String getCreateTime$(){ + if (Cools.isEmpty(this.createTime)){ + return ""; + } + return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime); + } + + public String getUpdateBy$(){ + UserService service = SpringUtils.getBean(UserService.class); + User user = service.selectById(this.updateBy); + if (!Cools.isEmpty(user)){ + return String.valueOf(user.getUsername()); + } + return null; + } + + public String getUpdateTime$(){ + if (Cools.isEmpty(this.updateTime)){ + return ""; + } + return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime); + } + + +} diff --git a/src/main/java/com/zy/asrs/entity/OrderDetl.java b/src/main/java/com/zy/asrs/entity/OrderDetl.java new file mode 100644 index 0000000..2d20f94 --- /dev/null +++ b/src/main/java/com/zy/asrs/entity/OrderDetl.java @@ -0,0 +1,451 @@ +package com.zy.asrs.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 com.core.common.SpringUtils; +import com.zy.asrs.service.OrderService; +import com.zy.common.utils.Synchro; +import com.zy.system.entity.User; +import com.zy.system.service.UserService; +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("man_order_detl") +public class OrderDetl implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value= "ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 璁㈠崟鍐呯爜 + */ + @ApiModelProperty(value= "璁㈠崟鍐呯爜") + @TableField("order_id") + private Long orderId; + + /** + * 鍗曟嵁缂栧彿 + */ + @ApiModelProperty(value= "鍗曟嵁缂栧彿") + @TableField("order_no") + private String orderNo; + + + /** + * 鏁伴噺 + */ + @ApiModelProperty(value= "鏁伴噺") + private Double anfme; + + /** + * 浣滀笟鏁伴噺 + * + * 1. 鍏ュ簱 : qty 馃憜 + * 1. 鍑哄簱 : qty 馃憜 + */ + @ApiModelProperty(value= "浣滀笟鏁伴噺") + private Double qty; + + /** + * 鐗╂枡鍙� + */ + @ApiModelProperty(value= "鐗╂枡鍙�") + private String matnr; + + /** + * 鐗╂枡鍙� + */ + @ApiModelProperty(value= "鐗╂枡鍙�") + private String maktx; + + /** + * 搴忓垪鐮� + */ + @ApiModelProperty(value= "搴忓垪鐮�") + private String batch; + + /** + * 瑙勬牸 + */ + @ApiModelProperty(value= "瑙勬牸") + private String specs; + + /** + * 鎵规 + */ + @ApiModelProperty(value= "鎵规") + private String model; + + /** + * 棰滆壊 + */ + @ApiModelProperty(value= "棰滆壊") + private String color; + + /** + * 鍝佺墝 + */ + @ApiModelProperty(value= "鍝佺墝") + private String brand; + + /** + * 鍗曚綅 + */ + @ApiModelProperty(value= "鍗曚綅") + private String unit; + + /** + * 鍗曚环 + */ + @ApiModelProperty(value= "鍗曚环") + private Double price; + + /** + * sku + */ + @ApiModelProperty(value= "sku") + private String sku; + + /** + * 鍖呮暟 + */ + @ApiModelProperty(value= "鍖呮暟") + private Double units; + + /** + * 鏉$爜 + */ + @ApiModelProperty(value= "鏉$爜") + private String barcode; + + /** + * 鐗╂枡鐘舵�� + */ + @ApiModelProperty(value= "鐗╂枡鐘舵��") + private String origin; + + /** + * 鍘傚 + */ + @ApiModelProperty(value= "鍘傚") + private String manu; + + /** + * 鍗曟嵁鏃堕棿 + */ + @ApiModelProperty(value= "鍗曟嵁鏃堕棿") + @TableField("manu_date") + private String manuDate; + + /** + * 鍝侀」鏁� + */ + @ApiModelProperty(value= "鍝侀」鏁�") + @TableField("item_num") + private String itemNum; + + /** + * 瀹夊叏搴撳瓨閲� + */ + @ApiModelProperty(value= "瀹夊叏搴撳瓨閲�") + @TableField("safe_qty") + private Double safeQty; + + /** + * 閲嶉噺 + */ + @ApiModelProperty(value= "閲嶉噺") + private Double weight; + + /** + * 闀垮害 + */ + @ApiModelProperty(value= "闀垮害") + private Double length; + + /** + * 浣撶Н + */ + @ApiModelProperty(value= "浣撶Н") + private Double volume; + + /** + * 涓夋柟缂栫爜 + */ + @ApiModelProperty(value= "涓夋柟缂栫爜") + @TableField("three_code") + private String threeCode; + + /** + * 渚涘簲鍟� + */ + @ApiModelProperty(value= "渚涘簲鍟�") + private String supp; + + /** + * 渚涘簲鍟嗙紪鐮� + */ + @ApiModelProperty(value= "渚涘簲鍟嗙紪鐮�") + @TableField("supp_code") + private String suppCode; + + /** + * 鏄惁鎵规 1: 鏄� 0: 鍚� + */ + @ApiModelProperty(value= "鏄惁鎵规 1: 鏄� 0: 鍚� ") + @TableField("be_batch") + private Integer beBatch; + + /** + * 淇濊川鏈� + */ + @ApiModelProperty(value= "淇濊川鏈�") + @TableField("dead_time") + private String deadTime; + + /** + * 棰勮澶╂暟 + */ + @ApiModelProperty(value= "棰勮澶╂暟") + @TableField("dead_warn") + private Integer deadWarn; + + /** + * 鍒惰喘 1: 鍒堕�� 2: 閲囪喘 3: 澶栧崗 + */ + @ApiModelProperty(value= "鍒惰喘 1: 鍒堕�� 2: 閲囪喘 3: 澶栧崗 ") + private Integer source; + + /** + * 瑕佹眰妫�楠� 1: 鏄� 0: 鍚� + */ + @ApiModelProperty(value= "瑕佹眰妫�楠� 1: 鏄� 0: 鍚� ") + private Integer inspect; + + /** + * 鍗遍櫓鍝� 1: 鏄� 0: 鍚� + */ + @ApiModelProperty(value= "鍗遍櫓鍝� 1: 鏄� 0: 鍚� ") + private Integer danger; + + /** + * 鐘舵�� 1: 姝e父 0: 绂佺敤 + */ + @ApiModelProperty(value= "鐘舵�� 1: 姝e父 0: 绂佺敤 ") + private Integer status; + + /** + * 娣诲姞浜哄憳 + */ + @ApiModelProperty(value= "娣诲姞浜哄憳") + @TableField("create_by") + private Long createBy; + + /** + * 娣诲姞鏃堕棿 + */ + @ApiModelProperty(value= "娣诲姞鏃堕棿") + @TableField("create_time") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + private Date createTime; + + /** + * 淇敼浜哄憳 + */ + @ApiModelProperty(value= "淇敼浜哄憳") + @TableField("update_by") + private Long updateBy; + + /** + * 淇敼鏃堕棿 + */ + @ApiModelProperty(value= "淇敼鏃堕棿") + @TableField("update_time") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + private Date updateTime; + + /** + * 澶囨敞 + */ + @ApiModelProperty(value= "澶囨敞") + private String memo; + + 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; + this.orderNo = orderNo; + this.anfme = anfme; + this.qty = qty; + this.matnr = matnr; + this.maktx = maktx; + this.batch = batch; + this.specs = specs; + this.model = model; + this.color = color; + this.brand = brand; + this.unit = unit; + this.price = price; + this.sku = sku; + this.units = units; + this.barcode = barcode; + this.origin = origin; + this.manu = manu; + this.manuDate = manuDate; + this.itemNum = itemNum; + this.safeQty = safeQty; + this.weight = weight; + this.length = length; + this.volume = volume; + this.threeCode = threeCode; + this.supp = supp; + this.suppCode = suppCode; + this.beBatch = beBatch; + this.deadTime = deadTime; + this.deadWarn = deadWarn; + this.source = source; + this.inspect = inspect; + this.danger = danger; + this.status = status; + this.createBy = createBy; + this.createTime = createTime; + this.updateBy = updateBy; + this.updateTime = updateTime; + this.memo = memo; + } + + public String getOrderId$(){ + OrderService service = SpringUtils.getBean(OrderService.class); + Order order = service.selectById(this.orderId); + if (!Cools.isEmpty(order)){ + return String.valueOf(order.getId()); + } + return null; + } + + public String getBeBatch$(){ + if (null == this.beBatch){ return null; } + switch (this.beBatch){ + case 1: + return "鏄�"; + case 0: + return "鍚�"; + default: + return String.valueOf(this.beBatch); + } + } + + public String getSource$(){ + if (null == this.source){ return null; } + switch (this.source){ + case 1: + return "鍒堕��"; + case 2: + return "閲囪喘"; + case 3: + return "澶栧崗"; + default: + return String.valueOf(this.source); + } + } + + public String getInspect$(){ + if (null == this.inspect){ return null; } + switch (this.inspect){ + case 1: + return "鏄�"; + case 0: + return "鍚�"; + default: + return String.valueOf(this.inspect); + } + } + + public String getDanger$(){ + if (null == this.danger){ return null; } + switch (this.danger){ + case 1: + return "鏄�"; + case 0: + return "鍚�"; + default: + return String.valueOf(this.danger); + } + } + + public String getStatus$(){ + if (null == this.status){ return null; } + switch (this.status){ + case 1: + return "姝e父"; + case 0: + return "绂佺敤"; + default: + return String.valueOf(this.status); + } + } + + public String getCreateBy$(){ + UserService service = SpringUtils.getBean(UserService.class); + User user = service.selectById(this.createBy); + if (!Cools.isEmpty(user)){ + return String.valueOf(user.getUsername()); + } + return null; + } + + public String getCreateTime$(){ + if (Cools.isEmpty(this.createTime)){ + return ""; + } + return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime); + } + + public String getUpdateBy$(){ + UserService service = SpringUtils.getBean(UserService.class); + User user = service.selectById(this.updateBy); + if (!Cools.isEmpty(user)){ + return String.valueOf(user.getUsername()); + } + return null; + } + + public String getUpdateTime$(){ + if (Cools.isEmpty(this.updateTime)){ + return ""; + } + return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime); + } + + public Double getEnableQty() { + Double enableQty = null; + if (null != this.anfme && this.qty != null) { + enableQty = this.anfme - this.qty; + if (enableQty < 0) { + enableQty = 0.0D; + } +// return this.anfme - this.qty; + } + return enableQty; + } + + public void sync(Object source) { + Synchro.Copy(source, this); + } + +} diff --git a/src/main/java/com/zy/asrs/mapper/OrderDetlMapper.java b/src/main/java/com/zy/asrs/mapper/OrderDetlMapper.java new file mode 100644 index 0000000..3e7d1ba --- /dev/null +++ b/src/main/java/com/zy/asrs/mapper/OrderDetlMapper.java @@ -0,0 +1,42 @@ +package com.zy.asrs.mapper; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.zy.asrs.entity.OrderDetl; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; +import java.util.Map; + +@Mapper +@Repository +public interface OrderDetlMapper extends BaseMapper<OrderDetl> { + + OrderDetl selectItem(@Param("orderId") Long orderId, @Param("matnr") String matnr, @Param("batch") String batch); + + OrderDetl selectItemByOrderNo(@Param("orderNo") String orderNo, @Param("matnr") String matnr, @Param("batch") String batch); + + OrderDetl selectItemNoneOfBatch(@Param("orderNo")String orderNo, @Param("matnr")String matnr); + + OrderDetl selectItemOfBatch(@Param("matnr")String matnr, @Param("batch")String batch); + + List<OrderDetl> selectWorkingDetls(Long orderId); + + List<OrderDetl> getPakoutPage(Map<String, Object> map); + + Integer getPakoutPageCount(Map<String, Object> map); + + int increaseAnfme(@Param("orderId")Long orderId, @Param("matnr")String matnr, @Param("batch")String batch, @Param("qty")Double qty); + + int increase(@Param("orderId")Long orderId, @Param("matnr")String matnr, @Param("batch")String batch, @Param("qty")Double qty); + + int decrease(@Param("orderNo")String orderNo, @Param("matnr")String matnr, @Param("batch")String batch, @Param("qty")Double qty); + + int modifyStatus(@Param("orderId") Long orderId, @Param("status")Integer status); + + List<OrderDetl> selectRemainder(@Param("orderId") Long orderId); + + List<OrderDetl> selectByMatnr(@Param("matnr") String matnr); + +} diff --git a/src/main/java/com/zy/asrs/mapper/OrderMapper.java b/src/main/java/com/zy/asrs/mapper/OrderMapper.java new file mode 100644 index 0000000..774c1a7 --- /dev/null +++ b/src/main/java/com/zy/asrs/mapper/OrderMapper.java @@ -0,0 +1,21 @@ +package com.zy.asrs.mapper; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.zy.asrs.entity.Order; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Mapper +@Repository +public interface OrderMapper extends BaseMapper<Order> { + + Order selectByOrderNo(@Param("orderNo") String orderNo); + + int updateSettle(@Param("orderId")Long orderId, @Param("settle")Long settle, @Param("userId")Long userId); + + List<Order> selectComplete(); + +} diff --git a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java index 0420da7..599d28f 100644 --- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java @@ -6,9 +6,7 @@ import com.core.common.Cools; import com.core.exception.CoolException; import com.zy.asrs.entity.*; -import com.zy.asrs.mapper.BasCrnErrorMapper; -import com.zy.asrs.mapper.WrkChargeMapper; -import com.zy.asrs.mapper.WrkMastMapper; +import com.zy.asrs.mapper.*; import com.zy.asrs.service.*; import com.zy.asrs.utils.Utils; import com.zy.common.model.LocTypeDto; @@ -17,6 +15,7 @@ import com.zy.common.model.StartupDto; import com.zy.common.model.enums.WrkChargeType; import com.zy.common.service.CommonService; +import com.zy.common.service.erp.ErpService; import com.zy.common.utils.CollectionUtils; import com.zy.common.utils.HttpHandler; import com.zy.core.CrnThread; @@ -92,6 +91,12 @@ private CommonService commonService; @Autowired private WrkChargeMapper wrkChargeMapper; + @Autowired + private ErpService erpService; + @Autowired + private OrderMapper orderMapper; + @Autowired + private OrderDetlMapper orderDetlMapper; /** * 缁勬墭 @@ -2484,14 +2489,13 @@ ledCommand.setStaNo(wrkMast.getStaNo()); if (wrkMast.getIoType() != 110) { List<WrkDetl> wrkDetls = wrkDetlService.findByWorkNo(wrkMast.getWrkNo()); - wrkDetls.forEach(wrkDetl -> { - if (wrkMast.getIoType() == 101) { - ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getBatch(), wrkDetl.getAnfme())); - } - if (wrkMast.getIoType() == 103 && (null == wrkDetl.getInspect() || 0 == wrkDetl.getInspect())) { - ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getBatch(), wrkDetl.getAnfme())); - } - }); + try { + WrkDetl wrkDetl = wrkDetls.get(0); + OrderDetl orderDetl = orderDetlMapper.selectItemNoneOfBatch(wrkDetl.getOrderNo(), wrkDetl.getMatnr()); + ledCommand.getMatDtos().add(new MatDto(orderDetl)); + } catch (Exception e) { + log.error("led execute fail", e); + } } commands.add(ledCommand); } diff --git a/src/main/java/com/zy/common/model/MatDto.java b/src/main/java/com/zy/common/model/MatDto.java index 7c19f47..9dcf50d 100644 --- a/src/main/java/com/zy/common/model/MatDto.java +++ b/src/main/java/com/zy/common/model/MatDto.java @@ -1,5 +1,6 @@ package com.zy.common.model; +import com.zy.asrs.entity.OrderDetl; import lombok.Data; /** @@ -12,20 +13,29 @@ private String matnr; // 鐗╂枡鍚嶇О - private String maknx; + private String model; + // 鏉$爜 private String batch; - // 鐗╂枡鏁伴噺 + // 璁㈠崟缂栧彿 + private String orderNo; + + // 宸插嚭 private Double count; + + // 鎬绘暟閲� + private Double total; public MatDto() { } - public MatDto(String matnr, String maknx, String batch, Double count) { - this.matnr = matnr; - this.maknx = maknx; - this.batch = batch; - this.count = count; + public MatDto(OrderDetl orderDetl) { + this.matnr = orderDetl.getMatnr(); + this.model = orderDetl.getModel(); + this.batch = orderDetl.getBatch(); + this.orderNo = orderDetl.getOrderNo(); + this.count = orderDetl.getQty() + orderDetl.getWeight(); + this.total = orderDetl.getAnfme(); } } diff --git a/src/main/java/com/zy/common/service/erp/ErpDbProperties.java b/src/main/java/com/zy/common/service/erp/ErpDbProperties.java new file mode 100644 index 0000000..cf2cf9a --- /dev/null +++ b/src/main/java/com/zy/common/service/erp/ErpDbProperties.java @@ -0,0 +1,30 @@ +package com.zy.common.service.erp; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * Created by vincent on 2020/11/26 + */ +@Data +@ConfigurationProperties(prefix = "erp.db") +@Component +public class ErpDbProperties { + + private String driver_class_name; + + private String ur; + + private String username; + + private String password; + +// { +// driver_class_name = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; +// ur = "jdbc:sqlserver://127.0.0.1:1433;databasename=byrk"; +// username = "sa"; +// password = "sa@123"; +// } + +} diff --git a/src/main/java/com/zy/common/service/erp/ErpService.java b/src/main/java/com/zy/common/service/erp/ErpService.java new file mode 100644 index 0000000..98435aa --- /dev/null +++ b/src/main/java/com/zy/common/service/erp/ErpService.java Binary files differ diff --git a/src/main/java/com/zy/common/service/erp/ErpSqlServer.java b/src/main/java/com/zy/common/service/erp/ErpSqlServer.java new file mode 100644 index 0000000..88e4863 --- /dev/null +++ b/src/main/java/com/zy/common/service/erp/ErpSqlServer.java @@ -0,0 +1,236 @@ +package com.zy.common.service.erp; + +import com.core.common.Cools; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.sql.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 绠�鍗曟寔涔呭眰妗嗘灦 + * Created by vincent on 2020/11/26 + */ +@Slf4j +@Service +public class ErpSqlServer { + + // 鏁版嵁搴撹繛鎺� +// private Connection conn; + // 鍒涘缓棰勭紪璇戣鍙ュ璞★紝涓�鑸兘鏄敤杩欎釜鑰屼笉鐢⊿tatement + private PreparedStatement pstm = null; + // 鍒涘缓涓�涓粨鏋滈泦瀵硅薄 + private ResultSet rs = null; + + @Autowired + private ErpDbProperties erpDbProperties; + + /*****************************************************************************/ + /********************************** 灏佽 **********************************/ + /*****************************************************************************/ + + /** + * 鏌ヨ + */ + public <T> List<T> select(String sql, Class<T> cls) { + List<Map<String, Object>> result = executeQuery(sql); + List<T> list = new ArrayList<>(); + if (null != result) { + for (Map<String, Object> entity : result) { + list.add(Cools.conver(entity, cls)); + } + } + return list; + } + + public List<Map<String, Object>> select(String sql) { + return executeQuery(sql); + } + + /** + * 淇敼 + */ + public int update(String sql) { + return executeUpdate(sql); + } + + /*****************************************************************************/ + /********************************* 鏍稿績灞� *********************************/ + /*****************************************************************************/ + + /** + * map 杞� 瀵硅薄 + */ + + private List<Map<String, Object>> executeQuery(String sql) { + Connection conn = null; + try { + conn = getConn(); + pstm = conn.prepareStatement(sql); + rs = pstm.executeQuery(); +// List<Map<String, Object>> maps = convertList(rs); + return convertList(rs); + } catch (Exception e) { + e.printStackTrace(); + return null; + } finally { + release(); + if (conn != null) { + try { + conn.close(); + conn = null; + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + } + + public Number executeQueryCount(String sql, String column) { + Number value = 0; + Connection conn = null; + try { + conn = getConn(); + pstm = conn.prepareStatement(sql); + rs = pstm.executeQuery(); +// ResultSetMetaData metaData = rs.getMetaData(); + while (rs.next()) { + value = (Number) rs.getInt(column); + } + return value; + } catch (Exception e) { + e.printStackTrace(); + return 0; + } finally { + release(); + if (conn != null) { + try { + conn.close(); + conn = null; + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + } + + private int executeUpdate(String sql) { + Connection conn = null; + try { + conn = getConn(); + if(null != conn) + { + pstm = conn.prepareStatement(sql); + } else { + log.error("鏇存柊ERP涓棿琛ㄥけ璐�===>>鏁版嵁搴撹繛鎺onn涓虹┖"); + log.error("鏇存柊ERP涓棿琛ㄥけ璐�===>>" + sql); + } + return pstm.executeUpdate(); + } catch (Exception e) { + e.printStackTrace(); + log.error("鏇存柊ERP涓棿琛ㄥけ璐�===>>" + sql); + log.error("鏇存柊ERP涓棿琛ㄥけ璐�===>>" + e); + return 0; + } finally { + release(); + if (conn != null) { + try { + conn.close(); + conn = null; + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + } + + private static List<Map<String, Object>> convertList(ResultSet rs) throws SQLException { + List<Map<String, Object>> list = new ArrayList<>(); + ResultSetMetaData md = rs.getMetaData(); + int columnCount = md.getColumnCount(); + while (rs.next()) { + Map<String, Object> rowData = new HashMap<>(); + for (int i = 1; i <= columnCount; i++) { + rowData.put(md.getColumnName(i), rs.getObject(i)); + } + list.add(rowData); + } + return list; + } + + //synchronized + public Connection getConn() throws SQLException { + Connection conn = null; + try { + Class.forName(erpDbProperties.getDriver_class_name()).newInstance(); + conn = DriverManager.getConnection(erpDbProperties.getUr(), erpDbProperties.getUsername(), erpDbProperties.getPassword()); + } catch (Exception e) { + log.error("鑾峰彇ERP鏁版嵁搴撹繛鎺ュけ璐�"); + e.printStackTrace(); + throw new RuntimeException("鑾峰彇ERP鏁版嵁搴撹繛鎺ュけ璐�"); + } + return conn; +// if (null == this.conn || this.conn.isClosed()) { +// try { +// Class.forName(erpDbProperties.getDriver_class_name()).newInstance(); +// this.conn = DriverManager.getConnection(erpDbProperties.getUr(), erpDbProperties.getUsername(), erpDbProperties.getPassword()); +// } catch (Exception e) { +// log.error("鑾峰彇ERP鏁版嵁搴撹繛鎺ュけ璐�"); +// e.printStackTrace(); +// throw new RuntimeException("鑾峰彇ERP鏁版嵁搴撹繛鎺ュけ璐�"); +// } +// } +// return this.conn; + } + + private void release() { + if (rs != null) { + try { + rs.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + if (pstm != null) { + try { + pstm.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } +// if (conn != null) { +// try { +// conn.close(); +// conn = null; +// } catch (SQLException e) { +// e.printStackTrace(); +// } +// } + } + + /** + * 娣辨嫹璐� + */ + public ArrayList deepClone(List list) throws Exception { + // 搴忓垪鍖� + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(bos); + + oos.writeObject(list); + + // 鍙嶅簭鍒楀寲 + ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); + ObjectInputStream ois = new ObjectInputStream(bis); + + return (ArrayList) ois.readObject(); + } + +} diff --git a/src/main/java/com/zy/common/service/erp/dto/VoucherDto.java b/src/main/java/com/zy/common/service/erp/dto/VoucherDto.java new file mode 100644 index 0000000..c77e59d --- /dev/null +++ b/src/main/java/com/zy/common/service/erp/dto/VoucherDto.java @@ -0,0 +1,20 @@ +package com.zy.common.service.erp.dto; + +import com.zy.common.service.erp.entity.Voucher; +import com.zy.common.service.erp.entity.VoucherDetail; +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by vincent on 2022/12/8 + */ +@Data +public class VoucherDto { + + private Voucher voucher; + + private List<VoucherDetail> details = new ArrayList<>(); + +} diff --git a/src/main/java/com/zy/common/service/erp/entity/Goods.java b/src/main/java/com/zy/common/service/erp/entity/Goods.java new file mode 100644 index 0000000..916de5d --- /dev/null +++ b/src/main/java/com/zy/common/service/erp/entity/Goods.java @@ -0,0 +1,45 @@ +package com.zy.common.service.erp.entity; + +import lombok.Data; + +/** + * Created by vincent on 2022/12/8 + */ +@Data +public class Goods { + + private String BarCode; + + private String MaterialNO; + + private String ProdSpec; + + private Integer NumOfBobbins; + + private Double NWT; // 鍑�閲� + + private Double GWT; // 姣涢噸 + + private String ProdDate; + + private String LINE; + + private String GRADE; + + private String GRADES; + + private String Chip; + + private String Batch; + + private String PACKING_TYPE; + + private String PACKING_DATE; + + private String LastUpdatedDate; + + private Integer State; + + private String location; + +} diff --git a/src/main/java/com/zy/common/service/erp/entity/Voucher.java b/src/main/java/com/zy/common/service/erp/entity/Voucher.java new file mode 100644 index 0000000..79ee0bb --- /dev/null +++ b/src/main/java/com/zy/common/service/erp/entity/Voucher.java @@ -0,0 +1,45 @@ +package com.zy.common.service.erp.entity; + +import lombok.Data; + +/** + * Created by vincent on 2022/12/8 + */ +@Data +public class Voucher { + + private String VoucherID; + + private String MT; + + private String MaterialNO; + + private String CenterID; + + private String Plant; + + private String Loc; + + private String Batch; + + private Double TotalNum; + + private Integer TotalCount; + + private String AccDate; + + private String VBELN; + + private String Customer; + + private Double ExpectedWeight; + + private String Container; + + private String TruckNO; + + private String LastUpdatedDate; + + private Integer State; + +} diff --git a/src/main/java/com/zy/common/service/erp/entity/VoucherDetail.java b/src/main/java/com/zy/common/service/erp/entity/VoucherDetail.java new file mode 100644 index 0000000..ff4be0d --- /dev/null +++ b/src/main/java/com/zy/common/service/erp/entity/VoucherDetail.java @@ -0,0 +1,19 @@ +package com.zy.common.service.erp.entity; + +import lombok.Data; + +/** + * Created by vincent on 2022/12/8 + */ +@Data +public class VoucherDetail { + + private String VoucherID; + + private String Barcode; + + private String PickID; + + private String LastUpdatedDate; + +} diff --git a/src/main/java/com/zy/core/thread/LedThread.java b/src/main/java/com/zy/core/thread/LedThread.java index e37e85a..f7e1687 100644 --- a/src/main/java/com/zy/core/thread/LedThread.java +++ b/src/main/java/com/zy/core/thread/LedThread.java @@ -78,7 +78,10 @@ sb.append("鐩爣绔欙細").append(command.getStaNo()).append("\n"); if (!command.isEmptyMk()) { for (MatDto matDto : command.getMatDtos()) { - sb.append(matDto.getMatnr()).append("-").append(matDto.getBatch()).append("\n"); + sb.append(matDto.getOrderNo()).append("\n"); + sb.append(matDto.getMatnr()).append("\n"); + sb.append(matDto.getModel()).append("\n"); + sb.append(matDto.getTotal()).append("/").append(matDto.getCount()).append("\n"); } } sb.append("\n"); diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 5f25600..11ebe93 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -38,6 +38,13 @@ wms: url: 10.10.10.201:8080/ynwms +erp: + db: + driver_class_name: com.microsoft.sqlserver.jdbc.SQLServerDriver + ur: jdbc:sqlserver://10.20.46.23:1433;databasename=POY_ASRS + username: poy-asrs + password: Poy@2022 + # 涓嬩綅鏈洪厤缃� wcs-slave: # 鍙屾繁 diff --git a/src/main/resources/mapper/OrderDetlMapper.xml b/src/main/resources/mapper/OrderDetlMapper.xml new file mode 100644 index 0000000..4152d97 --- /dev/null +++ b/src/main/resources/mapper/OrderDetlMapper.xml @@ -0,0 +1,215 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.zy.asrs.mapper.OrderDetlMapper"> + + <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 --> + <resultMap id="BaseResultMap" type="com.zy.asrs.entity.OrderDetl"> + <id column="id" property="id" /> + <result column="order_id" property="orderId" /> + <result column="order_no" property="orderNo" /> + <result column="anfme" property="anfme" /> + <result column="qty" property="qty" /> + <result column="matnr" property="matnr" /> + <result column="maktx" property="maktx" /> + <result column="batch" property="batch" /> + + <result column="specs" property="specs" /> + <result column="model" property="model" /> + <result column="color" property="color" /> + <result column="brand" property="brand" /> + <result column="unit" property="unit" /> + <result column="price" property="price" /> + <result column="sku" property="sku" /> + <result column="units" property="units" /> + <result column="barcode" property="barcode" /> + <result column="origin" property="origin" /> + <result column="manu" property="manu" /> + <result column="manu_date" property="manuDate" /> + <result column="item_num" property="itemNum" /> + <result column="safe_qty" property="safeQty" /> + <result column="weight" property="weight" /> + <result column="length" property="length" /> + <result column="volume" property="volume" /> + <result column="three_code" property="threeCode" /> + <result column="supp" property="supp" /> + <result column="supp_code" property="suppCode" /> + <result column="be_batch" property="beBatch" /> + <result column="dead_time" property="deadTime" /> + <result column="dead_warn" property="deadWarn" /> + <result column="source" property="source" /> + <result column="inspect" property="inspect" /> + <result column="danger" property="danger" /> + + <result column="status" property="status" /> + <result column="create_by" property="createBy" /> + <result column="create_time" property="createTime" /> + <result column="update_by" property="updateBy" /> + <result column="update_time" property="updateTime" /> + <result column="memo" property="memo" /> + + </resultMap> + + <select id="selectItem" resultMap="BaseResultMap"> + select * from man_order_detl + where 1=1 + and order_id = #{orderId} + and matnr = #{matnr} + <choose> + <when test="batch != null and batch != ''"> + and batch = #{batch} + </when> + <otherwise> + and (batch IS NULL OR batch = '') + </otherwise> + </choose> + </select> + + <select id="selectItemByOrderNo" resultMap="BaseResultMap"> + select * from man_order_detl + where 1=1 + and order_no = #{orderNo} + and matnr = #{matnr} + <if test="batch!=null and batch!='' "> + and batch = #{batch} + </if> + </select> + + <select id="selectItemNoneOfBatch" resultMap="BaseResultMap"> + select top 1 * from man_order_detl + where 1=1 + and order_no = #{orderNo} + and matnr = #{matnr} + </select> + + <select id="selectItemOfBatch" resultMap="BaseResultMap"> + select top 1 * from man_order_detl + where 1=1 + and matnr = #{matnr} + and batch = #{batch} + </select> + + <select id="selectWorkingDetls" resultMap="BaseResultMap"> + select * from man_order_detl + where 1=1 + and order_id = #{orderId} + and qty < anfme + </select> + + <sql id="pakOutPageCondition"> + <if test="order_id!=null and order_id!='' "> + and mod.order_id = #{order_id} + </if> + <if test="matnr!=null and matnr!='' "> + and mod.matnr like '%' + #{matnr} + '%' + </if> + <if test="maktx!=null and maktx!='' "> + and mod.maktx like '%' + #{maktx} + '%' + </if> + <if test="batch!=null and batch!='' "> + and mod.batch like '%' + #{batch} + '%' + </if> + </sql> + + <select id="getPakoutPage" resultMap="BaseResultMap"> + select * from + ( + select + ROW_NUMBER() over (order by mo.create_time desc) as row, + mod.* + from man_order_detl mod + inner join man_order mo on mod.order_id = mo.id + inner join man_doc_type mdt on mo.doc_type = mdt.doc_id + where 1=1 + and mo.settle <= 2 + and mo.status = 1 + and mdt.pakout = 1 + <include refid="pakOutPageCondition"></include> + ) t where t.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize}) + </select> + + <select id="getPakoutPageCount" parameterType="java.util.Map" resultType="java.lang.Integer"> + select + count(1) + from man_order_detl mod + inner join man_order mo on mod.order_id = mo.id + inner join man_doc_type mdt on mo.doc_type = mdt.doc_id + where 1=1 + and mo.settle <= 2 + and mo.status = 1 + and mdt.pakout = 1 + <include refid="pakOutPageCondition"></include> + </select> + + <update id="increaseAnfme"> + update man_order_detl + set anfme = anfme + #{qty} + where 1=1 + and order_id = #{orderId} + and matnr = #{matnr} + <choose> + <when test="batch != null and batch != ''"> + and batch = #{batch} + </when> + <otherwise> + and (batch IS NULL OR batch = '') + </otherwise> + </choose> + </update> + + <update id="increase"> + update man_order_detl + set qty = qty + #{qty} + where 1=1 + and order_id = #{orderId} + and matnr = #{matnr} + <choose> + <when test="batch != null and batch != ''"> + and batch = #{batch} + </when> + <otherwise> + and (batch IS NULL OR batch = '') + </otherwise> + </choose> + </update> + + <update id="decrease"> + update man_order_detl + set qty = qty - #{qty} + where 1=1 + and order_no = #{orderNo} + and matnr = #{matnr} + <choose> + <when test="batch != null and batch != ''"> + and batch = #{batch} + </when> + <otherwise> + and (batch IS NULL OR batch = '') + </otherwise> + </choose> + </update> + + <update id="modifyStatus"> + update man_order_detl + set status = #{status} + where 1=1 + and order_id = #{orderId} + </update> + + <select id="selectRemainder" resultMap="BaseResultMap"> + select + * + from man_order_detl + where 1=1 + and anfme > qty + and order_id = #{orderId} + </select> + + <select id="selectByMatnr" resultMap="BaseResultMap"> + select + * + from man_order_detl + where 1=1 + and matnr = #{matnr} + </select> + +</mapper> diff --git a/src/main/resources/mapper/OrderMapper.xml b/src/main/resources/mapper/OrderMapper.xml new file mode 100644 index 0000000..19f1d89 --- /dev/null +++ b/src/main/resources/mapper/OrderMapper.xml @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.zy.asrs.mapper.OrderMapper"> + + <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 --> + <resultMap id="BaseResultMap" type="com.zy.asrs.entity.Order"> + <id column="id" property="id" /> + <result column="uuid" property="uuid" /> + <result column="order_no" property="orderNo" /> + <result column="order_time" property="orderTime" /> + <result column="doc_type" property="docType" /> + <result column="item_id" property="itemId" /> + <result column="item_name" property="itemName" /> + <result column="allot_item_id" property="allotItemId" /> + <result column="def_number" property="defNumber" /> + <result column="number" property="number" /> + <result column="cstmr" property="cstmr" /> + <result column="cstmr_name" property="cstmrName" /> + <result column="tel" property="tel" /> + <result column="oper_memb" property="operMemb" /> + <result column="total_fee" property="totalFee" /> + <result column="discount" property="discount" /> + <result column="discount_fee" property="discountFee" /> + <result column="other_fee" property="otherFee" /> + <result column="act_fee" property="actFee" /> + <result column="pay_type" property="payType" /> + <result column="salesman" property="salesman" /> + <result column="account_day" property="accountDay" /> + <result column="post_fee_type" property="postFeeType" /> + <result column="post_fee" property="postFee" /> + <result column="pay_time" property="payTime" /> + <result column="send_time" property="sendTime" /> + <result column="ship_name" property="shipName" /> + <result column="ship_code" property="shipCode" /> + <result column="settle" property="settle" /> + <result column="status" property="status" /> + <result column="create_by" property="createBy" /> + <result column="create_time" property="createTime" /> + <result column="update_by" property="updateBy" /> + <result column="update_time" property="updateTime" /> + <result column="memo" property="memo" /> + + </resultMap> + + <select id="selectByOrderNo" resultMap="BaseResultMap"> + select top 1 * + from man_order + where 1=1 + and order_no = #{orderNo} + </select> + + <update id="updateSettle"> + update man_order + set settle = #{settle} + ,update_time = getdate() + <if test="userId != null"> + ,update_by = #{userId} + </if> + where 1=1 + and id = #{orderId} + </update> + + <select id="selectComplete" resultMap="BaseResultMap"> + select top 5 * + from man_order + where 1=1 + and settle = 4 + and status = 1 + order by create_time asc + </select> + +</mapper> -- Gitblit v1.9.1