# Conflicts:
#	ym-packing/src/main/java/com/cnbm/packing/service/WoPackagingBoxServiceBiz.java
#	ym-packing/src/main/java/com/cnbm/packing/service/WoPackagingBoxSubstrateServiceBiz.java
#	ym-packing/src/main/java/com/cnbm/packing/service/impl/WoPackagingBoxServiceBizImpl.java
This commit is contained in:
caixiang 2023-02-24 08:47:56 +08:00
commit 161b5b5be4
12 changed files with 141 additions and 46 deletions

View File

@ -126,4 +126,13 @@ public class WoPackagingBoxController {
// @LogOperation("获取列表") // @LogOperation("获取列表")
public List<WoPackagingBoxDTO> list() { return woPackagingBoxService.list(); } public List<WoPackagingBoxDTO> list() { return woPackagingBoxService.list(); }
@PostMapping(value = "printList/{id}")
@ApiOperation(value = "包装箱打印列表")
public Result<WoPackagingBoxDTO> printList(@PathVariable("id") Long id) {
WoPackagingBoxDTO data = woPackagingBoxService.printList(id);
return new Result<WoPackagingBoxDTO>().ok(data);
}
} }

View File

@ -12,6 +12,7 @@ import com.cnbm.common.validator.ValidatorUtils;
import com.cnbm.common.validator.group.AddGroup; import com.cnbm.common.validator.group.AddGroup;
import com.cnbm.common.validator.group.DefaultGroup; import com.cnbm.common.validator.group.DefaultGroup;
import com.cnbm.common.validator.group.UpdateGroup; import com.cnbm.common.validator.group.UpdateGroup;
import com.cnbm.packing.dto.ChangePackingBoxDTO;
import com.cnbm.packing.dto.WoPackagingBoxSubstrateDTO; import com.cnbm.packing.dto.WoPackagingBoxSubstrateDTO;
import com.cnbm.packing.entity.WoPackagingBox; import com.cnbm.packing.entity.WoPackagingBox;
import com.cnbm.packing.entity.WoPackagingBoxSubstrate; import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
@ -141,12 +142,12 @@ public class WoPackagingBoxSubstrateController {
@PostMapping("insertSubstrate") @PostMapping("insertSubstrate")
@ApiOperation("合箱") @ApiOperation("合箱")
// @LogOperation("合箱") // @LogOperation("合箱")
public Result insertSubstrate(@RequestBody WoPackagingBoxSubstrateDTO dto){ public Result insertSubstrate(@RequestBody ChangePackingBoxDTO dto){
String woSubstrateId = dto.getWoSubstrateId(); String woSubstrateId = dto.getWoSubstrateId();
//验证模组是否存在 //验证模组是否存在
QueryWrapper<WoPackagingBoxSubstrate> substrateQueryWrapper1 = new QueryWrapper<>(); QueryWrapper<WoPackagingBoxSubstrate> substrateQueryWrapper1 = new QueryWrapper<>();
substrateQueryWrapper1.eq(StringUtils.isNotBlank(woSubstrateId), "woSubstrateId", woSubstrateId); substrateQueryWrapper1.eq(StringUtils.isNotBlank(woSubstrateId), WoPackagingBoxSubstrate.WO_SUBSTRATE_ID, woSubstrateId);
if(woPackagingBoxSubstrateMapper.selectCount(substrateQueryWrapper1 )== 0){ if(woPackagingBoxSubstrateMapper.selectCount(substrateQueryWrapper1 )== 0){
return new Result().error(1,"该模组不存在,请重新输入"); return new Result().error(1,"该模组不存在,请重新输入");
} }
@ -158,8 +159,8 @@ public class WoPackagingBoxSubstrateController {
//验证slot是否被占用 //验证slot是否被占用
QueryWrapper<WoPackagingBoxSubstrate> substrateQueryWrapper2 = new QueryWrapper<>(); QueryWrapper<WoPackagingBoxSubstrate> substrateQueryWrapper2 = new QueryWrapper<>();
substrateQueryWrapper2.eq(StringUtils.isNotBlank(dto.getPackagingBoxId()), "packagingBoxId", dto.getPackagingBoxId()); substrateQueryWrapper2.eq(StringUtils.isNotBlank(dto.getPackagingBoxId()), WoPackagingBoxSubstrate.PACKAGING_BOX_ID, dto.getPackagingBoxId());
substrateQueryWrapper2.eq(ObjectUtils.isNotNull(dto.getSlot()), "slot", dto.getSlot()); substrateQueryWrapper2.eq(ObjectUtils.isNotNull(dto.getSlot()), WoPackagingBoxSubstrate.SLOT, dto.getSlot());
if(woPackagingBoxSubstrateMapper.selectCount(substrateQueryWrapper2) != 0){ if(woPackagingBoxSubstrateMapper.selectCount(substrateQueryWrapper2) != 0){
return new Result().error(1,"该slot已被占用"); return new Result().error(1,"该slot已被占用");
} }
@ -167,7 +168,7 @@ public class WoPackagingBoxSubstrateController {
//验证该模组的线体功率等级是否BoxID的线体功率等级一致一致保存成功数据发生更新不一致则显示保存失败数据不发生更新 //验证该模组的线体功率等级是否BoxID的线体功率等级一致一致保存成功数据发生更新不一致则显示保存失败数据不发生更新
String packagingBoxId = dto.getPackagingBoxId(); String packagingBoxId = dto.getPackagingBoxId();
QueryWrapper<WoPackagingBox> boxQueryWrapper = new QueryWrapper<>(); QueryWrapper<WoPackagingBox> boxQueryWrapper = new QueryWrapper<>();
boxQueryWrapper.eq(StringUtils.isNotBlank(packagingBoxId), "boxNo", packagingBoxId); boxQueryWrapper.eq(StringUtils.isNotBlank(packagingBoxId), WoPackagingBox.BOX_NO, packagingBoxId);
WoPackagingBox box = woPackagingBoxMapper.selectList(boxQueryWrapper).get(0); WoPackagingBox box = woPackagingBoxMapper.selectList(boxQueryWrapper).get(0);
if((substrate.getLineBody()==box.getLineBody()) && (substrate.getPowerLevel()==box.getPowerLevel()) ) if((substrate.getLineBody()==box.getLineBody()) && (substrate.getPowerLevel()==box.getPowerLevel()) )
@ -184,7 +185,7 @@ public class WoPackagingBoxSubstrateController {
@PostMapping("replaceSubstrate") @PostMapping("replaceSubstrate")
@ApiOperation("换箱") @ApiOperation("换箱")
// @LogOperation("换箱") // @LogOperation("换箱")
public Result replaceSubstrate(@RequestBody WoPackagingBoxSubstrateDTO[] dtos){ public Result replaceSubstrate(@RequestBody ChangePackingBoxDTO[] dtos){
woPackagingBoxSubstrateService.replaceSubstrate(dtos); woPackagingBoxSubstrateService.replaceSubstrate(dtos);
@ -194,11 +195,11 @@ public class WoPackagingBoxSubstrateController {
@PostMapping("slotValidation") @PostMapping("slotValidation")
@ApiOperation("slot是否占用验证") @ApiOperation("slot是否占用验证")
// @LogOperation("slot是否占用验证") // @LogOperation("slot是否占用验证")
public boolean slotValidation(@RequestBody WoPackagingBoxSubstrateDTO dto){ public boolean slotValidation(@RequestBody ChangePackingBoxDTO dto){
QueryWrapper<WoPackagingBoxSubstrate> wrapper = new QueryWrapper<>(); QueryWrapper<WoPackagingBoxSubstrate> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(dto.getPackagingBoxId()), "packagingBoxId", dto.getPackagingBoxId()); wrapper.eq(StringUtils.isNotBlank(dto.getPackagingBoxId()), WoPackagingBoxSubstrate.PACKAGING_BOX_ID, dto.getPackagingBoxId());
wrapper.eq(ObjectUtils.isNotNull(dto.getSlot()), "slot", dto.getSlot()); wrapper.eq(ObjectUtils.isNotNull(dto.getSlot()), WoPackagingBoxSubstrate.SLOT, dto.getSlot());
if(woPackagingBoxSubstrateMapper.selectCount(wrapper) == 0){ if(woPackagingBoxSubstrateMapper.selectCount(wrapper) == 0){
return true; return true;
} }
@ -207,12 +208,12 @@ public class WoPackagingBoxSubstrateController {
} }
} }
@PostMapping("batchInsert") @PostMapping("insertSubstrateManual")
@ApiOperation("手动装箱") @ApiOperation("手动装箱")
// @LogOperation("手动装箱") // @LogOperation("手动装箱")
public Result batchInsert(@RequestBody WoPackagingBoxSubstrateDTO[] lists){ public Result insertSubstrateManual(@RequestBody ChangePackingBoxDTO dto){
woPackagingBoxSubstrateService.batchInsert(lists); woPackagingBoxSubstrateService.insertSubstrateManual(dto);
return new Result(); return new Result();
} }

View File

@ -127,30 +127,13 @@ public class WoPackagingPrintHistoryController {
} }
@PostMapping("print/{id}") @PostMapping("print/{id}")
@ApiOperation("打印") @ApiOperation("打印记录")
// @LogOperation("打印") // @LogOperation("打印")
public Result<Long> print(@PathVariable("id") Long id) { public Result<Long> print(@PathVariable("id") Long id) {
WoPackagingBoxDTO woPackagingBox = woPackagingBoxServiceBiz.get(id); woPackagingPrintHistoryService.print(id);
WoPackagingPrintHistoryDTO woPackagingPrintHistory = new WoPackagingPrintHistoryDTO(); return new Result();
BeanUtils.copyProperties(woPackagingBox, woPackagingPrintHistory);
woPackagingPrintHistory.setId(null);
woPackagingPrintHistory.setPrintTime(LocalDateTime.now());
//效验数据
ValidatorUtils.validateEntity(woPackagingPrintHistory, AddGroup.class, DefaultGroup.class);
woPackagingPrintHistoryService.save(woPackagingPrintHistory);
//更新包装箱表中打印状态和时间
woPackagingBox.setPrintTime(woPackagingPrintHistory.getPrintTime());
if(woPackagingBox.getPrintStatus()==0){
woPackagingBox.setPrintCount(1);
woPackagingBox.setPrintStatus(WhetherEnum.YES.getValue());
}
else{
woPackagingBox.setPrintCount(woPackagingBox.getPrintCount()+1);
}
return new Result<Long>().ok(woPackagingPrintHistory.getId());
} }
} }

View File

@ -0,0 +1,25 @@
package com.cnbm.packing.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
@ApiModel(value = "包装箱与基板关联变化对象")
public class ChangePackingBoxDTO implements Serializable {
@ApiModelProperty(value = "WoPackagingBoxSubstrate.id")
private Long id;
@ApiModelProperty(value = "包装箱IDBoxId")
private String packagingBoxId;
@ApiModelProperty(value = "基板ID")
private String woSubstrateId;
@ApiModelProperty(value = "箱中位置")
private Integer slot;
}

View File

@ -1,5 +1,6 @@
package com.cnbm.packing.dto; package com.cnbm.packing.dto;
import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -8,6 +9,7 @@ import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List;
/** /**
@ -113,4 +115,7 @@ public class WoPackagingBoxDTO implements Serializable {
@ApiModelProperty(value = "订单号") @ApiModelProperty(value = "订单号")
private String orderNum; private String orderNum;
@ApiModelProperty(value = "基板列表")
private List<WoPackagingBoxSubstrate> substrateList;;
} }

View File

@ -5,7 +5,6 @@ import com.cnbm.common.service.CrudService;
import com.cnbm.packing.dto.WoPackagingBoxDTO; import com.cnbm.packing.dto.WoPackagingBoxDTO;
import com.cnbm.packing.dto.WoPackagingBoxDTO; import com.cnbm.packing.dto.WoPackagingBoxDTO;
import com.cnbm.packing.entity.WoPackagingBox; import com.cnbm.packing.entity.WoPackagingBox;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -30,5 +29,8 @@ public interface WoPackagingBoxServiceBiz extends CrudService<WoPackagingBox, Wo
List<WoPackagingBoxDTO> list(); List<WoPackagingBoxDTO> list();
WoPackagingBoxDTO printList(Long id);
int updateIsArrivedByBoxNo(Integer isArrived, String boxNo); int updateIsArrivedByBoxNo(Integer isArrived, String boxNo);
} }

View File

@ -4,7 +4,6 @@ import com.cnbm.common.page.PageData;
import com.cnbm.common.service.CrudService; import com.cnbm.common.service.CrudService;
import com.cnbm.packing.dto.WoPackagingBoxSubstrateDTO; import com.cnbm.packing.dto.WoPackagingBoxSubstrateDTO;
import com.cnbm.packing.entity.WoPackagingBoxSubstrate; import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
import org.apache.ibatis.annotations.Param;
import java.util.Map; import java.util.Map;
@ -28,10 +27,12 @@ public interface WoPackagingBoxSubstrateServiceBiz extends CrudService<WoPackagi
void removeSubstrate(Long id); void removeSubstrate(Long id);
void insertSubstrate(WoPackagingBoxSubstrateDTO dto); void insertSubstrate(ChangePackingBoxDTO dto);
void replaceSubstrate(WoPackagingBoxSubstrateDTO[] dtos); void replaceSubstrate(ChangePackingBoxDTO[] dtos);
void insertSubstrateManual(ChangePackingBoxDTO dto);
void batchInsert(WoPackagingBoxSubstrateDTO[] lists); void batchInsert(WoPackagingBoxSubstrateDTO[] lists);
WoPackagingBoxSubstrate getBySubId(String subId); WoPackagingBoxSubstrate getBySubId(String subId);

View File

@ -27,5 +27,7 @@ public interface WoPackagingPrintHistoryServiceBiz extends CrudService<WoPackagi
void delete(Long[] ids); void delete(Long[] ids);
List<WoPackagingPrintHistoryDTO> list(); List<WoPackagingPrintHistoryDTO> list();
void print(Long id);
} }

View File

@ -8,7 +8,11 @@ import com.cnbm.common.service.impl.CrudServiceImpl;
import com.cnbm.common.utils.ConvertUtils; import com.cnbm.common.utils.ConvertUtils;
import com.cnbm.packing.dto.WoPackagingBoxDTO; import com.cnbm.packing.dto.WoPackagingBoxDTO;
import com.cnbm.packing.entity.WoPackagingBox; import com.cnbm.packing.entity.WoPackagingBox;
import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
import com.cnbm.packing.entity.WoPowerLevel;
import com.cnbm.packing.mapper.WoPackagingBoxMapper; import com.cnbm.packing.mapper.WoPackagingBoxMapper;
import com.cnbm.packing.mapper.WoPackagingBoxMapper;
import com.cnbm.packing.mapper.WoPackagingBoxSubstrateMapper;
import com.cnbm.packing.service.WoPackagingBoxServiceBiz; import com.cnbm.packing.service.WoPackagingBoxServiceBiz;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -103,6 +107,17 @@ public class WoPackagingBoxServiceBizImpl extends CrudServiceImpl<WoPackagingBox
return list; return list;
} }
@Override
public WoPackagingBoxDTO printList(Long id) {
WoPackagingBox entity = baseDao.selectById(id);
WoPackagingBoxDTO dto = ConvertUtils.sourceToTarget(entity, WoPackagingBoxDTO.class);
QueryWrapper<WoPackagingBoxSubstrate> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(entity.getBoxNo()), WoPackagingBoxSubstrate.PACKAGING_BOX_ID, entity.getBoxNo());
List<WoPackagingBoxSubstrate> woPackagingBoxSubstrateList = substrateMapper.selectList(wrapper);
dto.setSubstrateList(woPackagingBoxSubstrateList);
return dto;
}
@Override @Override
public int updateIsArrivedByBoxNo(Integer isArrived, String boxNo) { public int updateIsArrivedByBoxNo(Integer isArrived, String boxNo) {
return mapper.updateIsArrivedByBoxNo(isArrived,boxNo); return mapper.updateIsArrivedByBoxNo(isArrived,boxNo);

View File

@ -9,6 +9,7 @@ import com.cnbm.common.utils.ConvertUtils;
import com.cnbm.common.validator.ValidatorUtils; import com.cnbm.common.validator.ValidatorUtils;
import com.cnbm.common.validator.group.AddGroup; import com.cnbm.common.validator.group.AddGroup;
import com.cnbm.common.validator.group.DefaultGroup; import com.cnbm.common.validator.group.DefaultGroup;
import com.cnbm.packing.dto.ChangePackingBoxDTO;
import com.cnbm.packing.dto.WoPackagingBoxSubstrateDTO; import com.cnbm.packing.dto.WoPackagingBoxSubstrateDTO;
import com.cnbm.packing.entity.ChangePackagingBoxHistory; import com.cnbm.packing.entity.ChangePackagingBoxHistory;
import com.cnbm.packing.entity.WoPackagingBoxSubstrate; import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
@ -41,6 +42,9 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl<WoPac
@Autowired @Autowired
private WoPackagingBoxSubstrateMapper mapper; private WoPackagingBoxSubstrateMapper mapper;
@Autowired
private WoPackagingBoxSubstrateMapper mapper;
@Override @Override
public QueryWrapper<WoPackagingBoxSubstrate> getWrapper(Map<String, Object> params){ public QueryWrapper<WoPackagingBoxSubstrate> getWrapper(Map<String, Object> params){
String packagingBoxId = (String) params.get("packagingBoxId"); String packagingBoxId = (String) params.get("packagingBoxId");
@ -114,7 +118,7 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl<WoPac
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void insertSubstrate(WoPackagingBoxSubstrateDTO dto) { public void insertSubstrate(ChangePackingBoxDTO dto) {
WoPackagingBoxSubstrate entity = baseDao.selectById(dto.getId()); WoPackagingBoxSubstrate entity = baseDao.selectById(dto.getId());
//合箱写入包装箱拆合箱历史表 //合箱写入包装箱拆合箱历史表
ChangePackagingBoxHistory changePackagingBoxHistory = new ChangePackagingBoxHistory(); ChangePackagingBoxHistory changePackagingBoxHistory = new ChangePackagingBoxHistory();
@ -132,14 +136,14 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl<WoPac
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void replaceSubstrate(WoPackagingBoxSubstrateDTO[] dtos) { public void replaceSubstrate(ChangePackingBoxDTO[] dtos) {
for(WoPackagingBoxSubstrateDTO dto : dtos){ for(ChangePackingBoxDTO dto : dtos){
WoPackagingBoxSubstrate entity = baseDao.selectById(dto.getId()); WoPackagingBoxSubstrate entity = baseDao.selectById(dto.getId());
//换箱写入包装箱拆合箱历史表 //换箱写入包装箱拆合箱历史表
ChangePackagingBoxHistory changePackagingBoxHistory = new ChangePackagingBoxHistory(); ChangePackagingBoxHistory changePackagingBoxHistory = new ChangePackagingBoxHistory();
changePackagingBoxHistory.setSubstrateId(dto.getWoSubstrateId()); changePackagingBoxHistory.setSubstrateId(entity.getWoSubstrateId());
changePackagingBoxHistory.setTargetBoxNo(entity.getPackagingBoxId()); changePackagingBoxHistory.setSourceBoxNo(entity.getPackagingBoxId());
changePackagingBoxHistory.setTargetSlot(entity.getSlot()); changePackagingBoxHistory.setSourceSlot(entity.getSlot());
changePackagingBoxHistory.setTargetBoxNo(dto.getPackagingBoxId()); changePackagingBoxHistory.setTargetBoxNo(dto.getPackagingBoxId());
changePackagingBoxHistory.setTargetSlot(dto.getSlot()); changePackagingBoxHistory.setTargetSlot(dto.getSlot());
changePackagingBoxHistory.setType(3); changePackagingBoxHistory.setType(3);
@ -153,9 +157,18 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl<WoPac
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void batchInsert(WoPackagingBoxSubstrateDTO[] lists) { public void insertSubstrateManual(ChangePackingBoxDTO dto) {
for(WoPackagingBoxSubstrateDTO dto:lists){
if(dto.getWoSubstrateId()==null){ QueryWrapper<WoPackagingBoxSubstrate> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(dto.getWoSubstrateId()),WoPackagingBoxSubstrate.WO_SUBSTRATE_ID,dto.getWoSubstrateId());
if(mapper.selectCount(wrapper)>0 && StringUtils.isNotBlank(dto.getWoSubstrateId())) {
WoPackagingBoxSubstrate substrate = mapper.selectList(wrapper).get(0);
substrate.setPackagingBoxId(dto.getPackagingBoxId());
updateById(substrate);
}
else{
//模组ID有时为空用户会输入无码
if(dto.getWoSubstrateId()==null) {
dto.setWoSubstrateId("无码"); dto.setWoSubstrateId("无码");
} }
//效验数据 //效验数据

View File

@ -3,9 +3,14 @@ package com.cnbm.packing.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.cnbm.admin.enums.WhetherEnum;
import com.cnbm.common.page.PageData; import com.cnbm.common.page.PageData;
import com.cnbm.common.service.impl.CrudServiceImpl; import com.cnbm.common.service.impl.CrudServiceImpl;
import com.cnbm.common.utils.ConvertUtils; import com.cnbm.common.utils.ConvertUtils;
import com.cnbm.common.validator.ValidatorUtils;
import com.cnbm.common.validator.group.AddGroup;
import com.cnbm.common.validator.group.DefaultGroup;
import com.cnbm.packing.dto.WoPackagingBoxDTO;
import com.cnbm.packing.dto.WoPackagingPrintHistoryDTO; import com.cnbm.packing.dto.WoPackagingPrintHistoryDTO;
import com.cnbm.packing.dto.WoPackagingPrintHistoryDTO; import com.cnbm.packing.dto.WoPackagingPrintHistoryDTO;
import com.cnbm.packing.entity.WoPackagingBox; import com.cnbm.packing.entity.WoPackagingBox;
@ -13,8 +18,10 @@ import com.cnbm.packing.entity.WoPackagingPrintHistory;
import com.cnbm.packing.entity.WoPackagingPrintHistory; import com.cnbm.packing.entity.WoPackagingPrintHistory;
import com.cnbm.packing.mapper.WoPackagingPrintHistoryMapper; import com.cnbm.packing.mapper.WoPackagingPrintHistoryMapper;
import com.cnbm.packing.mapper.WoPackagingPrintHistoryMapper; import com.cnbm.packing.mapper.WoPackagingPrintHistoryMapper;
import com.cnbm.packing.service.WoPackagingBoxServiceBiz;
import com.cnbm.packing.service.WoPackagingPrintHistoryServiceBiz; import com.cnbm.packing.service.WoPackagingPrintHistoryServiceBiz;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -36,6 +43,9 @@ public class WoPackagingPrintHistoryServiceBizImpl extends CrudServiceImpl<WoPac
@Autowired @Autowired
private WoPackagingPrintHistoryMapper mapper; private WoPackagingPrintHistoryMapper mapper;
@Autowired
private WoPackagingBoxServiceBiz woPackagingBoxServiceBiz;
@Override @Override
public QueryWrapper<WoPackagingPrintHistory> getWrapper(Map<String, Object> params){ public QueryWrapper<WoPackagingPrintHistory> getWrapper(Map<String, Object> params){
LocalDateTime startTime = (LocalDateTime) params.get("startTime"); LocalDateTime startTime = (LocalDateTime) params.get("startTime");
@ -92,5 +102,28 @@ public class WoPackagingPrintHistoryServiceBizImpl extends CrudServiceImpl<WoPac
return list; return list;
} }
@Override
@Transactional(rollbackFor = Exception.class)
public void print(Long id) {
WoPackagingBoxDTO woPackagingBox = woPackagingBoxServiceBiz.get(id);
WoPackagingPrintHistory woPackagingPrintHistory = new WoPackagingPrintHistory();
BeanUtils.copyProperties(woPackagingBox, woPackagingPrintHistory);
woPackagingPrintHistory.setId(null);
woPackagingPrintHistory.setPrintTime(LocalDateTime.now());
insert(woPackagingPrintHistory);
//更新包装箱表中打印状态和时间
woPackagingBox.setPrintTime(woPackagingPrintHistory.getPrintTime());
if(woPackagingBox.getPrintStatus()==0){
woPackagingBox.setPrintCount(1);
woPackagingBox.setPrintStatus(1);
}
else{
woPackagingBox.setPrintCount(woPackagingBox.getPrintCount()+1);
}
woPackagingBoxServiceBiz.update(woPackagingBox);
}
} }

View File

@ -55,7 +55,13 @@
<select id="list" resultType="com.cnbm.packing.dto.WoPackagingBoxSubstrateDTO"> <select id="list" resultType="com.cnbm.packing.dto.WoPackagingBoxSubstrateDTO">
select * from t_wo_packaging_box_substrate select * from t_wo_packaging_box_substrate
order by id asc <where>
valid = 1
<if test="packagingBoxId != null">
and PACKAGING_BOX_ID = #{packagingBoxId}
</if>
</where>
order by slot asc
</select> </select>
<select id="getOneByWoSubstrateId" resultMap="WoPackagingBoxSubstrateMap"> <select id="getOneByWoSubstrateId" resultMap="WoPackagingBoxSubstrateMap">
select select