Browse Source

新增装运单确认接口跟轧钢平台退坯接口

lingpeng.li 1 day ago
parent
commit
3e3b8f6295

+ 2 - 0
zgztBus/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java

@@ -178,6 +178,8 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/billet/billetOriginalProductRecord/queryBilletRecordByCcmNo", "anon");
         //排除铸坯装运单接收测试接口
         filterChainDefinitionMap.put("/actualControl/shippingPushRecord/receiveShippingOrder", "anon");
+        //排除装运单确认接口
+        filterChainDefinitionMap.put("/actualControl/shippingPushRecord/confirmShippingOrder", "anon");
 
         // update-begin--author:liusq Date:20230522 for:[issues/4829]访问不存在的url时会提示Token失效,请重新登录呢
         //错误路径排除

+ 214 - 137
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/actualControl/billetActual/billetActual/controller/ShippingPushRecordController.java

@@ -1,5 +1,6 @@
 package org.jeecg.modules.actualControl.billetActual.billetActual.controller;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -11,10 +12,16 @@ 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.util.oConvertUtils;
+import org.jeecg.modules.actualControl.billetActual.billetActual.dto.StorageBillConfirmDTO;
 import org.jeecg.modules.actualControl.billetActual.billetActual.entity.ShippingPushRecord;
 import org.jeecg.modules.actualControl.billetActual.billetActual.service.IShippingPushRecordService;
 import org.jeecg.modules.actualControl.billetActual.billetActual.vo.BilletPushResponse;
 import org.jeecg.modules.actualControl.billetActual.billetActual.vo.ShippingOrderVO;
+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.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
@@ -24,126 +31,133 @@ import org.springframework.web.servlet.ModelAndView;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.util.Arrays;
+import java.util.Collections;
+import java.util.Date;
+import java.util.Optional;
 
- /**
+/**
  * @Description: 装运单推送记录表
  * @Author: jeecg-boot
- * @Date:   2025-07-22
+ * @Date: 2025-07-22
  * @Version: V1.0
  */
-@Api(tags="装运单推送记录表")
+@Api(tags = "装运单推送记录表")
 @RestController
 @RequestMapping("/actualControl/shippingPushRecord")
 @Slf4j
 public class ShippingPushRecordController extends JeecgController<ShippingPushRecord, IShippingPushRecordService> {
-	@Autowired
-	private IShippingPushRecordService shippingPushRecordService;
-	
-	/**
-	 * 分页列表查询
-	 *
-	 * @param shippingPushRecord
-	 * @param pageNo
-	 * @param pageSize
-	 * @param req
-	 * @return
-	 */
-	//@AutoLog(value = "装运单推送记录表-分页列表查询")
-	@ApiOperation(value="装运单推送记录表-分页列表查询", notes="装运单推送记录表-分页列表查询")
-	@GetMapping(value = "/list")
-	public Result<IPage<ShippingPushRecord>> queryPageList(ShippingPushRecord shippingPushRecord,
-								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
-								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
-								   HttpServletRequest req) {
-		QueryWrapper<ShippingPushRecord> queryWrapper = QueryGenerator.initQueryWrapper(shippingPushRecord, req.getParameterMap());
-		Page<ShippingPushRecord> page = new Page<ShippingPushRecord>(pageNo, pageSize);
-		IPage<ShippingPushRecord> pageList = shippingPushRecordService.page(page, queryWrapper);
-		return Result.OK(pageList);
-	}
-	
-	/**
-	 *   添加
-	 *
-	 * @param shippingPushRecord
-	 * @return
-	 */
-	@AutoLog(value = "装运单推送记录表-添加")
-	@ApiOperation(value="装运单推送记录表-添加", notes="装运单推送记录表-添加")
-	@RequiresPermissions("actualControl:shipping_push_record:add")
-	@PostMapping(value = "/add")
-	public Result<String> add(@RequestBody ShippingPushRecord shippingPushRecord) {
-		shippingPushRecordService.save(shippingPushRecord);
-		return Result.OK("添加成功!");
-	}
-	
-	/**
-	 *  编辑
-	 *
-	 * @param shippingPushRecord
-	 * @return
-	 */
-	@AutoLog(value = "装运单推送记录表-编辑")
-	@ApiOperation(value="装运单推送记录表-编辑", notes="装运单推送记录表-编辑")
-	@RequiresPermissions("actualControl:shipping_push_record:edit")
-	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
-	public Result<String> edit(@RequestBody ShippingPushRecord shippingPushRecord) {
-		shippingPushRecordService.updateById(shippingPushRecord);
-		return Result.OK("编辑成功!");
-	}
-	
-	/**
-	 *   通过id删除
-	 *
-	 * @param id
-	 * @return
-	 */
-	@AutoLog(value = "装运单推送记录表-通过id删除")
-	@ApiOperation(value="装运单推送记录表-通过id删除", notes="装运单推送记录表-通过id删除")
-	@RequiresPermissions("actualControl:shipping_push_record:delete")
-	@DeleteMapping(value = "/delete")
-	public Result<String> delete(@RequestParam(name="id",required=true) String id) {
-		shippingPushRecordService.removeById(id);
-		return Result.OK("删除成功!");
-	}
-	
-	/**
-	 *  批量删除
-	 *
-	 * @param ids
-	 * @return
-	 */
-	@AutoLog(value = "装运单推送记录表-批量删除")
-	@ApiOperation(value="装运单推送记录表-批量删除", notes="装运单推送记录表-批量删除")
-	@RequiresPermissions("actualControl:shipping_push_record:deleteBatch")
-	@DeleteMapping(value = "/deleteBatch")
-	public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-		this.shippingPushRecordService.removeByIds(Arrays.asList(ids.split(",")));
-		return Result.OK("批量删除成功!");
-	}
-	
-	/**
-	 * 通过id查询
-	 *
-	 * @param id
-	 * @return
-	 */
-	//@AutoLog(value = "装运单推送记录表-通过id查询")
-	@ApiOperation(value="装运单推送记录表-通过id查询", notes="装运单推送记录表-通过id查询")
-	@GetMapping(value = "/queryById")
-	public Result<ShippingPushRecord> queryById(@RequestParam(name="id",required=true) String id) {
-		ShippingPushRecord shippingPushRecord = shippingPushRecordService.getById(id);
-		if(shippingPushRecord==null) {
-			return Result.error("未找到对应数据");
-		}
-		return Result.OK(shippingPushRecord);
-	}
+    @Autowired
+    private IShippingPushRecordService shippingPushRecordService;
+    @Autowired
+    private IStorageBillService storageBillService;
+    @Autowired
+    private IStorageBillPrintService storageBillPrintService;
 
     /**
-    * 导出excel
-    *
-    * @param request
-    * @param shippingPushRecord
-    */
+     * 分页列表查询
+     *
+     * @param shippingPushRecord
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    //@AutoLog(value = "装运单推送记录表-分页列表查询")
+    @ApiOperation(value = "装运单推送记录表-分页列表查询", notes = "装运单推送记录表-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<ShippingPushRecord>> queryPageList(ShippingPushRecord shippingPushRecord,
+                                                           @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                           @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                           HttpServletRequest req) {
+        QueryWrapper<ShippingPushRecord> queryWrapper = QueryGenerator.initQueryWrapper(shippingPushRecord, req.getParameterMap());
+        Page<ShippingPushRecord> page = new Page<ShippingPushRecord>(pageNo, pageSize);
+        IPage<ShippingPushRecord> pageList = shippingPushRecordService.page(page, queryWrapper);
+        return Result.OK(pageList);
+    }
+
+    /**
+     * 添加
+     *
+     * @param shippingPushRecord
+     * @return
+     */
+    @AutoLog(value = "装运单推送记录表-添加")
+    @ApiOperation(value = "装运单推送记录表-添加", notes = "装运单推送记录表-添加")
+    @RequiresPermissions("actualControl:shipping_push_record:add")
+    @PostMapping(value = "/add")
+    public Result<String> add(@RequestBody ShippingPushRecord shippingPushRecord) {
+        shippingPushRecordService.save(shippingPushRecord);
+        return Result.OK("添加成功!");
+    }
+
+    /**
+     * 编辑
+     *
+     * @param shippingPushRecord
+     * @return
+     */
+    @AutoLog(value = "装运单推送记录表-编辑")
+    @ApiOperation(value = "装运单推送记录表-编辑", notes = "装运单推送记录表-编辑")
+    @RequiresPermissions("actualControl:shipping_push_record:edit")
+    @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
+    public Result<String> edit(@RequestBody ShippingPushRecord shippingPushRecord) {
+        shippingPushRecordService.updateById(shippingPushRecord);
+        return Result.OK("编辑成功!");
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "装运单推送记录表-通过id删除")
+    @ApiOperation(value = "装运单推送记录表-通过id删除", notes = "装运单推送记录表-通过id删除")
+    @RequiresPermissions("actualControl:shipping_push_record:delete")
+    @DeleteMapping(value = "/delete")
+    public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
+        shippingPushRecordService.removeById(id);
+        return Result.OK("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "装运单推送记录表-批量删除")
+    @ApiOperation(value = "装运单推送记录表-批量删除", notes = "装运单推送记录表-批量删除")
+    @RequiresPermissions("actualControl:shipping_push_record:deleteBatch")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        this.shippingPushRecordService.removeByIds(Arrays.asList(ids.split(",")));
+        return Result.OK("批量删除成功!");
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    //@AutoLog(value = "装运单推送记录表-通过id查询")
+    @ApiOperation(value = "装运单推送记录表-通过id查询", notes = "装运单推送记录表-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<ShippingPushRecord> queryById(@RequestParam(name = "id", required = true) String id) {
+        ShippingPushRecord shippingPushRecord = shippingPushRecordService.getById(id);
+        if (shippingPushRecord == null) {
+            return Result.error("未找到对应数据");
+        }
+        return Result.OK(shippingPushRecord);
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param shippingPushRecord
+     */
     @RequiresPermissions("actualControl:shipping_push_record:exportXls")
     @RequestMapping(value = "/exportXls")
     public ModelAndView exportXls(HttpServletRequest request, ShippingPushRecord shippingPushRecord) {
@@ -151,39 +165,102 @@ public class ShippingPushRecordController extends JeecgController<ShippingPushRe
     }
 
     /**
-      * 通过excel导入数据
-    *
-    * @param request
-    * @param response
-    * @return
-    */
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
     @RequiresPermissions("actualControl:shipping_push_record:importExcel")
     @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
     public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
         return super.importExcel(request, response, ShippingPushRecord.class);
     }
 
-	 @ApiOperation(value = "铸坯装运单接收接口测试", notes = "铸坯装运单接收接口测试")
-	 @PostMapping("/receiveShippingOrder")
-	 public ResponseEntity<BilletPushResponse> receiveShippingOrder(@RequestBody ShippingOrderVO request) {
-		 // 处理接收到的请求
-		 // 你可以在这里记录日志、进行数据验证、发送消息等
-		 try {
-			 // 假设处理成功,返回响应
-			 BilletPushResponse response = new BilletPushResponse();
-			 response.setCode(200);  // 你可以根据实际情况设置响应码
-			 response.setMsg("成功");
-
-			 // 记录请求的日志等
-			 // 你可以根据需要将请求保存到数据库中
-
-			 return ResponseEntity.ok(response);
-		 } catch (Exception e) {
-			 BilletPushResponse errorResponse = new BilletPushResponse();
-			 errorResponse.setCode(500);
-			 errorResponse.setMsg("处理失败: " + e.getMessage());
-			 return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(errorResponse);
-		 }
-	 }
+    @ApiOperation(value = "铸坯装运单接收接口测试", notes = "铸坯装运单接收接口测试")
+    @PostMapping("/receiveShippingOrder")
+    public ResponseEntity<BilletPushResponse> receiveShippingOrder(@RequestBody ShippingOrderVO request) {
+        // 处理接收到的请求
+        // 你可以在这里记录日志、进行数据验证、发送消息等
+        try {
+            // 假设处理成功,返回响应
+            BilletPushResponse response = new BilletPushResponse();
+            response.setCode(200);  // 你可以根据实际情况设置响应码
+            response.setMsg("成功");
 
+            // 记录请求的日志等
+            // 你可以根据需要将请求保存到数据库中
+
+            return ResponseEntity.ok(response);
+        } catch (Exception e) {
+            BilletPushResponse errorResponse = new BilletPushResponse();
+            errorResponse.setCode(500);
+            errorResponse.setMsg("处理失败: " + e.getMessage());
+            return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(errorResponse);
+        }
+    }
+
+
+    /**
+     * 编辑
+     *
+     * @param confirmDTO
+     * @return
+     */
+    @AutoLog(value = "装运单确认")
+    @ApiOperation(value = "装运单确认", notes = "装运单确认")
+    @PostMapping("/confirmShippingOrder")
+    public Result<String> confirmShippingOrder(@RequestBody StorageBillConfirmDTO confirmDTO) {
+
+        if (oConvertUtils.isEmpty(confirmDTO.getShippingOrder())) {
+            return Result.error("装运单号不能为空");
+        }
+
+        LambdaQueryWrapper<StorageBill> queryWrapper = new LambdaQueryWrapper<>();
+
+        queryWrapper.eq(StorageBill::getUniqueCode, confirmDTO.getShippingOrder())
+                .orderByDesc(StorageBill::getCreateTime)
+                .last("LIMIT 1");
+        StorageBill storageBill = storageBillService.getOne(queryWrapper);
+        if (storageBill == null) {
+            return Result.error("未找到对应装运单数据");
+        }
+        Date now = new Date();
+
+        // 同步修改装运单storageBill 确认时间
+        storageBill.setConfirmTime(now);
+        storageBill.setConfirmBy("轧钢一体化平台");
+        storageBill.setRemark("装运单确认无误!");
+
+        storageBillService.updateById(storageBill);
+
+        LambdaQueryWrapper<StorageBillPrint> printQueryWrapper = new LambdaQueryWrapper<>();
+
+        printQueryWrapper.eq(StorageBillPrint::getStorageBillId, storageBill.getId())
+                .orderByDesc(StorageBillPrint::getCreateTime)
+                .last("LIMIT 1");
+        StorageBillPrint storageBillPrint = storageBillPrintService.getOne(printQueryWrapper);
+        if (oConvertUtils.isNotEmpty(storageBillPrint)) {
+            storageBillPrint.setConfirmBy("轧钢一体化平台");
+            // 修改确认时间
+            storageBillPrint.setConfirmTime(now);
+            storageBillPrint.setRemark("装运单确认无误!");
+            // 清空撤回状态
+            storageBillPrint.setWithdrawStatus(0);
+            storageBillPrintService.updateById(storageBillPrint);
+        }
+
+        LambdaQueryWrapper<ShippingPushRecord> recordQueryWrapper = new LambdaQueryWrapper<>();
+
+        recordQueryWrapper.eq(ShippingPushRecord::getShippingOrder, confirmDTO.getShippingOrder());
+
+        Optional.ofNullable(shippingPushRecordService.list(recordQueryWrapper))
+                .orElse(Collections.emptyList())
+                .forEach(record -> {
+                    record.setConfirmStatus(1);
+                    shippingPushRecordService.updateById(record);
+                });
+
+        return Result.OK("装运单确认成功!");
+    }
 }

+ 13 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/actualControl/billetActual/billetActual/dto/StorageBillConfirmDTO.java

@@ -0,0 +1,13 @@
+package org.jeecg.modules.actualControl.billetActual.billetActual.dto;
+
+import lombok.Data;
+
+@Data
+public class StorageBillConfirmDTO {
+
+    /**
+     * 装运单编号
+     */
+    private String shippingOrder;
+
+}

+ 3 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/actualControl/billetActual/billetActual/entity/ShippingPushRecord.java

@@ -149,4 +149,7 @@ public class ShippingPushRecord implements Serializable {
     @Excel(name = "请求json", width = 15)
     @ApiModelProperty(value = "请求json")
     private String requestJson;
+
+    @ApiModelProperty(value = "装运单确认状态-- 0 表示未确认,1 代表已确认")
+    private Integer confirmStatus;
 }

+ 2 - 1
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/actualControl/billetActual/billetActual/service/impl/BilletUseInfoServiceImpl.java

@@ -208,7 +208,7 @@ public class BilletUseInfoServiceImpl extends ServiceImpl<BilletUseInfoMapper, B
             heatInfo.setHeatNo(heatNo);
             if ("5".equals(storageBill.getCcmNo())) {
                 heatInfo.setConverterNo("bof5");
-            } else if ("6".equals(entity.getBtype())) {
+            } else if ("6".equals(storageBill.getCcmNo())) {
                 heatInfo.setConverterNo("bof6");
             }
 
@@ -239,6 +239,7 @@ public class BilletUseInfoServiceImpl extends ServiceImpl<BilletUseInfoMapper, B
                     .eq(BilletUseInfo::getShiftGroup, storageBill.getShiftGroup())
                     .eq(BilletUseInfo::getHeatNo, heatNo)
                     .eq(BilletUseInfo::getLength, entity.getSize())
+                    .eq(BilletUseInfo::getStorageBillId, storageBill.getId())
                     .orderByDesc(BilletUseInfo::getCreateTime);
 
             List<BilletUseInfo> billetUseInfoList = this.list(useInfoLambdaQueryWrapper);

+ 21 - 10
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/actualControl/heatsActuals/dto/RollbackNoticeRequest.java

@@ -1,24 +1,35 @@
 package org.jeecg.modules.actualControl.heatsActuals.dto;
 
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.util.List;
+
 @Data
 public class RollbackNoticeRequest {
 
     /**
-     * 炉号
-     */
-    private String heatNo;
-    /**
-     * 退坯原因
+     * 描述
      */
-    private String reason;
+    private String message;
     /**
-     * 产线标识
+     * 退坯类型  0 : 退坯  1: 取消退坯
      */
-    private String rollNo;
+    private Integer type;
     /**
-     * 铸坯号
+     * 数据列表
      */
-    private String billetNo;
+    private List<RollbackNoticeRequest.StorageBill> dataList;
+
+
+    @Data
+    public static class StorageBill {
+
+        @ApiModelProperty(value = "装运单编号")
+        private String shippingOrder;
+
+        @ApiModelProperty(value = "铸坯列表")
+        private List<String> billetList;
+
+    }
 }

+ 20 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/actualControl/heatsActuals/entity/RollbackNoticeLog.java

@@ -50,4 +50,24 @@ public class RollbackNoticeLog {
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @ApiModelProperty(value = "退坯日期")
     private Date sendTime;
+
+    /**
+     * 退坯类型  0 : 退坯  1: 取消退坯
+     */
+    @ApiModelProperty(value = "退坯类型")
+    private Integer type;
+
+    /**
+     * 装运单编号
+     */
+    @ApiModelProperty(value = "装运单编号")
+    private String shippingOrder;
+
+    /**
+     * 铸坯号列表
+     */
+    @ApiModelProperty(value = "铸坯号列表")
+    private String billetNoList;
+
+
 }

+ 19 - 10
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/actualControl/heatsActuals/service/impl/RollbackNoticeServiceImpl.java

@@ -19,18 +19,27 @@ public class RollbackNoticeServiceImpl extends ServiceImpl<RollbackNoticeLogMapp
 
     @Override
     public void saveRollbackNoticeLog(RollbackNoticeRequest request) {
-        if (request == null || oConvertUtils.isEmpty(request.getBilletNo())) {
-            throw new IllegalArgumentException("退坯通知请求为空或铸坯号为空");
+        if (request == null || oConvertUtils.isEmpty(request.getDataList())) {
+            throw new IllegalArgumentException("退坯通知请求为空或数据列表为空");
         }
 
-        RollbackNoticeLog log = new RollbackNoticeLog();
-        log.setHeatNo(request.getHeatNo());
-        log.setRollNo(request.getRollNo());
-        log.setReason(request.getReason());
-        log.setSendTime(new Date());
-        log.setBilletNo(request.getBilletNo());
-
-        rollbackNoticeLogMapper.insert(log);
+        for (RollbackNoticeRequest.StorageBill data : request.getDataList()) {
+            if (oConvertUtils.isEmpty(data.getShippingOrder())) {
+                throw new IllegalArgumentException("shippingOrder 不能为空");
+            }
+            if (oConvertUtils.isEmpty(data.getBilletList())) {
+                throw new IllegalArgumentException("billetList 不能为空");
+            }
+
+            RollbackNoticeLog log = new RollbackNoticeLog();
+            log.setReason(request.getMessage())
+                    .setType(request.getType())
+                    .setSendTime(new Date())
+                    .setShippingOrder(data.getShippingOrder())
+                    .setBilletNoList(String.join(",", data.getBilletList()));
+
+            rollbackNoticeLogMapper.insert(log);
+        }
     }
 
 }