add:新增包装标签打印

This commit is contained in:
zhangzhiqiang
2023-08-15 20:03:57 +08:00
parent aa54150593
commit 02d39afbd5
4 changed files with 42 additions and 13 deletions

View File

@@ -35,7 +35,7 @@ import org.springframework.web.bind.annotation.RestController;
})
@ServletComponentScan
@EnableTransactionManagement
@EnableJpaAuditing(auditorAwareRef = "auditorAware")
//@EnableJpaAuditing(auditorAwareRef = "auditorAware")
@EnableMethodCache(basePackages = "org.nl")
@EnableCreateCacheAnnotation

View File

@@ -1,6 +1,8 @@
package org.nl.wms.mps_manage.other.service.orderExt.dao;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import lombok.Data;
@@ -21,6 +23,11 @@ public class MpsSaleOrderIcExt implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "orderext_id")
private String orderext_id;
/**
* 销售单标识
*/

View File

@@ -3,7 +3,10 @@ package org.nl.wms.mps_manage.saleorder.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.commons.lang3.StringUtils;
import org.nl.common.anno.Log;
import org.nl.common.utils.IdUtil;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.wms.mps_manage.other.service.orderExt.IMpsSaleOrderIcExtService;
import org.nl.wms.mps_manage.other.service.orderExt.dao.MpsSaleOrderIcExt;
import org.nl.wms.product_manage.service.workorder.IPdmProduceWorkorderService;
@@ -15,6 +18,9 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 生产订单扩展表 前端控制器
@@ -44,16 +50,41 @@ public class MpsSaleOrderIcExtController {
@Log("根据工单获取条码")
//("根据工单获取条码")
public ResponseEntity<Object> getExtList(@RequestBody JSONObject whereJson) {
String workorder_code = whereJson.getString("workorder_code");
if (StringUtils.isEmpty(whereJson.getString("sale_id"))){throw new BadRequestException("当前工单没有绑定订单无法打印");};
if (whereJson.getInteger("print_num")==null){throw new BadRequestException("没有设置打印标签数量");};
MpsSaleOrderIcExt one = extService.getOne(new QueryWrapper<MpsSaleOrderIcExt>()
.eq("sale_id", whereJson.getString("sale_id")).eq("material_code", whereJson.getString("material_code")));
int print_no = 0;
if (one==null){
one = new MpsSaleOrderIcExt();
one.setSale_id(whereJson.getString("sale_id"));
one.setMaterial_code(whereJson.getString("material_code"));
}else {
print_no = one.getPrint_no();
}
return new ResponseEntity<>(extService.list(new QueryWrapper<MpsSaleOrderIcExt>().eq("remark1",whereJson.getString("workorder_code"))),HttpStatus.OK);
List<String> barCodes = new ArrayList<>();
for (int i =0;i<whereJson.getInteger("print_num");i++){
String bar_code = whereJson.getString("workorder_code") + whereJson.getString("is_flip") + whereJson.getString("target_roadway") + String.format("%05d", print_no + i+1);
barCodes.add(bar_code);
}
one.setPrint_no(print_no+whereJson.getInteger("print_num"));
if (one.getOrderext_id() == null){
one.setOrderext_id(IdUtil.getStringId());
extService.save(one);
}else {
extService.updateById(one);
}
return new ResponseEntity<>(barCodes,HttpStatus.OK);
}
public static void main(String[] args) {
int print_no = 0;
for (int i =0;i<5;i++){
String bar_code = String.format("%05d", print_no + i+1);
System.out.println(bar_code);
}
System.out.println(print_no + 5);
}
}

View File

@@ -9,15 +9,6 @@ spring:
redis:
repositories:
enabled: false
#配置 Jpa
jpa:
hibernate:
ddl-auto: none
open-in-view: true
properties:
hibernate:
dialect: org.hibernate.dialect.MySQL5InnoDBDialect
task:
pool:
# 核心线程池大小