|
@@ -5,11 +5,11 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
-import lombok.Data;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
@@ -17,7 +17,6 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
|
|
import org.jeecg.common.system.base.controller.JeecgController;
|
|
|
-import org.jeecg.common.system.query.QueryGenerator;
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
|
import org.jeecg.common.util.DateUtils;
|
|
|
import org.jeecg.common.util.SpringContextUtils;
|
|
@@ -26,36 +25,27 @@ import org.jeecg.modules.actualControl.billetActual.billetActual.entity.BilletRu
|
|
|
import org.jeecg.modules.actualControl.billetActual.billetActual.mapper.BilletRulerConfigMapper;
|
|
|
import org.jeecg.modules.billet.billetHotsendChangeShift.entity.BilletHotsendChangeShift;
|
|
|
import org.jeecg.modules.billet.billetHotsendChangeShift.service.IBilletHotsendChangeShiftService;
|
|
|
-import org.jeecg.modules.billet.billetOriginalProductRecord.entity.BilletOriginalProductRecord;
|
|
|
import org.jeecg.modules.billet.rollClubThree.entity.RollClubThreeDetails;
|
|
|
import org.jeecg.modules.billet.rollClubThree.service.IRollClubThreeDetailsService;
|
|
|
import org.jeecg.modules.billet.rollClubTwo.entity.RollClubTwoDetails;
|
|
|
import org.jeecg.modules.billet.rollClubTwo.service.IRollClubTwoDetailsService;
|
|
|
import org.jeecg.modules.billet.rollDeputyCross.entity.RollDeputyCrossDetails;
|
|
|
import org.jeecg.modules.billet.rollDeputyCross.service.IRollDeputyCrossDetailsService;
|
|
|
-import org.jeecg.modules.billet.rollOutShipp.entity.RollOutShipp;
|
|
|
import org.jeecg.modules.billet.rollOutShipp.entity.RollOutShippDetails;
|
|
|
import org.jeecg.modules.billet.rollOutShipp.service.IRollOutShippDetailsService;
|
|
|
import org.jeecg.modules.billet.storageBill.entity.StorageBill;
|
|
|
import org.jeecg.modules.billet.storageBill.entity.StorageBillPrint;
|
|
|
import org.jeecg.modules.billet.storageBill.service.IStorageBillPrintService;
|
|
|
import org.jeecg.modules.billet.storageBill.service.IStorageBillService;
|
|
|
-import org.jeecg.modules.billet.storageBill.vo.StorageBillPrintVO;
|
|
|
import org.jeecg.modules.billet.storageBill.vo.StorageCenterExportRow;
|
|
|
import org.jeecg.modules.carUnit.entity.SysDict;
|
|
|
import org.jeecg.modules.carUnit.entity.SysDictItem;
|
|
|
import org.jeecg.modules.carUnit.mapper.CarUnitMapper;
|
|
|
import org.jeecg.modules.carUnit.service.ISysDictItemService;
|
|
|
import org.jeecg.modules.carUnit.service.ISysDictService;
|
|
|
-import org.jeecg.modules.deviceSbm.entity.DeviceInformation;
|
|
|
-import org.jeecg.modules.deviceSbm.entity.DeviceRegion;
|
|
|
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
|
-import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
|
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
-import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
@@ -136,12 +126,12 @@ public class StorageBillPrintController extends JeecgController<StorageBillPrint
|
|
|
// 目的地
|
|
|
queryWrapper.eq("destination", storageBillPrint.getDestination());
|
|
|
Boolean search = true; // 定义未传任何条件
|
|
|
- if(oConvertUtils.isNotEmpty(changeShiftId)) { // 班组取班组时间
|
|
|
+ if (oConvertUtils.isNotEmpty(changeShiftId)) { // 班组取班组时间
|
|
|
// 根据铸机号、交班记录ID,获取交班记录中的班别、班次、创建时间
|
|
|
LambdaQueryWrapper<BilletHotsendChangeShift> changeQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
changeQueryWrapper.eq(BilletHotsendChangeShift::getId, changeShiftId).eq(BilletHotsendChangeShift::getCcmNo, ccmNo);
|
|
|
BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(changeQueryWrapper);
|
|
|
- if (billetHotsendChangeShift == null){
|
|
|
+ if (billetHotsendChangeShift == null) {
|
|
|
return Result.OK();
|
|
|
}
|
|
|
Date startChnageTime = billetHotsendChangeShift.getCreateTime();
|
|
@@ -152,20 +142,20 @@ public class StorageBillPrintController extends JeecgController<StorageBillPrint
|
|
|
queryWrapper.ge("arrival_time", startChnageTime) // 大于等于开始时间
|
|
|
.le("arrival_time", endChnageTime); // 小于等于结束时间
|
|
|
search = false;
|
|
|
- }else if(oConvertUtils.isNotEmpty(startTime) && oConvertUtils.isNotEmpty(endTime)){ // 时间范围
|
|
|
+ } else if (oConvertUtils.isNotEmpty(startTime) && oConvertUtils.isNotEmpty(endTime)) { // 时间范围
|
|
|
// 修改时间范围查询条件为 >= startTime 且 <= endTime
|
|
|
queryWrapper.ge("arrival_time", startTime) // 大于等于开始时间
|
|
|
.le("arrival_time", endTime); // 小于等于结束时间
|
|
|
search = false;
|
|
|
}
|
|
|
// 如果什么条件都没有默认当日
|
|
|
- if(oConvertUtils.isNotEmpty(queryDate) || search == true){ // 具体时间
|
|
|
+ if (oConvertUtils.isNotEmpty(queryDate) || search == true) { // 具体时间
|
|
|
// 获取当前年月日
|
|
|
queryDate = oConvertUtils.isNotEmpty(queryDate) ? queryDate : DateUtils.getDate("yyyy-MM-dd");
|
|
|
Date startArrivalTime = DateUtils.getStartOfDayByDate(DateUtils.getStartOfDay(queryDate));
|
|
|
// 结束时间 减一个小时
|
|
|
Date endArrivalTime = DateUtils.getEndOfDayByDate(startArrivalTime);
|
|
|
- log.info("查询时间范围:startTime={}, endTime={}",startArrivalTime, endArrivalTime);
|
|
|
+ log.info("查询时间范围:startTime={}, endTime={}", startArrivalTime, endArrivalTime);
|
|
|
// 修改时间范围查询条件为 >= startTime 且 <= endTime
|
|
|
queryWrapper.ge("arrival_time", startArrivalTime) // 大于等于开始时间
|
|
|
.le("arrival_time", endArrivalTime); // 小于等于结束时间
|
|
@@ -223,13 +213,13 @@ public class StorageBillPrintController extends JeecgController<StorageBillPrint
|
|
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
|
|
public Result<String> edit(@RequestBody StorageBillPrint storageBillPrint) {
|
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
- if(oConvertUtils.isNotEmpty(storageBillPrint.getConfirmTime())){
|
|
|
+ if (oConvertUtils.isNotEmpty(storageBillPrint.getConfirmTime())) {
|
|
|
storageBillPrint.setConfirmBy(sysUser.getRealname());
|
|
|
// 修改确认时间
|
|
|
storageBillPrint.setConfirmTime(new Date());
|
|
|
// 同步修改装运单storageBill 确认时间
|
|
|
StorageBill storageBillInfo = storageBillService.getById(storageBillPrint.getStorageBillId());
|
|
|
- if(oConvertUtils.isNotEmpty(storageBillInfo)){
|
|
|
+ if (oConvertUtils.isNotEmpty(storageBillInfo)) {
|
|
|
storageBillInfo.setConfirmTime(storageBillPrint.getConfirmTime());
|
|
|
storageBillInfo.setConfirmBy(sysUser.getRealname());
|
|
|
storageBillInfo.setRemark(storageBillPrint.getRemark());
|
|
@@ -312,6 +302,8 @@ public class StorageBillPrintController extends JeecgController<StorageBillPrint
|
|
|
// 修改时间范围查询条件为 >= startTime 且 <= endTime
|
|
|
queryWrapper.ge("arrival_time", startTime) // 大于等于开始时间
|
|
|
.le("arrival_time", endTime); // 小于等于结束时间
|
|
|
+
|
|
|
+ queryWrapper.eq("withdraw_status",0);
|
|
|
// Step.2 获取导出数据
|
|
|
// 打印完整的查询条件
|
|
|
log.info("最终查询条件:{}", queryWrapper.getSqlSegment());
|
|
@@ -368,18 +360,18 @@ public class StorageBillPrintController extends JeecgController<StorageBillPrint
|
|
|
newItem.setAmountTotal(0);
|
|
|
newItem.setWeight(BigDecimal.ZERO);
|
|
|
// 根据装运单ID、炉号、铸机号、定尺、目的地查询对应的明细信息
|
|
|
- if ("棒二".equals(item.getDestination())){
|
|
|
+ if ("棒二".equals(item.getDestination())) {
|
|
|
LambdaQueryWrapper<RollClubTwoDetails> queryWrapper2 = new LambdaQueryWrapper<>();
|
|
|
queryWrapper2.eq(RollClubTwoDetails::getStorageBillId, item.getId())
|
|
|
- .eq(RollClubTwoDetails::getCcmNo, item.getCcmNo())
|
|
|
- .eq(RollClubTwoDetails::getSize, sizes[i])
|
|
|
- .eq(RollClubTwoDetails::getHeatNo, item.getHeatNo());
|
|
|
+ .eq(RollClubTwoDetails::getCcmNo, item.getCcmNo())
|
|
|
+ .eq(RollClubTwoDetails::getSize, sizes[i])
|
|
|
+ .eq(RollClubTwoDetails::getHeatNo, item.getHeatNo());
|
|
|
List<RollClubTwoDetails> rollClubTwoDetailsList = rollClubTwoDetailsService.list(queryWrapper2);
|
|
|
if (rollClubTwoDetailsList.size() > 0) {
|
|
|
newItem.setAmountTotal(rollClubTwoDetailsList.size());
|
|
|
newItem.setWeight(BigDecimal.valueOf(rollClubTwoDetailsList.stream().mapToDouble(RollClubTwoDetails::getBlankOutput).sum()));
|
|
|
}
|
|
|
- }else if ("棒三".equals(item.getDestination())){
|
|
|
+ } else if ("棒三".equals(item.getDestination())) {
|
|
|
LambdaQueryWrapper<RollClubThreeDetails> queryWrapper3 = new LambdaQueryWrapper<>();
|
|
|
queryWrapper3.eq(RollClubThreeDetails::getStorageBillId, item.getId())
|
|
|
.eq(RollClubThreeDetails::getCcmNo, item.getCcmNo())
|
|
@@ -390,7 +382,7 @@ public class StorageBillPrintController extends JeecgController<StorageBillPrint
|
|
|
newItem.setAmountTotal(rollClubThreeDetailsList.size());
|
|
|
newItem.setWeight(BigDecimal.valueOf(rollClubThreeDetailsList.stream().mapToDouble(RollClubThreeDetails::getBlankOutput).sum()));
|
|
|
}
|
|
|
- }else if ("上若".equals(item.getDestination())){
|
|
|
+ } else if ("上若".equals(item.getDestination())) {
|
|
|
LambdaQueryWrapper<RollOutShippDetails> queryWrapper4 = new LambdaQueryWrapper<>();
|
|
|
queryWrapper4.eq(RollOutShippDetails::getStorageBillId, item.getId())
|
|
|
.eq(RollOutShippDetails::getCcmNo, item.getCcmNo())
|
|
@@ -401,7 +393,7 @@ public class StorageBillPrintController extends JeecgController<StorageBillPrint
|
|
|
newItem.setAmountTotal(rollOutShippDetailsList.size());
|
|
|
newItem.setWeight(BigDecimal.valueOf(rollOutShippDetailsList.stream().mapToDouble(RollOutShippDetails::getBlankOutput).sum()));
|
|
|
}
|
|
|
- }else if ("付跨".equals(item.getDestination())){
|
|
|
+ } else if ("付跨".equals(item.getDestination())) {
|
|
|
LambdaQueryWrapper<RollDeputyCrossDetails> queryWrapper5 = new LambdaQueryWrapper<>();
|
|
|
queryWrapper5.eq(RollDeputyCrossDetails::getStorageBillId, item.getId())
|
|
|
.eq(RollDeputyCrossDetails::getCcmNo, item.getCcmNo())
|
|
@@ -471,8 +463,8 @@ public class StorageBillPrintController extends JeecgController<StorageBillPrint
|
|
|
EasyExcel.write(response.getOutputStream(), StorageCenterExportRow.class)
|
|
|
.sheet("装运打印信息")
|
|
|
.doWrite(exportRows);
|
|
|
- }catch (Exception e){
|
|
|
- log.error("导出Excel失败:", e);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("导出Excel失败:", e);
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -519,6 +511,33 @@ public class StorageBillPrintController extends JeecgController<StorageBillPrint
|
|
|
return "其他";
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 撤销装运打印单
|
|
|
+ *
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "撤回单个装运打印单")
|
|
|
+ @ApiOperation(value = "撤回单个装运打印单", notes = "撤回单个装运打印单")
|
|
|
+ @RequestMapping(value = "/withdrawPrint", method = {RequestMethod.PUT})
|
|
|
+ public Result<String> withdrawPrint(@RequestBody StorageBillPrint param) {
|
|
|
+ StorageBillPrint existing = storageBillPrintService.getById(param.getId());
|
|
|
+ if (existing == null) {
|
|
|
+ return Result.error("未找到对应打印单数据,撤销失败!");
|
|
|
+ }
|
|
|
+
|
|
|
+ UpdateWrapper<StorageBillPrint> updateWrapper = new UpdateWrapper<>();
|
|
|
+ updateWrapper.eq("id", param.getId())
|
|
|
+ .set("withdraw_status", 1)
|
|
|
+ .set("withdraw_reason", param.getWithdrawReason())
|
|
|
+ .set("withdraw_time", new Date());
|
|
|
+
|
|
|
+ storageBillPrintService.update(updateWrapper);
|
|
|
+
|
|
|
+ return Result.OK("撤销成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
private static String getDictId(String dictCode) {
|
|
|
ISysDictService sysDictService = SpringContextUtils.getBean(ISysDictService.class);
|
|
|
SysDict dict = sysDictService.getOne(
|
|
@@ -563,6 +582,4 @@ public class StorageBillPrintController extends JeecgController<StorageBillPrint
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
}
|