yanyang #18

Merged
yanyang merged 2 commits from yanyang into master 2023-03-06 21:03:43 +08:00
10 changed files with 83 additions and 7 deletions

View File

@ -11,6 +11,7 @@ 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.ChangePackagingBoxHistoryDTO; import com.cnbm.packing.dto.ChangePackagingBoxHistoryDTO;
import com.cnbm.packing.entity.ChangePackagingBoxHistory;
import com.cnbm.packing.excel.ChangePackagingBoxHistoryExcel; import com.cnbm.packing.excel.ChangePackagingBoxHistoryExcel;
import com.cnbm.packing.service.ChangePackagingBoxHistoryServiceBiz; import com.cnbm.packing.service.ChangePackagingBoxHistoryServiceBiz;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -117,7 +118,7 @@ public class ChangePackagingBoxHistoryController {
}) })
@PreAuthorize("@ex.hasAuthority('packing:changePackagingBoxHistory:export')") @PreAuthorize("@ex.hasAuthority('packing:changePackagingBoxHistory:export')")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<ChangePackagingBoxHistoryDTO> list = changePackagingBoxHistoryService.list(params); List<ChangePackagingBoxHistory> list = changePackagingBoxHistoryService.historyList(params);
if(list.size()>0) { if(list.size()>0) {
ExcelUtils.exportExcelToTarget(response, "包装箱模组操作记录", list, ChangePackagingBoxHistoryExcel.class); ExcelUtils.exportExcelToTarget(response, "包装箱模组操作记录", list, ChangePackagingBoxHistoryExcel.class);
} }

View File

@ -159,4 +159,13 @@ public class WoPackagingBoxController {
return woPackagingBoxService.boxList(woSubstrateId); return woPackagingBoxService.boxList(woSubstrateId);
} }
@PostMapping("insertSubstrateManual")
@ApiOperation("手动新增包装箱")
@LogOperation("手动新增包装箱")
public IdVo insertSubstrateManual(@RequestBody WoPackagingBoxDTO dto){
return woPackagingBoxService.insertSubstrateManual(dto);
}
} }

View File

@ -277,4 +277,14 @@ public class WoPackagingBoxSubstrateController {
return new Result(); return new Result();
} }
@PostMapping("updateSubstrateManual")
@ApiOperation("手动装箱编辑")
@LogOperation("手动装箱编辑")
public Result updateSubstrateManual(@RequestBody ChangePackingBoxDTO[] dtos){
woPackagingBoxSubstrateService.updateSubstrateManual(dtos);
return new Result();
}
} }

View File

@ -28,4 +28,6 @@ public interface ChangePackagingBoxHistoryServiceBiz extends CrudService<ChangeP
List<ChangePackagingBoxHistoryDTO> list(Map<String, Object> params); List<ChangePackagingBoxHistoryDTO> list(Map<String, Object> params);
List<ChangePackagingBoxHistory> historyList(Map<String, Object> params);
} }

View File

@ -40,6 +40,8 @@ public interface WoPackagingBoxServiceBiz extends CrudService<WoPackagingBox, Wo
List<WoPackagingBox> boxList (String woSubstrateId); List<WoPackagingBox> boxList (String woSubstrateId);
IdVo insertSubstrateManual(WoPackagingBoxDTO dto);
int updateIsArrivedByBoxNo(Integer isArrived, String boxNo); int updateIsArrivedByBoxNo(Integer isArrived, String boxNo);

View File

@ -34,6 +34,8 @@ public interface WoPackagingBoxSubstrateServiceBiz extends CrudService<WoPackagi
void insertSubstrateManual(ChangePackingBoxDTO[] dtos); void insertSubstrateManual(ChangePackingBoxDTO[] dtos);
void updateSubstrateManual(ChangePackingBoxDTO[] dtos);
WoPackagingBoxSubstrate getBySubId(String subId); WoPackagingBoxSubstrate getBySubId(String subId);

View File

@ -48,6 +48,9 @@ public class ChangePackagingBoxHistoryServiceBizImpl extends CrudServiceImpl<Cha
Integer type = Integer.parseInt( params.get("type").toString()); Integer type = Integer.parseInt( params.get("type").toString());
wrapper.eq(ObjectUtils.isNotNull(type), ChangePackagingBoxHistory.TYPE, type); wrapper.eq(ObjectUtils.isNotNull(type), ChangePackagingBoxHistory.TYPE, type);
} }
if(params.get("startTime")==null && params.get("endTime")==null && params.get("type")==null){
wrapper.apply(true, "TO_DAYS(NOW())-TO_DAYS(create_time) = 0");
}
return wrapper; return wrapper;
} }
@ -97,4 +100,12 @@ public class ChangePackagingBoxHistoryServiceBizImpl extends CrudServiceImpl<Cha
return list; return list;
} }
@Override
@Transactional(rollbackFor = Exception.class)
public List<ChangePackagingBoxHistory> historyList(Map<String, Object> params) {
QueryWrapper<ChangePackagingBoxHistory> wrapper = getWrapper(params);
List<ChangePackagingBoxHistory> historyList = mapper.selectList(wrapper);
return historyList;
}
} }

View File

@ -16,6 +16,7 @@ import com.cnbm.packing.mapper.WoPackagingBoxMapper;
import com.cnbm.packing.mapper.WoPackagingBoxSubstrateMapper; import com.cnbm.packing.mapper.WoPackagingBoxSubstrateMapper;
import com.cnbm.packing.param.PowerReportQueryParam; import com.cnbm.packing.param.PowerReportQueryParam;
import com.cnbm.packing.service.WoPackagingBoxServiceBiz; import com.cnbm.packing.service.WoPackagingBoxServiceBiz;
import com.cnbm.packing.service.WoPackagingBoxSubstrateServiceBiz;
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;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -41,6 +42,8 @@ public class WoPackagingBoxServiceBizImpl extends CrudServiceImpl<WoPackagingBox
private WoPackagingBoxMapper mapper; private WoPackagingBoxMapper mapper;
@Autowired @Autowired
private WoPackagingBoxSubstrateMapper substrateMapper; private WoPackagingBoxSubstrateMapper substrateMapper;
@Autowired
private WoPackagingBoxSubstrateServiceBiz woPackagingBoxSubstrateServiceBiz;
@Override @Override
@ -68,6 +71,9 @@ public class WoPackagingBoxServiceBizImpl extends CrudServiceImpl<WoPackagingBox
Integer model = Integer.parseInt(params.get("model").toString()); Integer model = Integer.parseInt(params.get("model").toString());
wrapper.eq(ObjectUtils.isNotNull(model), WoPackagingBox.MODEL, model); wrapper.eq(ObjectUtils.isNotNull(model), WoPackagingBox.MODEL, model);
} }
if(params.get("startTime")==null && params.get("endTime")==null && params.get("boxNo")==null && params.get("lineBody")==null && params.get("printStatus")==null){
wrapper.apply(true, "TO_DAYS(NOW())-TO_DAYS(create_time) = 0");
}
return wrapper; return wrapper;
} }
@ -153,13 +159,31 @@ public class WoPackagingBoxServiceBizImpl extends CrudServiceImpl<WoPackagingBox
List<WoPackagingBox> boxList = new ArrayList<>(); List<WoPackagingBox> boxList = new ArrayList<>();
for(WoPackagingBoxSubstrate substrate: substrateList){ for(WoPackagingBoxSubstrate substrate: substrateList){
QueryWrapper<WoPackagingBox> boxQueryWrapper = new QueryWrapper<>(); QueryWrapper<WoPackagingBox> boxQueryWrapper = new QueryWrapper<>();
boxQueryWrapper.eq(StringUtils.isNotBlank(substrate.getPackagingBoxId()), WoPackagingBox.BOX_NO, substrate.getPackagingBoxId()); boxQueryWrapper.like(StringUtils.isNotBlank(substrate.getPackagingBoxId()), WoPackagingBox.BOX_NO, substrate.getPackagingBoxId());
List<WoPackagingBox> woPackagingBoxList = mapper.selectList(boxQueryWrapper); List<WoPackagingBox> woPackagingBoxList = mapper.selectList(boxQueryWrapper);
boxList.addAll(woPackagingBoxList); boxList.addAll(woPackagingBoxList);
} }
return boxList; return boxList;
} }
@Override
@Transactional(rollbackFor = Exception.class)
public IdVo insertSubstrateManual(WoPackagingBoxDTO dto) {
//新增包装箱
WoPackagingBox box = ConvertUtils.sourceToTarget(dto, WoPackagingBox.class);
BaseSupportUtils.setCommonField(box);
insert(box);
//新增模组
List<WoPackagingBoxSubstrate> substrateList = dto.getSubstrateList();
for(WoPackagingBoxSubstrate substrate : substrateList){
substrate.setPackagingBoxId(box.getBoxNo());
substrate.setPowerLevel(box.getPowerLevel());
BaseSupportUtils.setCommonField(substrate);
woPackagingBoxSubstrateServiceBiz.insert(substrate);
}
return IdVo.builder().id(box.getId()).build();
}
@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

@ -163,8 +163,12 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl<WoPac
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void insertSubstrateManual(ChangePackingBoxDTO[] dtos) { public void insertSubstrateManual(ChangePackingBoxDTO[] dtos) {
for(ChangePackingBoxDTO dto : dtos) { for(ChangePackingBoxDTO dto : dtos) {
QueryWrapper<WoPackagingBoxSubstrate> wrapper = new QueryWrapper<>(); // QueryWrapper<WoPackagingBoxSubstrate> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(dto.getWoSubstrateId()), WoPackagingBoxSubstrate.WO_SUBSTRATE_ID, dto.getWoSubstrateId()); // wrapper.eq(StringUtils.isNotBlank(dto.getWoSubstrateId()), WoPackagingBoxSubstrate.WO_SUBSTRATE_ID, dto.getWoSubstrateId());
WoPackagingBoxSubstrate entity = ConvertUtils.sourceToTarget(dto, WoPackagingBoxSubstrate.class);
BaseSupportUtils.setCommonField(entity);
insert(entity);
/*
if (mapper.selectCount(wrapper) > 0 && StringUtils.isNotBlank(dto.getWoSubstrateId())) { if (mapper.selectCount(wrapper) > 0 && StringUtils.isNotBlank(dto.getWoSubstrateId())) {
WoPackagingBoxSubstrate substrate = mapper.selectList(wrapper).get(0); WoPackagingBoxSubstrate substrate = mapper.selectList(wrapper).get(0);
substrate.setPackagingBoxId(dto.getPackagingBoxId()); substrate.setPackagingBoxId(dto.getPackagingBoxId());
@ -181,6 +185,17 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl<WoPac
BaseSupportUtils.setCommonField(entity); BaseSupportUtils.setCommonField(entity);
insert(entity); insert(entity);
} }
*/
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateSubstrateManual(ChangePackingBoxDTO[] dtos) {
for(ChangePackingBoxDTO dto : dtos) {
WoPackagingBoxSubstrate entity = ConvertUtils.sourceToTarget(dto, WoPackagingBoxSubstrate.class);
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity);
} }
} }

View File

@ -32,7 +32,7 @@
and type = #{type} and type = #{type}
</if> </if>
</where> </where>
order by id asc order by CREATE_TIME desc
</select> </select>
</mapper> </mapper>