|
|
|
@ -5,11 +5,14 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import com.gaotao.common.constant.SysMsgConstant; |
|
|
|
import com.gaotao.common.utils.GenDate; |
|
|
|
import com.gaotao.modules.app.entity.UserEntity; |
|
|
|
import com.gaotao.modules.label.entity.PrintLabelRecord; |
|
|
|
import com.gaotao.modules.label.mapper.PrintLabelRecordMapper; |
|
|
|
import com.gaotao.modules.label.service.PrintLabelRecordService; |
|
|
|
import com.gaotao.modules.sys.entity.SysUserEntity; |
|
|
|
import com.gaotao.modules.sys.service.SysMsgService; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.shiro.SecurityUtils; |
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
@ -67,9 +70,19 @@ public class PrintLabelRecordServiceImpl extends ServiceImpl<PrintLabelRecordMap |
|
|
|
|
|
|
|
int boxNoSerial = 0; |
|
|
|
List<PrintLabelRecord> printLabelRecordList = new ArrayList<>(); |
|
|
|
// BigDecimal remainder = printLabelRecord.getCartonCount().remainder(printLabelRecord.getQtyPerCarton()); |
|
|
|
for (int j = 1; j <= cartonCount.intValue(); j++) { |
|
|
|
boxNoSerial = boxNumber + j; |
|
|
|
|
|
|
|
List<PrintLabelRecord> list = new ArrayList<>(); |
|
|
|
// 获得当前登录用户 |
|
|
|
SysUserEntity userEntity = (SysUserEntity) SecurityUtils.getSubject().getPrincipal(); |
|
|
|
// 判断是否需要打印SN |
|
|
|
if ("Alpha/Hard Tag-Serials".equalsIgnoreCase(printLabelRecord.getCategory()) && "Y".equalsIgnoreCase(userEntity.getAutoSerialNumber())){ |
|
|
|
printLabelRecord.setCreateTime(new Date()); |
|
|
|
// 获取SN |
|
|
|
list = baseMapper.autoCreateSerialNumber(printLabelRecord, cartonCount.intValue()); |
|
|
|
} |
|
|
|
// 打印张数 |
|
|
|
for (int i = 1; i <= cartonCount.intValue(); i++) { |
|
|
|
boxNoSerial = boxNumber + i; |
|
|
|
printLabelRecord.setBoxNo(buNoDate+String.format("%0"+boxNum+"d", boxNoSerial)); |
|
|
|
LocalDate localDate = LocalDate.of(printLabelRecord.getManufacturerTime().getYear() + 1900, |
|
|
|
printLabelRecord.getManufacturerTime().getMonth()+1,printLabelRecord.getManufacturerTime().getDate()); |
|
|
|
@ -77,6 +90,10 @@ public class PrintLabelRecordServiceImpl extends ServiceImpl<PrintLabelRecordMap |
|
|
|
PrintLabelRecord target = new PrintLabelRecord(); |
|
|
|
BeanUtils.copyProperties(printLabelRecord,target); |
|
|
|
target.setCreateTime(new Date()); |
|
|
|
if (!list.isEmpty()){ |
|
|
|
target.setSerialNumber(list.get(i-1).getSerialNumber()); |
|
|
|
target.setDateStr(list.get(i-1).getDateStr()); |
|
|
|
} |
|
|
|
save(target); |
|
|
|
printLabelRecordList.add(target); |
|
|
|
} |
|
|
|
|