瀏覽代碼

增加棒三上若撤回功能,并且导出时屏蔽已撤回的数据

lingpeng.li 4 周之前
父節點
當前提交
03d265da5b

+ 2 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubThree/controller/RollClubThreeDetailsController.java

@@ -299,6 +299,8 @@ public class RollClubThreeDetailsController extends JeecgController<RollClubThre
             if (oConvertUtils.isNotEmpty(storageBillPrint.getBrandNum())) {
                 queryWrapper.eq("brand_num", storageBillPrint.getBrandNum());
             }
+
+            queryWrapper.eq("withdraw_status",0);
             // 根据到站时间排序
             queryWrapper.orderByDesc("arrival_time");
             List<StorageBillPrint> exportList = storageBillPrintService.list(queryWrapper);

+ 2 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollOutShipp/controller/RollOutShippDetailsController.java

@@ -295,6 +295,8 @@ public class RollOutShippDetailsController extends JeecgController<RollOutShippD
 			if (oConvertUtils.isNotEmpty(storageBillPrint.getBrandNum())) {
 				queryWrapper.eq("brand_num", storageBillPrint.getBrandNum());
 			}
+
+			queryWrapper.eq("withdraw_status",0);
 			// 根据到站时间排序
 			queryWrapper.orderByDesc("arrival_time");
 			List<StorageBillPrint> exportList = storageBillPrintService.list(queryWrapper);

+ 46 - 29
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/controller/StorageBillPrintController.java

@@ -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
     }
 
 
-
-
 }

+ 23 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/entity/StorageBillPrint.java

@@ -175,6 +175,29 @@ public class StorageBillPrint implements Serializable {
     @ApiModelProperty(value = "备注")
     private String remark;
 
+    /**
+     * 撤回状态  0 未撤回  1 已撤回
+     */
+    @Excel(name = "撤回状态", width = 15)
+    @ApiModelProperty(value = "撤回状态")
+    private Integer withdrawStatus;
+
+    /**
+     * 撤回原因
+     */
+    @Excel(name = "撤回原因", width = 15)
+    @ApiModelProperty(value = "撤回原因")
+    private String withdrawReason;
+
+    /**
+     * 撤回时间
+     */
+    @Excel(name = "撤回时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "撤回时间")
+    private Date withdrawTime;
+
     /**
      * 时间(某一天)
      */

+ 23 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/vo/StorageBillPrintVO.java

@@ -94,4 +94,27 @@ public class StorageBillPrintVO {
     @ApiModelProperty(value = "冷坯/热坯")
     private String btype;
 
+    /**
+     * 撤回状态  0 未撤回  1 已撤回
+     */
+    @Excel(name = "撤回状态", width = 15)
+    @ApiModelProperty(value = "撤回状态")
+    private Integer withdrawStatus;
+
+    /**
+     * 撤回原因
+     */
+    @Excel(name = "撤回原因", width = 15)
+    @ApiModelProperty(value = "撤回原因")
+    private String withdrawReason;
+
+    /**
+     * 撤回时间
+     */
+    @Excel(name = "撤回时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "撤回时间")
+    private Date withdrawTime;
+
 }