手动装箱更新 默认显示当天

This commit is contained in:
闫阳 2023-03-06 21:02:54 +08:00
parent 4fd5498f1e
commit ddc2343842
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.UpdateGroup;
import com.cnbm.packing.dto.ChangePackagingBoxHistoryDTO;
import com.cnbm.packing.entity.ChangePackagingBoxHistory;
import com.cnbm.packing.excel.ChangePackagingBoxHistoryExcel;
import com.cnbm.packing.service.ChangePackagingBoxHistoryServiceBiz;
import io.swagger.annotations.Api;
@ -117,7 +118,7 @@ public class ChangePackagingBoxHistoryController {
})
@PreAuthorize("@ex.hasAuthority('packing:changePackagingBoxHistory:export')")
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) {
ExcelUtils.exportExcelToTarget(response, "包装箱模组操作记录", list, ChangePackagingBoxHistoryExcel.class);
}

View File

@ -159,4 +159,13 @@ public class WoPackagingBoxController {
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();
}
@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<ChangePackagingBoxHistory> historyList(Map<String, Object> params);
}

View File

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

View File

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

View File

@ -48,6 +48,9 @@ public class ChangePackagingBoxHistoryServiceBizImpl extends CrudServiceImpl<Cha
Integer type = Integer.parseInt( params.get("type").toString());
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;
}
@ -55,8 +58,8 @@ public class ChangePackagingBoxHistoryServiceBizImpl extends CrudServiceImpl<Cha
@Override
public PageData<ChangePackagingBoxHistoryDTO> page (Map<String, Object> params){
IPage<ChangePackagingBoxHistory> page = baseDao.selectPage(
getPage(params, ChangePackagingBoxHistory.CREATE_TIME, true),
getWrapper(params)
getPage(params, ChangePackagingBoxHistory.CREATE_TIME, true),
getWrapper(params)
);
return getPageData(page, ChangePackagingBoxHistoryDTO.class);
}
@ -97,4 +100,12 @@ public class ChangePackagingBoxHistoryServiceBizImpl extends CrudServiceImpl<Cha
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.param.PowerReportQueryParam;
import com.cnbm.packing.service.WoPackagingBoxServiceBiz;
import com.cnbm.packing.service.WoPackagingBoxSubstrateServiceBiz;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -41,6 +42,8 @@ public class WoPackagingBoxServiceBizImpl extends CrudServiceImpl<WoPackagingBox
private WoPackagingBoxMapper mapper;
@Autowired
private WoPackagingBoxSubstrateMapper substrateMapper;
@Autowired
private WoPackagingBoxSubstrateServiceBiz woPackagingBoxSubstrateServiceBiz;
@Override
@ -68,6 +71,9 @@ public class WoPackagingBoxServiceBizImpl extends CrudServiceImpl<WoPackagingBox
Integer model = Integer.parseInt(params.get("model").toString());
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;
}
@ -153,13 +159,31 @@ public class WoPackagingBoxServiceBizImpl extends CrudServiceImpl<WoPackagingBox
List<WoPackagingBox> boxList = new ArrayList<>();
for(WoPackagingBoxSubstrate substrate: substrateList){
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);
boxList.addAll(woPackagingBoxList);
}
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
public int updateIsArrivedByBoxNo(Integer isArrived, String boxNo) {
return mapper.updateIsArrivedByBoxNo(isArrived,boxNo);

View File

@ -163,8 +163,12 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl<WoPac
@Transactional(rollbackFor = Exception.class)
public void insertSubstrateManual(ChangePackingBoxDTO[] dtos) {
for(ChangePackingBoxDTO dto : dtos) {
QueryWrapper<WoPackagingBoxSubstrate> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(dto.getWoSubstrateId()), WoPackagingBoxSubstrate.WO_SUBSTRATE_ID, dto.getWoSubstrateId());
// QueryWrapper<WoPackagingBoxSubstrate> wrapper = new QueryWrapper<>();
// 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())) {
WoPackagingBoxSubstrate substrate = mapper.selectList(wrapper).get(0);
substrate.setPackagingBoxId(dto.getPackagingBoxId());
@ -181,6 +185,17 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl<WoPac
BaseSupportUtils.setCommonField(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}
</if>
</where>
order by id asc
order by CREATE_TIME desc
</select>
</mapper>