diff --git a/src/main/java/com/shzg/project/unique/controller/WornUniqueCodeController.java b/src/main/java/com/shzg/project/unique/controller/WornUniqueCodeController.java index 4ba18f7..45a3839 100644 --- a/src/main/java/com/shzg/project/unique/controller/WornUniqueCodeController.java +++ b/src/main/java/com/shzg/project/unique/controller/WornUniqueCodeController.java @@ -4,6 +4,8 @@ import java.util.List; import javax.servlet.http.HttpServletResponse; import com.shzg.framework.aspectj.lang.annotation.DataScope; +import com.shzg.project.worn.domain.dto.WornInboundItemDTO; +import com.shzg.project.worn.domain.dto.WornScanCodeDTO; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -103,10 +105,27 @@ public class WornUniqueCodeController extends BaseController { return toAjax(wornUniqueCodeService.deleteWornUniqueCodeByIds(ids)); } + /** + * 根据唯一码编号查询物料信息 + * + * @param code 唯一码编号 + * @return 物料信息列表 + */ @PreAuthorize("@ss.hasPermi('worn:uniqueCode:list')") @GetMapping("/materialInfo/{code}") public AjaxResult getMaterialInfo(@PathVariable("code") Integer code) { return AjaxResult.success(wornUniqueCodeService.selectMaterialInfoByCode(code)); } + + /** + * 出库扫码查询物料信息 + */ + @PostMapping("/getMaterialInfo") + public AjaxResult getMaterialInfo(@RequestBody WornScanCodeDTO dto) + { + List list = + wornUniqueCodeService.selectMaterialInfoForOutbound(dto.getCode(), dto.getExistList()); + return AjaxResult.success(list); + } } diff --git a/src/main/java/com/shzg/project/unique/mapper/WornUniqueCodeMaterialMapper.java b/src/main/java/com/shzg/project/unique/mapper/WornUniqueCodeMaterialMapper.java index bd9f86d..fa61eac 100644 --- a/src/main/java/com/shzg/project/unique/mapper/WornUniqueCodeMaterialMapper.java +++ b/src/main/java/com/shzg/project/unique/mapper/WornUniqueCodeMaterialMapper.java @@ -66,4 +66,9 @@ public interface WornUniqueCodeMaterialMapper * @return */ WornUniqueCodeMaterial selectWithMaterialByUniqueCodeId(Long id); + /** + * 更新唯一码状态 + * */ + public int updateDeleteByUniqueCodeId(Long uniqueCodeId); + } diff --git a/src/main/java/com/shzg/project/unique/service/IWornUniqueCodeService.java b/src/main/java/com/shzg/project/unique/service/IWornUniqueCodeService.java index 2efd71e..496ad8f 100644 --- a/src/main/java/com/shzg/project/unique/service/IWornUniqueCodeService.java +++ b/src/main/java/com/shzg/project/unique/service/IWornUniqueCodeService.java @@ -58,5 +58,12 @@ public interface IWornUniqueCodeService * @return 物料信息列表 */ List selectMaterialInfoByCode(Integer code); + /** + * 根据唯一码编号查询物料信息(出库) + * + * @param code 唯一码编号 + * @return 物料信息列表 + */ + List selectMaterialInfoForOutbound(Integer code, List existList); } diff --git a/src/main/java/com/shzg/project/unique/service/impl/WornUniqueCodeServiceImpl.java b/src/main/java/com/shzg/project/unique/service/impl/WornUniqueCodeServiceImpl.java index c26992a..68e9fcd 100644 --- a/src/main/java/com/shzg/project/unique/service/impl/WornUniqueCodeServiceImpl.java +++ b/src/main/java/com/shzg/project/unique/service/impl/WornUniqueCodeServiceImpl.java @@ -272,4 +272,55 @@ public class WornUniqueCodeServiceImpl implements IWornUniqueCodeService } return dto; } + + @Override + public List selectMaterialInfoForOutbound(Integer code, List existList) + { + /* ================== 1. 参数校验 ================== */ + if (code == null) + { + throw new RuntimeException("唯一码不能为空"); + } + if (existList != null && existList.contains(code)) + { + throw new RuntimeException("该唯一码已扫描,请勿重复添加"); + } + /* ================== 2. 查询物料信息 ================== */ + List dto = wornUniqueCodeMapper.selectMaterialInfoByCode(code); + + if (dto == null || dto.isEmpty()) + { + throw new RuntimeException("未查询到对应物料信息"); + } + + /* ================== 3. 状态校验 ================== */ + for (WornInboundItemDTO item : dto) + { + String status = item.getStatus(); + + if (StringUtils.isEmpty(status)) + { + throw new RuntimeException("唯一码状态异常"); + } + + // ❗只允许已入库(2)出库 + if (!"2".equals(status)){ + if ("0".equals(status)){ + throw new RuntimeException("唯一码未入库,不能出库"); + }else if ("1".equals(status)){ + throw new RuntimeException("唯一码仅生成入库单,尚未入库"); + }else if ("3".equals(status)){ + throw new RuntimeException("唯一码已生成出库单,请勿重复操作"); + }else if ("4".equals(status)){ + throw new RuntimeException("唯一码已完成出库"); + }else if ("9".equals(status)){ + throw new RuntimeException("唯一码已作废"); + }else{ + throw new RuntimeException("唯一码状态异常:" + status); + } + } + } + + return dto; + } } diff --git a/src/main/java/com/shzg/project/worn/controller/WornInboundBillController.java b/src/main/java/com/shzg/project/worn/controller/WornInboundBillController.java index 4b93597..4f7b5f9 100644 --- a/src/main/java/com/shzg/project/worn/controller/WornInboundBillController.java +++ b/src/main/java/com/shzg/project/worn/controller/WornInboundBillController.java @@ -3,6 +3,7 @@ package com.shzg.project.worn.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; +import com.shzg.common.utils.SecurityUtils; import com.shzg.project.worn.domain.dto.WornInboundPartialFinishDTO; import com.shzg.project.worn.domain.dto.WornInboundUpdateDTO; import org.springframework.security.access.prepost.PreAuthorize; @@ -38,6 +39,10 @@ public class WornInboundBillController extends BaseController public TableDataInfo list(WornInboundBill wornInboundBill) { startPage(); + if (!SecurityUtils.isAdmin()) + { + wornInboundBill.setProjectId(SecurityUtils.getDeptId()); + } List list = wornInboundBillService.selectWornInboundBillList(wornInboundBill); return getDataTable(list); } diff --git a/src/main/java/com/shzg/project/worn/controller/WornOutboundBillController.java b/src/main/java/com/shzg/project/worn/controller/WornOutboundBillController.java new file mode 100644 index 0000000..d744c63 --- /dev/null +++ b/src/main/java/com/shzg/project/worn/controller/WornOutboundBillController.java @@ -0,0 +1,112 @@ +package com.shzg.project.worn.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.shzg.common.utils.SecurityUtils; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import com.shzg.framework.aspectj.lang.annotation.Log; +import com.shzg.framework.aspectj.lang.enums.BusinessType; +import com.shzg.project.worn.domain.WornOutboundBill; +import com.shzg.project.worn.service.IWornOutboundBillService; +import com.shzg.framework.web.controller.BaseController; +import com.shzg.framework.web.domain.AjaxResult; +import com.shzg.common.utils.poi.ExcelUtil; +import com.shzg.framework.web.page.TableDataInfo; + +/** + * 出库单据Controller + * + * @author shzg + * @date 2026-04-08 + */ +@RestController +@RequestMapping("/worn/outboundBill") +public class WornOutboundBillController extends BaseController +{ + @Autowired + private IWornOutboundBillService wornOutboundBillService; + + /** + * 查询出库单据列表 + */ + @PreAuthorize("@ss.hasPermi('worn:outboundBill:list')") + @GetMapping("/list") + public TableDataInfo list(WornOutboundBill wornOutboundBill) + { + startPage(); + if (!SecurityUtils.isAdmin()) + { + wornOutboundBill.setProjectId(SecurityUtils.getDeptId()); + } + List list = wornOutboundBillService.selectWornOutboundBillList(wornOutboundBill); + return getDataTable(list); + } + + /** + * 导出出库单据列表 + */ + @PreAuthorize("@ss.hasPermi('worn:outboundBill:export')") + @Log(title = "出库单据", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WornOutboundBill wornOutboundBill) + { + List list = wornOutboundBillService.selectWornOutboundBillList(wornOutboundBill); + ExcelUtil util = new ExcelUtil(WornOutboundBill.class); + util.exportExcel(response, list, "出库单据数据"); + } + + /** + * 获取出库单据详细信息 + */ + @PreAuthorize("@ss.hasPermi('worn:outboundBill:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(wornOutboundBillService.selectWornOutboundBillById(id)); + } + + /** + * 新增出库单据 + */ + @PreAuthorize("@ss.hasPermi('worn:outboundBill:add')") + @Log(title = "出库单据", businessType = BusinessType.INSERT) + @PostMapping("/add") + public AjaxResult add(@RequestBody WornOutboundBill wornOutboundBill) + { + return toAjax(wornOutboundBillService.insertWornOutboundBill(wornOutboundBill)); + } + + /** + * 修改出库单据 + */ + @PreAuthorize("@ss.hasPermi('worn:outboundBill:edit')") + @Log(title = "出库单据", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WornOutboundBill wornOutboundBill) + { + return toAjax(wornOutboundBillService.updateWornOutboundBill(wornOutboundBill)); + } + + /** + * 删除出库单据 + */ + @PreAuthorize("@ss.hasPermi('worn:outboundBill:remove')") + @Log(title = "出库单据", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(wornOutboundBillService.deleteWornOutboundBillByIds(ids)); + } + /** + * 完成出库 + */ + @PostMapping("/complete") + public AjaxResult complete(@RequestBody WornOutboundBill wornOutboundBill) + { + return toAjax(wornOutboundBillService.completeWornOutboundBill(wornOutboundBill)); + } + +} diff --git a/src/main/java/com/shzg/project/worn/controller/WornOutboundItemController.java b/src/main/java/com/shzg/project/worn/controller/WornOutboundItemController.java new file mode 100644 index 0000000..b86586d --- /dev/null +++ b/src/main/java/com/shzg/project/worn/controller/WornOutboundItemController.java @@ -0,0 +1,115 @@ +package com.shzg.project.worn.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.shzg.project.worn.domain.dto.WornOutboundUpdateDTO; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.shzg.framework.aspectj.lang.annotation.Log; +import com.shzg.framework.aspectj.lang.enums.BusinessType; +import com.shzg.project.worn.domain.WornOutboundItem; +import com.shzg.project.worn.service.IWornOutboundItemService; +import com.shzg.framework.web.controller.BaseController; +import com.shzg.framework.web.domain.AjaxResult; +import com.shzg.common.utils.poi.ExcelUtil; +import com.shzg.framework.web.page.TableDataInfo; + +/** + * 出库单明细Controller + * + * @author shzg + * @date 2026-04-08 + */ +@RestController +@RequestMapping("/worn/outboundItem") +public class WornOutboundItemController extends BaseController +{ + @Autowired + private IWornOutboundItemService wornOutboundItemService; + + /** + * 查询出库单明细列表 + */ + @PreAuthorize("@ss.hasPermi('worn:outboundItem:list')") + @GetMapping("/list") + public TableDataInfo list(WornOutboundItem wornOutboundItem) + { + startPage(); + List list = wornOutboundItemService.selectWornOutboundItemList(wornOutboundItem); + return getDataTable(list); + } + + /** + * 导出出库单明细列表 + */ + @PreAuthorize("@ss.hasPermi('worn:outboundItem:export')") + @Log(title = "出库单明细", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WornOutboundItem wornOutboundItem) + { + List list = wornOutboundItemService.selectWornOutboundItemList(wornOutboundItem); + ExcelUtil util = new ExcelUtil(WornOutboundItem.class); + util.exportExcel(response, list, "出库单明细数据"); + } + + /** + * 获取出库单明细详细信息 + */ + @PreAuthorize("@ss.hasPermi('worn:outboundItem:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(wornOutboundItemService.selectWornOutboundItemById(id)); + } + + /** + * 新增出库单明细 + */ + @PreAuthorize("@ss.hasPermi('worn:outboundItem:add')") + @Log(title = "出库单明细", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WornOutboundItem wornOutboundItem) + { + return toAjax(wornOutboundItemService.insertWornOutboundItem(wornOutboundItem)); + } + + /** + * 修改出库单明细 + */ + @PreAuthorize("@ss.hasPermi('worn:outboundItem:edit')") + @Log(title = "出库单明细", businessType = BusinessType.UPDATE) + @PostMapping("/update") + public AjaxResult edit(@RequestBody WornOutboundUpdateDTO dto) + { + return toAjax(wornOutboundItemService.updateWornOutboundItem(dto)); + } + + /** + * 删除出库单明细 + */ + @PreAuthorize("@ss.hasPermi('worn:outboundItem:remove')") + @Log(title = "出库单明细", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(wornOutboundItemService.deleteWornOutboundItemByIds(ids)); + } + /** + * 根据出库单号查询出库单明细 + */ + @PostMapping("/getByBillNo") + public AjaxResult getByBillNo(@RequestBody WornOutboundItem wornOutboundItem) + { + WornOutboundUpdateDTO dto = wornOutboundItemService.selectWornOutboundItemByBillNo(wornOutboundItem); + return AjaxResult.success(dto); + } +} diff --git a/src/main/java/com/shzg/project/worn/controller/WornTechnicalAppraisalController.java b/src/main/java/com/shzg/project/worn/controller/WornTechnicalAppraisalController.java new file mode 100644 index 0000000..5db4507 --- /dev/null +++ b/src/main/java/com/shzg/project/worn/controller/WornTechnicalAppraisalController.java @@ -0,0 +1,120 @@ +package com.shzg.project.worn.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.shzg.project.worn.domain.dto.WornTechnicalAppraisalSimpleDTO; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.shzg.framework.aspectj.lang.annotation.Log; +import com.shzg.framework.aspectj.lang.enums.BusinessType; +import com.shzg.project.worn.domain.WornTechnicalAppraisal; +import com.shzg.project.worn.service.IWornTechnicalAppraisalService; +import com.shzg.framework.web.controller.BaseController; +import com.shzg.framework.web.domain.AjaxResult; +import com.shzg.common.utils.poi.ExcelUtil; +import com.shzg.framework.web.page.TableDataInfo; + +/** + * 技术鉴定Controller + * + * @author shzg + * @date 2026-04-10 + */ +@RestController +@RequestMapping("/worn/appraisal") +public class WornTechnicalAppraisalController extends BaseController +{ + @Autowired + private IWornTechnicalAppraisalService wornTechnicalAppraisalService; + + /** + * 查询技术鉴定列表 + */ + @PreAuthorize("@ss.hasPermi('worn:appraisal:list')") + @GetMapping("/list") + public TableDataInfo list(WornTechnicalAppraisal wornTechnicalAppraisal) + { + startPage(); + List list = wornTechnicalAppraisalService.selectWornTechnicalAppraisalList(wornTechnicalAppraisal); + return getDataTable(list); + } + + /** + * 导出技术鉴定列表 + */ + @PreAuthorize("@ss.hasPermi('worn:appraisal:export')") + @Log(title = "技术鉴定", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WornTechnicalAppraisal wornTechnicalAppraisal) + { + List list = wornTechnicalAppraisalService.selectWornTechnicalAppraisalList(wornTechnicalAppraisal); + ExcelUtil util = new ExcelUtil(WornTechnicalAppraisal.class); + util.exportExcel(response, list, "技术鉴定数据"); + } + + /** + * 获取技术鉴定详细信息 + */ + @PreAuthorize("@ss.hasPermi('worn:appraisal:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(wornTechnicalAppraisalService.selectWornTechnicalAppraisalById(id)); + } + + /** + * 新增技术鉴定 + */ + @PreAuthorize("@ss.hasPermi('worn:appraisal:add')") + @Log(title = "技术鉴定", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WornTechnicalAppraisal wornTechnicalAppraisal) + { + return toAjax(wornTechnicalAppraisalService.insertWornTechnicalAppraisal(wornTechnicalAppraisal)); + } + + /** + * 修改技术鉴定 + */ + @PreAuthorize("@ss.hasPermi('worn:appraisal:edit')") + @Log(title = "技术鉴定", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WornTechnicalAppraisal wornTechnicalAppraisal) + { + return toAjax(wornTechnicalAppraisalService.updateWornTechnicalAppraisal(wornTechnicalAppraisal)); + } + + /** + * 删除技术鉴定 + */ + @PreAuthorize("@ss.hasPermi('worn:appraisal:remove')") + @Log(title = "技术鉴定", businessType = BusinessType.DELETE) + @DeleteMapping("/delete") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(wornTechnicalAppraisalService.deleteWornTechnicalAppraisalByIds(ids)); + } + /** + * 新增技术鉴定表(含附件) + */ + @PostMapping("/addWithFiles") + public AjaxResult addWithFiles(@RequestBody WornTechnicalAppraisal wornTechnicalAppraisal) + { + return toAjax(wornTechnicalAppraisalService.insertWornTechnicalAppraisalWithFiles(wornTechnicalAppraisal)); + } + @GetMapping("/myList") + public TableDataInfo myList() + { + startPage(); + return wornTechnicalAppraisalService.selectMyTechnicalAppraisalSimplePageList(); + } +} diff --git a/src/main/java/com/shzg/project/worn/controller/WornTechnicalAppraisalFileController.java b/src/main/java/com/shzg/project/worn/controller/WornTechnicalAppraisalFileController.java new file mode 100644 index 0000000..a5bf493 --- /dev/null +++ b/src/main/java/com/shzg/project/worn/controller/WornTechnicalAppraisalFileController.java @@ -0,0 +1,136 @@ +package com.shzg.project.worn.controller; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.shzg.project.worn.domain.dto.FileUrlDTO; +import com.shzg.project.worn.service.impl.WornTechnicalAppraisalFileServiceImpl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import com.shzg.framework.aspectj.lang.annotation.Log; +import com.shzg.framework.aspectj.lang.enums.BusinessType; +import com.shzg.project.worn.domain.WornTechnicalAppraisalFile; +import com.shzg.project.worn.service.IWornTechnicalAppraisalFileService; +import com.shzg.framework.web.controller.BaseController; +import com.shzg.framework.web.domain.AjaxResult; +import com.shzg.common.utils.poi.ExcelUtil; +import com.shzg.framework.web.page.TableDataInfo; +import org.springframework.web.multipart.MultipartFile; + +/** + * 技术鉴定附件Controller + * + * @author shzg + * @date 2026-04-10 + */ +@RestController +@RequestMapping("/worn/technicalFile") +public class WornTechnicalAppraisalFileController extends BaseController +{ + @Autowired + private IWornTechnicalAppraisalFileService wornTechnicalAppraisalFileService; + private static final Logger log = LoggerFactory.getLogger(WornTechnicalAppraisalFileServiceImpl.class); + + /** + * 查询技术鉴定附件列表 + */ + @PreAuthorize("@ss.hasPermi('worn:technicalFile:list')") + @GetMapping("/list") + public TableDataInfo list(WornTechnicalAppraisalFile wornTechnicalAppraisalFile) + { + startPage(); + List list = wornTechnicalAppraisalFileService.selectWornTechnicalAppraisalFileList(wornTechnicalAppraisalFile); + return getDataTable(list); + } + + /** + * 导出技术鉴定附件列表 + */ + @PreAuthorize("@ss.hasPermi('worn:technicalFile:export')") + @Log(title = "技术鉴定附件", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WornTechnicalAppraisalFile wornTechnicalAppraisalFile) + { + List list = wornTechnicalAppraisalFileService.selectWornTechnicalAppraisalFileList(wornTechnicalAppraisalFile); + ExcelUtil util = new ExcelUtil(WornTechnicalAppraisalFile.class); + util.exportExcel(response, list, "技术鉴定附件数据"); + } + + /** + * 获取技术鉴定附件详细信息 + */ + @PreAuthorize("@ss.hasPermi('worn:technicalFile:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(wornTechnicalAppraisalFileService.selectWornTechnicalAppraisalFileById(id)); + } + + /** + * 新增技术鉴定附件 + */ + @PreAuthorize("@ss.hasPermi('worn:technicalFile:add')") + @Log(title = "技术鉴定附件", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WornTechnicalAppraisalFile wornTechnicalAppraisalFile) + { + return toAjax(wornTechnicalAppraisalFileService.insertWornTechnicalAppraisalFile(wornTechnicalAppraisalFile)); + } + + /** + * 修改技术鉴定附件 + */ + @PreAuthorize("@ss.hasPermi('worn:technicalFile:edit')") + @Log(title = "技术鉴定附件", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WornTechnicalAppraisalFile wornTechnicalAppraisalFile) + { + return toAjax(wornTechnicalAppraisalFileService.updateWornTechnicalAppraisalFile(wornTechnicalAppraisalFile)); + } + + /** + * 删除技术鉴定附件 + */ + @PreAuthorize("@ss.hasPermi('worn:technicalFile:remove')") + @Log(title = "技术鉴定附件", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(wornTechnicalAppraisalFileService.deleteWornTechnicalAppraisalFileByIds(ids)); + } + /** + * 多张图片上传 + * 前端参数: + * file: 多个同名文件字段 + * scene: 场景 + * bizType: 业务类型 + */ + @Log(title = "技术鉴定附件上传", businessType = BusinessType.OTHER) + @PostMapping(value = "/upload", consumes = "multipart/form-data") + public AjaxResult uploadBatch(@RequestParam("file") MultipartFile[] files, + @RequestParam("scene") String scene, + @RequestParam("bizType") String bizType, + HttpServletRequest request) + { + try + { + List list = wornTechnicalAppraisalFileService.uploadBatch(files, scene, bizType, request); + + Map result = new HashMap<>(); + result.put("fileUrlList", list); + + return AjaxResult.success(result); + } + catch (Exception e) + { + logger.error("技术鉴定附件批量上传失败", e); + return AjaxResult.error("上传失败:" + e.getMessage()); + } + } +} diff --git a/src/main/java/com/shzg/project/worn/domain/FileUploadConfig.java b/src/main/java/com/shzg/project/worn/domain/FileUploadConfig.java new file mode 100644 index 0000000..90aefa9 --- /dev/null +++ b/src/main/java/com/shzg/project/worn/domain/FileUploadConfig.java @@ -0,0 +1,24 @@ +package com.shzg.project.worn.domain; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +@Component +@ConfigurationProperties(prefix = "file") +public class FileUploadConfig +{ + /** + * 文件上传根路径 + */ + private String uploadPath; + + public String getUploadPath() + { + return uploadPath; + } + + public void setUploadPath(String uploadPath) + { + this.uploadPath = uploadPath; + } +} \ No newline at end of file diff --git a/src/main/java/com/shzg/project/worn/domain/ResourceConfig.java b/src/main/java/com/shzg/project/worn/domain/ResourceConfig.java new file mode 100644 index 0000000..64b2307 --- /dev/null +++ b/src/main/java/com/shzg/project/worn/domain/ResourceConfig.java @@ -0,0 +1,20 @@ +package com.shzg.project.worn.domain; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +@Configuration +public class ResourceConfig implements WebMvcConfigurer +{ + @Autowired + private FileUploadConfig fileUploadConfig; + + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) + { + registry.addResourceHandler("/profile/**") + .addResourceLocations("file:" + fileUploadConfig.getUploadPath() + "/"); + } +} \ No newline at end of file diff --git a/src/main/java/com/shzg/project/worn/domain/WornInboundBill.java b/src/main/java/com/shzg/project/worn/domain/WornInboundBill.java index 28b1d7a..d45e95b 100644 --- a/src/main/java/com/shzg/project/worn/domain/WornInboundBill.java +++ b/src/main/java/com/shzg/project/worn/domain/WornInboundBill.java @@ -56,6 +56,10 @@ public class WornInboundBill extends BaseEntity @Excel(name = "逻辑删除", readConverterExp = "0=正常,1=删除") private String isDelete; + /** 项目ID(用于数据隔离,对应sys_dept.id) */ + @Excel(name = "项目ID", readConverterExp = "用于数据隔离,对应sys_dept.id") + private Long projectId; + /** ================== 新增:明细列表 ================== */ private List itemList; @@ -91,7 +95,15 @@ public class WornInboundBill extends BaseEntity public List getItemList() { return itemList; } public void setItemList(List itemList) { this.itemList = itemList; } + public Long getProjectId() + { + return projectId; + } + public void setProjectId(Long projectId) + { + this.projectId = projectId; + } @Override public String toString() { diff --git a/src/main/java/com/shzg/project/worn/domain/WornOutboundBill.java b/src/main/java/com/shzg/project/worn/domain/WornOutboundBill.java new file mode 100644 index 0000000..4befde4 --- /dev/null +++ b/src/main/java/com/shzg/project/worn/domain/WornOutboundBill.java @@ -0,0 +1,201 @@ +package com.shzg.project.worn.domain; + +import java.util.Date; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.shzg.framework.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.shzg.framework.aspectj.lang.annotation.Excel; + +/** + * 出库单据对象 worn_outbound_bill + * + * @author shzg + * @date 2026-04-08 + */ +public class WornOutboundBill extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键ID */ + private Long id; + + /** 出库单号 */ + @Excel(name = "出库单号") + private String billNo; + + /** 出库类型(0普通出库 1处置出库 等) */ + @Excel(name = "出库类型", readConverterExp = "0=普通出库,1=处置出库,等=") + private String billType; + + /** 仓库编码 */ + @Excel(name = "仓库编码") + private String warehouseCode; + + /** 仓库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + + /** 库区编码 */ + @Excel(name = "库区编码") + private String areaCode; + + /** 库区名称 */ + @Excel(name = "库区名称") + private String areaName; + + /** 出库时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "出库时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date outboundTime; + + /** 状态(0待出库 1已出库) */ + @Excel(name = "状态", readConverterExp = "0=待出库,1=已出库") + private String status; + + /** 逻辑删除(0正常 1删除) */ + @Excel(name = "逻辑删除", readConverterExp = "0=正常,1=删除") + private String isDelete; + + /** 项目ID(数据隔离) */ + @Excel(name = "项目ID", readConverterExp = "数=据隔离") + private Long projectId; + /** ================== 新增:明细列表 ================== */ + private List itemList; + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + + public void setBillNo(String billNo) + { + this.billNo = billNo; + } + + public String getBillNo() + { + return billNo; + } + + public void setBillType(String billType) + { + this.billType = billType; + } + + public String getBillType() + { + return billType; + } + + public void setWarehouseCode(String warehouseCode) + { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseCode() + { + return warehouseCode; + } + + public void setWarehouseName(String warehouseName) + { + this.warehouseName = warehouseName; + } + + public String getWarehouseName() + { + return warehouseName; + } + + public void setAreaCode(String areaCode) + { + this.areaCode = areaCode; + } + + public String getAreaCode() + { + return areaCode; + } + + public void setAreaName(String areaName) + { + this.areaName = areaName; + } + + public String getAreaName() + { + return areaName; + } + + public void setOutboundTime(Date outboundTime) + { + this.outboundTime = outboundTime; + } + + public Date getOutboundTime() + { + return outboundTime; + } + + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + + public void setIsDelete(String isDelete) + { + this.isDelete = isDelete; + } + + public String getIsDelete() + { + return isDelete; + } + + public void setProjectId(Long projectId) + { + this.projectId = projectId; + } + + public Long getProjectId() + { + return projectId; + } + public List getItemList() { return itemList; } + public void setItemList(List itemList) { this.itemList = itemList; } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("billNo", getBillNo()) + .append("billType", getBillType()) + .append("warehouseCode", getWarehouseCode()) + .append("warehouseName", getWarehouseName()) + .append("areaCode", getAreaCode()) + .append("areaName", getAreaName()) + .append("remark", getRemark()) + .append("outboundTime", getOutboundTime()) + .append("status", getStatus()) + .append("isDelete", getIsDelete()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("projectId", getProjectId()) + .append("itemList", getItemList()) + .toString(); + } +} diff --git a/src/main/java/com/shzg/project/worn/domain/WornOutboundItem.java b/src/main/java/com/shzg/project/worn/domain/WornOutboundItem.java new file mode 100644 index 0000000..20fa92d --- /dev/null +++ b/src/main/java/com/shzg/project/worn/domain/WornOutboundItem.java @@ -0,0 +1,309 @@ +package com.shzg.project.worn.domain; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.shzg.framework.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.shzg.framework.aspectj.lang.annotation.Excel; + +/** + * 出库单明细对象 worn_outbound_item + * + * @author shzg + * @date 2026-04-08 + */ +public class WornOutboundItem extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键ID */ + private Long id; + + /** 出库单ID */ + @Excel(name = "出库单ID") + private Long billId; + + /** 出库单号 */ + @Excel(name = "出库单号") + private String billNo; + + /** 物料ID */ + @Excel(name = "物料ID") + private Long materialId; + + /** 数量 */ + @Excel(name = "数量") + private BigDecimal quantity; + + /** 唯一码 */ + @Excel(name = "唯一码") + private Integer uniqueCode; + + /** 明细状态(0待出库 1已出库) */ + @Excel(name = "明细状态", readConverterExp = "0=待出库,1=已出库") + private String status; + + /** 是否删除(0正常 1删除) */ + @Excel(name = "是否删除", readConverterExp = "0=正常,1=删除") + private String isDelete; + // ================== 物料扩展信息(查询用,不入库) ================== + /** ================== 新增:明细列表 ================== */ + private List itemList; + /** 物料名称 */ + @Excel(name = "物料名称") + private String materialName; + + /** 物料简称 */ + @Excel(name = "物料简称") + private String materialShortName; + + /** 物料编码 */ + @Excel(name = "物料编码") + private String materialCode; + + /** 规格 */ + @Excel(name = "规格") + private String specification; + + /** 型号 */ + @Excel(name = "型号") + private String model; + /** 仓库编码 */ + private String warehouseCode; + /** 仓库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + /** 存储区编码 */ + private String areaCode; + /** 存储区名称 */ + @Excel(name = "存储区名称") + private String areaName; + + /** 创建时间 */ + @Excel(name = "创建时间") + private java.util.Date createTime; + /** 入库时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "入库时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date outboundTime; + /** 单件重量 */ + @Excel(name = "单件重量") + private BigDecimal weight; + + /** 单据备注 */ + @Excel(name = "单据备注") + private String billRemark; + /** 入库单类型(0=入库申请,1=入库成功,2=出库申请,3=出库成功,4=已作废") */ + private String billType; + /** 物资类型 */ + private String typeName; + /** 父级类型名称 */ + private String typeParentNames; + /** 物料单位ID */ + private Long unitId; + /** 单位名称 */ + private String unitName; + + /** 主单据状态 */ + private String billStatus; + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + + public void setBillId(Long billId) + { + this.billId = billId; + } + + public Long getBillId() + { + return billId; + } + + public void setBillNo(String billNo) + { + this.billNo = billNo; + } + + public String getBillNo() + { + return billNo; + } + + public void setMaterialId(Long materialId) + { + this.materialId = materialId; + } + + public Long getMaterialId() + { + return materialId; + } + + public void setQuantity(BigDecimal quantity) + { + this.quantity = quantity; + } + + public BigDecimal getQuantity() + { + return quantity; + } + + public Integer getUniqueCode() { return uniqueCode; } + public void setUniqueCode(Integer uniqueCode) { this.uniqueCode = uniqueCode; } + + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + + public void setIsDelete(String isDelete) + { + this.isDelete = isDelete; + } + + public String getIsDelete() + { + return isDelete; + } + public List getItemList() { return itemList; } + public void setItemList(List itemList) { this.itemList = itemList; } + public String getBillType() { return billType; } + public void setBillType(String billType) { this.billType = billType; } + public String getWarehouseCode() { return warehouseCode; } + public void setWarehouseCode(String warehouseCode) { this.warehouseCode = warehouseCode; } + + public String getAreaCode() { return areaCode; } + public void setAreaCode(String areaCode) { this.areaCode = areaCode; } + public String getTypeName() { + return typeName; + } + + public void setTypeName(String typeName) { + this.typeName = typeName; + } + public String getTypeParentNames() { + return typeParentNames; + } + + public void setTypeParentNames(String typeParentNames) { + this.typeParentNames = typeParentNames; + } + public Long getUnitId() { + return unitId; + } + + public void setUnitId(Long unitId) { + this.unitId = unitId; + } + public void setUnitName(String unitName) + { + this.unitName = unitName; + } + + public String getUnitName() + { + return unitName; + } + public void setBillStatus(String billStatus) + { + this.billStatus = billStatus; + } + + public String getBillStatus() + { + return billStatus; + } + public String getWarehouseName() { + return warehouseName; + } + + public void setWarehouseName(String warehouseName) { + this.warehouseName = warehouseName; + } + + public String getAreaName() { + return areaName; + } + + public void setAreaName(String areaName) { + this.areaName = areaName; + } + + @Override + public java.util.Date getCreateTime() { + return super.getCreateTime(); + } + + @Override + public void setCreateTime(java.util.Date createTime) { + super.setCreateTime(createTime); + } + public Date getOutboundTime() { + return outboundTime; + } + + public void setOutboundTime(Date outboundTime) { + this.outboundTime = outboundTime; + } + public BigDecimal getWeight() { + return weight; + } + + public void setWeight(BigDecimal weight) { + this.weight = weight; + } + + public String getBillRemark() { + return billRemark; + } + + public void setBillRemark(String billRemark) { + this.billRemark = billRemark; + } + public String getMaterialName() { return materialName; } + public void setMaterialName(String materialName) { this.materialName = materialName; } + public String getMaterialCode() { return materialCode; } + public void setMaterialCode(String materialCode) { this.materialCode = materialCode; } + public String getModel() { return model; } + public void setModel(String model) { this.model = model; } + public String getMaterialShortName() { return materialShortName; } + public void setMaterialShortName(String materialShortName) { this.materialShortName = materialShortName; } + public String getSpecification() { return specification; } + public void setSpecification(String specification) { this.specification = specification; } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("billId", getBillId()) + .append("billNo", getBillNo()) + .append("materialId", getMaterialId()) + .append("quantity", getQuantity()) + .append("uniqueCode", getUniqueCode()) + .append("remark", getRemark()) + .append("status", getStatus()) + .append("isDelete", getIsDelete()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/src/main/java/com/shzg/project/worn/domain/WornTechnicalAppraisal.java b/src/main/java/com/shzg/project/worn/domain/WornTechnicalAppraisal.java new file mode 100644 index 0000000..31d746d --- /dev/null +++ b/src/main/java/com/shzg/project/worn/domain/WornTechnicalAppraisal.java @@ -0,0 +1,188 @@ +package com.shzg.project.worn.domain; + +import com.shzg.framework.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.shzg.framework.aspectj.lang.annotation.Excel; + +import java.util.List; + +/** + * 技术鉴定对象 worn_technical_appraisal + * + * @author shzg + * @date 2026-04-10 + */ +public class WornTechnicalAppraisal extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键ID */ + private Long id; + + /** 技术鉴定单号 */ + @Excel(name = "技术鉴定单号") + private String appraisalNo; + + /** 出库单ID */ + @Excel(name = "出库单ID") + private Long billId; + + /** 出库单号 */ + @Excel(name = "出库单号") + private String billNo; + + /** 项目ID */ + @Excel(name = "项目ID") + private Long projectId; + + /** 上传人ID */ + @Excel(name = "上传人ID") + private Long userId; + + /** 上传人姓名 */ + @Excel(name = "上传人姓名") + private String userName; + + /** 技术鉴定说明 */ + @Excel(name = "技术鉴定说明") + private String appraisalDesc; + + /** 状态(0草稿 1已提交) */ + @Excel(name = "状态", readConverterExp = "0=草稿,1=已提交") + private String status; + + /** 是否删除(0正常 1删除) */ + @Excel(name = "是否删除", readConverterExp = "0=正常,1=删除") + private String isDelete; + /** 附件列表 */ + private List fileList; + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + + public void setAppraisalNo(String appraisalNo) + { + this.appraisalNo = appraisalNo; + } + + public String getAppraisalNo() + { + return appraisalNo; + } + + public void setBillId(Long billId) + { + this.billId = billId; + } + + public Long getBillId() + { + return billId; + } + + public void setBillNo(String billNo) + { + this.billNo = billNo; + } + + public String getBillNo() + { + return billNo; + } + + public void setProjectId(Long projectId) + { + this.projectId = projectId; + } + + public Long getProjectId() + { + return projectId; + } + + public void setUserId(Long userId) + { + this.userId = userId; + } + + public Long getUserId() + { + return userId; + } + + public void setUserName(String userName) + { + this.userName = userName; + } + + public String getUserName() + { + return userName; + } + + public void setAppraisalDesc(String appraisalDesc) + { + this.appraisalDesc = appraisalDesc; + } + + public String getAppraisalDesc() + { + return appraisalDesc; + } + + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + + public void setIsDelete(String isDelete) + { + this.isDelete = isDelete; + } + + public String getIsDelete() + { + return isDelete; + } + public List getFileList() + { + return fileList; + } + + public void setFileList(List fileList) + { + this.fileList = fileList; + } + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("appraisalNo", getAppraisalNo()) + .append("billId", getBillId()) + .append("billNo", getBillNo()) + .append("projectId", getProjectId()) + .append("userId", getUserId()) + .append("userName", getUserName()) + .append("appraisalDesc", getAppraisalDesc()) + .append("status", getStatus()) + .append("remark", getRemark()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("isDelete", getIsDelete()) + .toString(); + } +} diff --git a/src/main/java/com/shzg/project/worn/domain/WornTechnicalAppraisalFile.java b/src/main/java/com/shzg/project/worn/domain/WornTechnicalAppraisalFile.java new file mode 100644 index 0000000..e9ff98c --- /dev/null +++ b/src/main/java/com/shzg/project/worn/domain/WornTechnicalAppraisalFile.java @@ -0,0 +1,130 @@ +package com.shzg.project.worn.domain; + +import com.shzg.framework.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.shzg.framework.aspectj.lang.annotation.Excel; + +/** + * 技术鉴定附件对象 worn_technical_appraisal_file + * + * @author shzg + * @date 2026-04-10 + */ +public class WornTechnicalAppraisalFile extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键ID */ + private Long id; + + /** 技术鉴定表ID */ + @Excel(name = "技术鉴定表ID") + private Long appraisalId; + + /** 文件名 */ + @Excel(name = "文件名") + private String fileName; + + /** 文件地址 */ + @Excel(name = "文件地址") + private String fileUrl; + + /** 文件类型 */ + @Excel(name = "文件类型") + private String fileType; + + /** 排序 */ + @Excel(name = "排序") + private Long sortNum; + + /** 是否删除(0正常 1删除) */ + @Excel(name = "是否删除", readConverterExp = "0=正常,1=删除") + private String isDelete; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + + public void setAppraisalId(Long appraisalId) + { + this.appraisalId = appraisalId; + } + + public Long getAppraisalId() + { + return appraisalId; + } + + public void setFileName(String fileName) + { + this.fileName = fileName; + } + + public String getFileName() + { + return fileName; + } + + public void setFileUrl(String fileUrl) + { + this.fileUrl = fileUrl; + } + + public String getFileUrl() + { + return fileUrl; + } + + public void setFileType(String fileType) + { + this.fileType = fileType; + } + + public String getFileType() + { + return fileType; + } + + public void setSortNum(Long sortNum) + { + this.sortNum = sortNum; + } + + public Long getSortNum() + { + return sortNum; + } + + public void setIsDelete(String isDelete) + { + this.isDelete = isDelete; + } + + public String getIsDelete() + { + return isDelete; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("appraisalId", getAppraisalId()) + .append("fileName", getFileName()) + .append("fileUrl", getFileUrl()) + .append("fileType", getFileType()) + .append("sortNum", getSortNum()) + .append("remark", getRemark()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("isDelete", getIsDelete()) + .toString(); + } +} diff --git a/src/main/java/com/shzg/project/worn/domain/dto/AppraisalFileDTO.java b/src/main/java/com/shzg/project/worn/domain/dto/AppraisalFileDTO.java new file mode 100644 index 0000000..6cc0067 --- /dev/null +++ b/src/main/java/com/shzg/project/worn/domain/dto/AppraisalFileDTO.java @@ -0,0 +1,30 @@ +package com.shzg.project.worn.domain.dto; + +public class AppraisalFileDTO +{ + /** 文件名 */ + private String name; + + /** 文件地址 */ + private String url; + + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name = name; + } + + public String getUrl() + { + return url; + } + + public void setUrl(String url) + { + this.url = url; + } +} diff --git a/src/main/java/com/shzg/project/worn/domain/dto/FileUrlDTO.java b/src/main/java/com/shzg/project/worn/domain/dto/FileUrlDTO.java new file mode 100644 index 0000000..7f0f5d5 --- /dev/null +++ b/src/main/java/com/shzg/project/worn/domain/dto/FileUrlDTO.java @@ -0,0 +1,37 @@ +package com.shzg.project.worn.domain.dto; + +public class FileUrlDTO +{ + private String name; + private String url; + + public FileUrlDTO() + { + } + + public FileUrlDTO(String name, String url) + { + this.name = name; + this.url = url; + } + + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name = name; + } + + public String getUrl() + { + return url; + } + + public void setUrl(String url) + { + this.url = url; + } +} \ No newline at end of file diff --git a/src/main/java/com/shzg/project/worn/domain/dto/WornOutboundUpdateDTO.java b/src/main/java/com/shzg/project/worn/domain/dto/WornOutboundUpdateDTO.java new file mode 100644 index 0000000..a0c896f --- /dev/null +++ b/src/main/java/com/shzg/project/worn/domain/dto/WornOutboundUpdateDTO.java @@ -0,0 +1,24 @@ +package com.shzg.project.worn.domain.dto; + +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +@Data +public class WornOutboundUpdateDTO { + private Long billId; + private String billNo; + private String billType; + private String warehouseCode; + private String warehouseName; + private String areaCode; + private String areaName; + private String billRemark; + private Date outboundTime; + private String status; + private Date createTime; + + private List itemList; +} diff --git a/src/main/java/com/shzg/project/worn/domain/dto/WornScanCodeDTO.java b/src/main/java/com/shzg/project/worn/domain/dto/WornScanCodeDTO.java new file mode 100644 index 0000000..112daa0 --- /dev/null +++ b/src/main/java/com/shzg/project/worn/domain/dto/WornScanCodeDTO.java @@ -0,0 +1,36 @@ +package com.shzg.project.worn.domain.dto; + +import java.util.List; + +public class WornScanCodeDTO +{ + /** + * 当前扫码的唯一码 + */ + private Integer code; + + /** + * 前端已扫描的唯一码列表 + */ + private List existList; + + public Integer getCode() + { + return code; + } + + public void setCode(Integer code) + { + this.code = code; + } + + public List getExistList() + { + return existList; + } + + public void setExistList(List existList) + { + this.existList = existList; + } +} \ No newline at end of file diff --git a/src/main/java/com/shzg/project/worn/domain/dto/WornTechnicalAppraisalSimpleDTO.java b/src/main/java/com/shzg/project/worn/domain/dto/WornTechnicalAppraisalSimpleDTO.java new file mode 100644 index 0000000..808b254 --- /dev/null +++ b/src/main/java/com/shzg/project/worn/domain/dto/WornTechnicalAppraisalSimpleDTO.java @@ -0,0 +1,23 @@ +package com.shzg.project.worn.domain.dto; + +import lombok.Data; + +import java.util.List; + +import java.util.Date; +@Data +public class WornTechnicalAppraisalSimpleDTO +{ + private Long id; + + private String appraisalNo; + + private Date createTime; + + private String appraisalDesc; + private String remark; + + /** 🔥 改这里:多图对象 */ + private List fileUrlList; + +} \ No newline at end of file diff --git a/src/main/java/com/shzg/project/worn/mapper/WornOutboundBillMapper.java b/src/main/java/com/shzg/project/worn/mapper/WornOutboundBillMapper.java new file mode 100644 index 0000000..2989bd7 --- /dev/null +++ b/src/main/java/com/shzg/project/worn/mapper/WornOutboundBillMapper.java @@ -0,0 +1,63 @@ +package com.shzg.project.worn.mapper; + +import java.util.List; +import com.shzg.project.worn.domain.WornOutboundBill; + +/** + * 出库单据Mapper接口 + * + * @author shzg + * @date 2026-04-08 + */ +public interface WornOutboundBillMapper +{ + /** + * 查询出库单据 + * + * @param id 出库单据主键 + * @return 出库单据 + */ + public WornOutboundBill selectWornOutboundBillById(Long id); + + /** + * 查询出库单据列表 + * + * @param wornOutboundBill 出库单据 + * @return 出库单据集合 + */ + public List selectWornOutboundBillList(WornOutboundBill wornOutboundBill); + + /** + * 新增出库单据 + * + * @param wornOutboundBill 出库单据 + * @return 结果 + */ + public int insertWornOutboundBill(WornOutboundBill wornOutboundBill); + + /** + * 修改出库单据 + * + * @param wornOutboundBill 出库单据 + * @return 结果 + */ + public int updateWornOutboundBill(WornOutboundBill wornOutboundBill); + + /** + * 删除出库单据 + * + * @param id 出库单据主键 + * @return 结果 + */ + public int deleteWornOutboundBillById(Long id); + + /** + * 批量删除出库单据 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWornOutboundBillByIds(Long[] ids); + + WornOutboundBill selectWornOutboundBillByBillNo(String billNo); +} diff --git a/src/main/java/com/shzg/project/worn/mapper/WornOutboundItemMapper.java b/src/main/java/com/shzg/project/worn/mapper/WornOutboundItemMapper.java new file mode 100644 index 0000000..4017ab7 --- /dev/null +++ b/src/main/java/com/shzg/project/worn/mapper/WornOutboundItemMapper.java @@ -0,0 +1,64 @@ +package com.shzg.project.worn.mapper; + +import java.util.List; +import com.shzg.project.worn.domain.WornOutboundItem; + +/** + * 出库单明细Mapper接口 + * + * @author shzg + * @date 2026-04-08 + */ +public interface WornOutboundItemMapper +{ + /** + * 查询出库单明细 + * + * @param id 出库单明细主键 + * @return 出库单明细 + */ + public WornOutboundItem selectWornOutboundItemById(Long id); + + /** + * 查询出库单明细列表 + * + * @param wornOutboundItem 出库单明细 + * @return 出库单明细集合 + */ + public List selectWornOutboundItemList(WornOutboundItem wornOutboundItem); + + /** + * 新增出库单明细 + * + * @param wornOutboundItem 出库单明细 + * @return 结果 + */ + public int insertWornOutboundItem(WornOutboundItem wornOutboundItem); + + /** + * 修改出库单明细 + * + * @param wornOutboundItem 出库单明细 + * @return 结果 + */ + public int updateWornOutboundItem(WornOutboundItem wornOutboundItem); + + /** + * 删除出库单明细 + * + * @param id 出库单明细主键 + * @return 结果 + */ + public int deleteWornOutboundItemById(Long id); + + /** + * 批量删除出库单明细 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWornOutboundItemByIds(Long[] ids); + + + int countNotOutboundByBillId(Long billId); +} diff --git a/src/main/java/com/shzg/project/worn/mapper/WornTechnicalAppraisalFileMapper.java b/src/main/java/com/shzg/project/worn/mapper/WornTechnicalAppraisalFileMapper.java new file mode 100644 index 0000000..6c9c1db --- /dev/null +++ b/src/main/java/com/shzg/project/worn/mapper/WornTechnicalAppraisalFileMapper.java @@ -0,0 +1,68 @@ +package com.shzg.project.worn.mapper; + +import java.util.List; +import com.shzg.project.worn.domain.WornTechnicalAppraisalFile; + +/** + * 技术鉴定附件Mapper接口 + * + * @author shzg + * @date 2026-04-10 + */ +public interface WornTechnicalAppraisalFileMapper +{ + /** + * 查询技术鉴定附件 + * + * @param id 技术鉴定附件主键 + * @return 技术鉴定附件 + */ + public WornTechnicalAppraisalFile selectWornTechnicalAppraisalFileById(Long id); + + /** + * 查询技术鉴定附件列表 + * + * @param wornTechnicalAppraisalFile 技术鉴定附件 + * @return 技术鉴定附件集合 + */ + public List selectWornTechnicalAppraisalFileList(WornTechnicalAppraisalFile wornTechnicalAppraisalFile); + + /** + * 新增技术鉴定附件 + * + * @param wornTechnicalAppraisalFile 技术鉴定附件 + * @return 结果 + */ + public int insertWornTechnicalAppraisalFile(WornTechnicalAppraisalFile wornTechnicalAppraisalFile); + + /** + * 修改技术鉴定附件 + * + * @param wornTechnicalAppraisalFile 技术鉴定附件 + * @return 结果 + */ + public int updateWornTechnicalAppraisalFile(WornTechnicalAppraisalFile wornTechnicalAppraisalFile); + + /** + * 删除技术鉴定附件 + * + * @param id 技术鉴定附件主键 + * @return 结果 + */ + public int deleteWornTechnicalAppraisalFileById(Long id); + + /** + * 批量删除技术鉴定附件 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWornTechnicalAppraisalFileByIds(Long[] ids); + /** + * 根据技术鉴定表ID查询附件列表 + * + * @param appraisalId 技术鉴定表ID + * @return 附件列表 + */ + List selectWornTechnicalAppraisalFileByAppraisalId(Long appraisalId); +} diff --git a/src/main/java/com/shzg/project/worn/mapper/WornTechnicalAppraisalMapper.java b/src/main/java/com/shzg/project/worn/mapper/WornTechnicalAppraisalMapper.java new file mode 100644 index 0000000..2a7165c --- /dev/null +++ b/src/main/java/com/shzg/project/worn/mapper/WornTechnicalAppraisalMapper.java @@ -0,0 +1,68 @@ +package com.shzg.project.worn.mapper; + +import java.util.List; +import com.shzg.project.worn.domain.WornTechnicalAppraisal; + +/** + * 技术鉴定Mapper接口 + * + * @author shzg + * @date 2026-04-10 + */ +public interface WornTechnicalAppraisalMapper +{ + /** + * 查询技术鉴定 + * + * @param id 技术鉴定主键 + * @return 技术鉴定 + */ + public WornTechnicalAppraisal selectWornTechnicalAppraisalById(Long id); + + /** + * 查询技术鉴定列表 + * + * @param wornTechnicalAppraisal 技术鉴定 + * @return 技术鉴定集合 + */ + public List selectWornTechnicalAppraisalList(WornTechnicalAppraisal wornTechnicalAppraisal); + + /** + * 新增技术鉴定 + * + * @param wornTechnicalAppraisal 技术鉴定 + * @return 结果 + */ + public int insertWornTechnicalAppraisal(WornTechnicalAppraisal wornTechnicalAppraisal); + + /** + * 修改技术鉴定 + * + * @param wornTechnicalAppraisal 技术鉴定 + * @return 结果 + */ + public int updateWornTechnicalAppraisal(WornTechnicalAppraisal wornTechnicalAppraisal); + + /** + * 删除技术鉴定 + * + * @param id 技术鉴定主键 + * @return 结果 + */ + public int deleteWornTechnicalAppraisalById(Long id); + + /** + * 批量删除技术鉴定 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWornTechnicalAppraisalByIds(Long[] ids); + /** + * 查询我上传的技术鉴定表列表 + * + * @param wornTechnicalAppraisal 查询条件 + * @return 列表 + */ + List selectMyTechnicalAppraisalList(WornTechnicalAppraisal wornTechnicalAppraisal); +} diff --git a/src/main/java/com/shzg/project/worn/service/IWornOutboundBillService.java b/src/main/java/com/shzg/project/worn/service/IWornOutboundBillService.java new file mode 100644 index 0000000..39af263 --- /dev/null +++ b/src/main/java/com/shzg/project/worn/service/IWornOutboundBillService.java @@ -0,0 +1,69 @@ +package com.shzg.project.worn.service; + +import java.util.List; +import com.shzg.project.worn.domain.WornOutboundBill; + +/** + * 出库单据Service接口 + * + * @author shzg + * @date 2026-04-08 + */ +public interface IWornOutboundBillService +{ + /** + * 查询出库单据 + * + * @param id 出库单据主键 + * @return 出库单据 + */ + public WornOutboundBill selectWornOutboundBillById(Long id); + + /** + * 查询出库单据列表 + * + * @param wornOutboundBill 出库单据 + * @return 出库单据集合 + */ + public List selectWornOutboundBillList(WornOutboundBill wornOutboundBill); + + /** + * 新增出库单据 + * + * @param wornOutboundBill 出库单据 + * @return 结果 + */ + public int insertWornOutboundBill(WornOutboundBill wornOutboundBill); + + /** + * 修改出库单据 + * + * @param wornOutboundBill 出库单据 + * @return 结果 + */ + public int updateWornOutboundBill(WornOutboundBill wornOutboundBill); + + /** + * 批量删除出库单据 + * + * @param ids 需要删除的出库单据主键集合 + * @return 结果 + */ + public int deleteWornOutboundBillByIds(Long[] ids); + + /** + * 删除出库单据信息 + * + * @param id 出库单据主键 + * @return 结果 + */ + public int deleteWornOutboundBillById(Long id); + /** + * 完成出库 + * + * @param wornOutboundBill 出库单 + * @return 结果 + */ + int completeWornOutboundBill(WornOutboundBill wornOutboundBill); + +} diff --git a/src/main/java/com/shzg/project/worn/service/IWornOutboundItemService.java b/src/main/java/com/shzg/project/worn/service/IWornOutboundItemService.java new file mode 100644 index 0000000..6529649 --- /dev/null +++ b/src/main/java/com/shzg/project/worn/service/IWornOutboundItemService.java @@ -0,0 +1,69 @@ +package com.shzg.project.worn.service; + +import java.util.List; +import com.shzg.project.worn.domain.WornOutboundItem; +import com.shzg.project.worn.domain.dto.WornOutboundUpdateDTO; + +/** + * 出库单明细Service接口 + * + * @author shzg + * @date 2026-04-08 + */ +public interface IWornOutboundItemService +{ + /** + * 查询出库单明细 + * + * @param id 出库单明细主键 + * @return 出库单明细 + */ + public WornOutboundItem selectWornOutboundItemById(Long id); + + /** + * 查询出库单明细列表 + * + * @param wornOutboundItem 出库单明细 + * @return 出库单明细集合 + */ + public List selectWornOutboundItemList(WornOutboundItem wornOutboundItem); + + /** + * 新增出库单明细 + * + * @param wornOutboundItem 出库单明细 + * @return 结果 + */ + public int insertWornOutboundItem(WornOutboundItem wornOutboundItem); + + /** + * 修改出库单明细 + * + * @param dto 出库单明细 + * @return 结果 + */ + public int updateWornOutboundItem(WornOutboundUpdateDTO dto); + + /** + * 批量删除出库单明细 + * + * @param ids 需要删除的出库单明细主键集合 + * @return 结果 + */ + public int deleteWornOutboundItemByIds(Long[] ids); + + /** + * 删除出库单明细信息 + * + * @param id 出库单明细主键 + * @return 结果 + */ + public int deleteWornOutboundItemById(Long id); + /** + * 根据出库单号查询出库单明细 + * + * @param wornOutboundItem 出库单明细参数 + * @return 出库单详情 + */ + WornOutboundUpdateDTO selectWornOutboundItemByBillNo(WornOutboundItem wornOutboundItem); +} diff --git a/src/main/java/com/shzg/project/worn/service/IWornTechnicalAppraisalFileService.java b/src/main/java/com/shzg/project/worn/service/IWornTechnicalAppraisalFileService.java new file mode 100644 index 0000000..7ff3f67 --- /dev/null +++ b/src/main/java/com/shzg/project/worn/service/IWornTechnicalAppraisalFileService.java @@ -0,0 +1,74 @@ +package com.shzg.project.worn.service; + +import java.util.List; +import com.shzg.project.worn.domain.WornTechnicalAppraisalFile; +import com.shzg.project.worn.domain.dto.FileUrlDTO; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; + +/** + * 技术鉴定附件Service接口 + * + * @author shzg + * @date 2026-04-10 + */ +public interface IWornTechnicalAppraisalFileService +{ + /** + * 查询技术鉴定附件 + * + * @param id 技术鉴定附件主键 + * @return 技术鉴定附件 + */ + public WornTechnicalAppraisalFile selectWornTechnicalAppraisalFileById(Long id); + + /** + * 查询技术鉴定附件列表 + * + * @param wornTechnicalAppraisalFile 技术鉴定附件 + * @return 技术鉴定附件集合 + */ + public List selectWornTechnicalAppraisalFileList(WornTechnicalAppraisalFile wornTechnicalAppraisalFile); + + /** + * 新增技术鉴定附件 + * + * @param wornTechnicalAppraisalFile 技术鉴定附件 + * @return 结果 + */ + public int insertWornTechnicalAppraisalFile(WornTechnicalAppraisalFile wornTechnicalAppraisalFile); + + /** + * 修改技术鉴定附件 + * + * @param wornTechnicalAppraisalFile 技术鉴定附件 + * @return 结果 + */ + public int updateWornTechnicalAppraisalFile(WornTechnicalAppraisalFile wornTechnicalAppraisalFile); + + /** + * 批量删除技术鉴定附件 + * + * @param ids 需要删除的技术鉴定附件主键集合 + * @return 结果 + */ + public int deleteWornTechnicalAppraisalFileByIds(Long[] ids); + + /** + * 删除技术鉴定附件信息 + * + * @param id 技术鉴定附件主键 + * @return 结果 + */ + public int deleteWornTechnicalAppraisalFileById(Long id); + /** + * 上传技术鉴定表附件 + * 只返回URL,不入库 + * + * @param files 文件数组 + * @param request request + * @return 文件访问URL列表 + */ + List uploadBatch(MultipartFile[] files, String scene, String bizType, HttpServletRequest request); +} diff --git a/src/main/java/com/shzg/project/worn/service/IWornTechnicalAppraisalService.java b/src/main/java/com/shzg/project/worn/service/IWornTechnicalAppraisalService.java new file mode 100644 index 0000000..e363e7b --- /dev/null +++ b/src/main/java/com/shzg/project/worn/service/IWornTechnicalAppraisalService.java @@ -0,0 +1,77 @@ +package com.shzg.project.worn.service; + +import java.util.List; + +import com.shzg.framework.web.page.TableDataInfo; +import com.shzg.project.worn.domain.WornTechnicalAppraisal; +import com.shzg.project.worn.domain.dto.WornTechnicalAppraisalSimpleDTO; + +/** + * 技术鉴定Service接口 + * + * @author shzg + * @date 2026-04-10 + */ +public interface IWornTechnicalAppraisalService +{ + /** + * 查询技术鉴定 + * + * @param id 技术鉴定主键 + * @return 技术鉴定 + */ + public WornTechnicalAppraisal selectWornTechnicalAppraisalById(Long id); + + /** + * 查询技术鉴定列表 + * + * @param wornTechnicalAppraisal 技术鉴定 + * @return 技术鉴定集合 + */ + public List selectWornTechnicalAppraisalList(WornTechnicalAppraisal wornTechnicalAppraisal); + + /** + * 新增技术鉴定 + * + * @param wornTechnicalAppraisal 技术鉴定 + * @return 结果 + */ + public int insertWornTechnicalAppraisal(WornTechnicalAppraisal wornTechnicalAppraisal); + + /** + * 修改技术鉴定 + * + * @param wornTechnicalAppraisal 技术鉴定 + * @return 结果 + */ + public int updateWornTechnicalAppraisal(WornTechnicalAppraisal wornTechnicalAppraisal); + + /** + * 批量删除技术鉴定 + * + * @param ids 需要删除的技术鉴定主键集合 + * @return 结果 + */ + public int deleteWornTechnicalAppraisalByIds(Long[] ids); + + /** + * 删除技术鉴定信息 + * + * @param id 技术鉴定主键 + * @return 结果 + */ + public int deleteWornTechnicalAppraisalById(Long id); + /** + * 新增技术鉴定表(含附件) + * + * @param wornTechnicalAppraisal 技术鉴定表 + * @return 结果 + */ + int insertWornTechnicalAppraisalWithFiles(WornTechnicalAppraisal wornTechnicalAppraisal); + /** + * 查询我上传的技术鉴定表列表 + * + * @return 技术鉴定表列表 + */ + TableDataInfo selectMyTechnicalAppraisalSimplePageList(); +} diff --git a/src/main/java/com/shzg/project/worn/service/impl/WornInboundBillServiceImpl.java b/src/main/java/com/shzg/project/worn/service/impl/WornInboundBillServiceImpl.java index b5ef6aa..02ce04f 100644 --- a/src/main/java/com/shzg/project/worn/service/impl/WornInboundBillServiceImpl.java +++ b/src/main/java/com/shzg/project/worn/service/impl/WornInboundBillServiceImpl.java @@ -29,6 +29,7 @@ import com.shzg.project.unique.domain.WornUniqueCode; import com.shzg.project.unique.domain.WornUniqueCodeEvent; import com.shzg.project.unique.mapper.WornUniqueCodeEventMapper; import com.shzg.project.unique.mapper.WornUniqueCodeMapper; +import com.shzg.project.unique.mapper.WornUniqueCodeMaterialMapper; import com.shzg.project.worn.domain.WornInboundItem; import com.shzg.project.worn.domain.dto.WornInboundPartialFinishDTO; import com.shzg.project.worn.domain.dto.WornInboundPartialFinishItemDTO; @@ -71,6 +72,9 @@ public class WornInboundBillServiceImpl implements IWornInboundBillService @Value("${worn.pdf-font-locations:classpath:fonts/simhei.ttf,/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc,/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc,/usr/share/fonts/truetype/wqy/wqy-zenhei.ttc,/usr/share/fonts/truetype/arphic/ukai.ttc,C:/Windows/Fonts/simhei.ttf,C:/Windows/Fonts/simsun.ttc}") private String pdfFontLocations; + @Autowired + private WornUniqueCodeMaterialMapper wornUniqueCodeMaterialMapper; + /** * 查询入库库存 @@ -118,7 +122,9 @@ public class WornInboundBillServiceImpl implements IWornInboundBillService /* ================== 2. 当前用户 ================== */ Long userId = SecurityUtils.getLoginUser().getUser().getUserId(); + Long deptId = SecurityUtils.getLoginUser().getUser().getDeptId(); + wornInboundBill.setProjectId(deptId); /* ================== 3. 主表赋值 ================== */ wornInboundBill.setCreateTime(DateUtils.getNowDate()); wornInboundBill.setCreateBy(String.valueOf(userId)); @@ -444,14 +450,12 @@ public class WornInboundBillServiceImpl implements IWornInboundBillService updateItem.setUpdateTime(now); int itemRows = wornInboundItemMapper.updateItemToVoid(updateItem); - if (itemRows <= 0) - { + if (itemRows <= 0){ throw new RuntimeException("明细作废失败,ID=" + item.getId()); } // 2.2 唯一码作废 - if (item.getUniqueCode() != null) - { + if (item.getUniqueCode() != null){ WornUniqueCode unique = wornUniqueCodeMapper.selectByCode(item.getUniqueCode()); if (unique != null) { @@ -467,8 +471,16 @@ public class WornInboundBillServiceImpl implements IWornInboundBillService { throw new RuntimeException("唯一码作废失败:" + item.getUniqueCode()); } - - // 🔥 写事件(9=作废) + /* ================== 3.3 更新 material 为删除 ================== */ + WornUniqueCode wornUniqueCode = new WornUniqueCode(); + wornUniqueCode.setCode(item.getUniqueCode()); + List list = wornUniqueCodeMapper.selectWornUniqueCodeList(wornUniqueCode); + if (list != null && list.size() > 0){ + //一个唯一码只有一条 + Long uniqueCodeId = list.get(0).getId(); + int uniqueRow = wornUniqueCodeMaterialMapper.updateDeleteByUniqueCodeId(uniqueCodeId); + } + /* ================== 3.3 写事件(9=作废) ================== */ WornUniqueCodeEvent event = new WornUniqueCodeEvent(); event.setUniqueCodeId(unique.getId()); event.setEventType("9"); // 作废事件 diff --git a/src/main/java/com/shzg/project/worn/service/impl/WornInboundItemServiceImpl.java b/src/main/java/com/shzg/project/worn/service/impl/WornInboundItemServiceImpl.java index 3c28790..0147796 100644 --- a/src/main/java/com/shzg/project/worn/service/impl/WornInboundItemServiceImpl.java +++ b/src/main/java/com/shzg/project/worn/service/impl/WornInboundItemServiceImpl.java @@ -8,8 +8,10 @@ import com.shzg.common.utils.SecurityUtils; import com.shzg.common.utils.StringUtils; import com.shzg.project.unique.domain.WornUniqueCode; import com.shzg.project.unique.domain.WornUniqueCodeEvent; +import com.shzg.project.unique.domain.WornUniqueCodeMaterial; import com.shzg.project.unique.mapper.WornUniqueCodeEventMapper; import com.shzg.project.unique.mapper.WornUniqueCodeMapper; +import com.shzg.project.unique.mapper.WornUniqueCodeMaterialMapper; import com.shzg.project.worn.domain.WornInboundBill; import com.shzg.project.worn.domain.WornMaterial; import com.shzg.project.worn.domain.dto.WornInboundItemDTO; @@ -42,6 +44,8 @@ public class WornInboundItemServiceImpl implements IWornInboundItemService private WornUniqueCodeEventMapper eventMapper; @Autowired private WornInboundBillMapper wornInboundBillMapper; + @Autowired + private WornUniqueCodeMaterialMapper wornUniqueCodeMaterialMapper; /** * 查询入库单明细 * @@ -176,6 +180,7 @@ public class WornInboundItemServiceImpl implements IWornInboundItemService throw new RuntimeException("入库单更新失败"); } + WornInboundBill billUp = wornInboundBillMapper.selectWornInboundBillByBillNo(dto.getBillNo()); // 2. 更新 / 新增 / 删除明细 if (dto.getItemList() != null && !dto.getItemList().isEmpty()){ for (WornInboundItemDTO itemDTO : dto.getItemList()){ @@ -208,7 +213,7 @@ public class WornInboundItemServiceImpl implements IWornInboundItemService // 新增 if (itemDTO.getId() == null){ WornInboundItem newItem = new WornInboundItem(); - newItem.setBillId(dto.getBillId()); + newItem.setBillId(billUp.getId()); newItem.setBillNo(dto.getBillNo()); newItem.setMaterialId(itemDTO.getMaterialId()); newItem.setQuantity(itemDTO.getQuantity()); @@ -251,7 +256,19 @@ public class WornInboundItemServiceImpl implements IWornInboundItemService { throw new RuntimeException("入库明细更新失败"); } - + //唯一码物料表更改 + WornUniqueCode wornUniqueCode = new WornUniqueCode(); + wornUniqueCode.setCode(oldCode); + List list = wornUniqueCodeMapper.selectWornUniqueCodeList(wornUniqueCode); + if (list != null && list.size() > 0){ + //一个唯一码只有一条 + Long uniqueCodeId = list.get(0).getId(); + WornUniqueCodeMaterial wornUniqueCodeMaterial = new WornUniqueCodeMaterial(); + wornUniqueCodeMaterial.setUniqueCodeId(uniqueCodeId); + wornUniqueCodeMaterial.setQuantity(itemDTO.getQuantity()); + wornUniqueCodeMaterial.setRemark(itemDTO.getRemark()); + int uniqueRow = wornUniqueCodeMaterialMapper.updateWornUniqueCodeMaterial(wornUniqueCodeMaterial); + } // 唯一码变更处理 if (oldCode != null && !oldCode.equals(newCode)){ rollbackUniqueCode(userId, oldCode, now); diff --git a/src/main/java/com/shzg/project/worn/service/impl/WornOutboundBillServiceImpl.java b/src/main/java/com/shzg/project/worn/service/impl/WornOutboundBillServiceImpl.java new file mode 100644 index 0000000..098a668 --- /dev/null +++ b/src/main/java/com/shzg/project/worn/service/impl/WornOutboundBillServiceImpl.java @@ -0,0 +1,375 @@ +package com.shzg.project.worn.service.impl; + +import java.util.Date; +import java.util.List; +import com.shzg.common.utils.DateUtils; +import com.shzg.common.utils.SecurityUtils; +import com.shzg.common.utils.StringUtils; +import com.shzg.project.unique.domain.WornUniqueCode; +import com.shzg.project.unique.domain.WornUniqueCodeEvent; +import com.shzg.project.unique.domain.WornUniqueCodeMaterial; +import com.shzg.project.unique.mapper.WornUniqueCodeEventMapper; +import com.shzg.project.unique.mapper.WornUniqueCodeMapper; +import com.shzg.project.unique.mapper.WornUniqueCodeMaterialMapper; +import com.shzg.project.worn.domain.WornOutboundItem; +import com.shzg.project.worn.mapper.WornOutboundItemMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.shzg.project.worn.mapper.WornOutboundBillMapper; +import com.shzg.project.worn.domain.WornOutboundBill; +import com.shzg.project.worn.service.IWornOutboundBillService; +import org.springframework.transaction.annotation.Transactional; + +/** + * 出库单据Service业务层处理 + * + * @author shzg + * @date 2026-04-08 + */ +@Service +public class WornOutboundBillServiceImpl implements IWornOutboundBillService +{ + @Autowired + private WornOutboundBillMapper wornOutboundBillMapper; + @Autowired + private WornOutboundItemMapper wornOutboundItemMapper; + @Autowired + private WornUniqueCodeMapper wornUniqueCodeMapper; + + @Autowired + private WornUniqueCodeEventMapper eventMapper; + + @Autowired + private WornUniqueCodeMaterialMapper wornUniqueCodeMaterialMapper; + /** + * 查询出库单据 + * + * @param id 出库单据主键 + * @return 出库单据 + */ + @Override + public WornOutboundBill selectWornOutboundBillById(Long id) + { + return wornOutboundBillMapper.selectWornOutboundBillById(id); + } + + /** + * 查询出库单据列表 + * + * @param wornOutboundBill 出库单据 + * @return 出库单据 + */ + @Override + public List selectWornOutboundBillList(WornOutboundBill wornOutboundBill) + { + return wornOutboundBillMapper.selectWornOutboundBillList(wornOutboundBill); + } + + /** + * 新增出库单据 + * + * @param wornOutboundBill 出库单据 + * @return 结果 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int insertWornOutboundBill(WornOutboundBill wornOutboundBill){ + /* ================== 1. 参数校验 ================== */ + if (wornOutboundBill == null) + { + throw new RuntimeException("出库单参数不能为空"); + } + if (wornOutboundBill.getItemList() == null || wornOutboundBill.getItemList().isEmpty()) + { + throw new RuntimeException("出库明细不能为空"); + } + + /* ================== 2. 当前用户 ================== */ + Long userId = SecurityUtils.getLoginUser().getUser().getUserId(); + Long deptId = SecurityUtils.getLoginUser().getUser().getDeptId(); + + wornOutboundBill.setProjectId(deptId); + + /* ================== 3. 主表赋值 ================== */ + wornOutboundBill.setCreateTime(DateUtils.getNowDate()); + wornOutboundBill.setCreateBy(String.valueOf(userId)); + wornOutboundBill.setBillType("0"); + wornOutboundBill.setStatus("0"); + wornOutboundBill.setIsDelete("0"); + + if (wornOutboundBill.getBillNo() == null || "".equals(wornOutboundBill.getBillNo().trim())) + { + wornOutboundBill.setBillNo("DL" + System.currentTimeMillis()); + } + + /* ================== 4. 插入主表 ================== */ + int rows = wornOutboundBillMapper.insertWornOutboundBill(wornOutboundBill); + if (rows <= 0) + { + throw new RuntimeException("出库单新增失败"); + } + + Long billId = wornOutboundBill.getId(); + String billNo = wornOutboundBill.getBillNo(); + + if (billId == null) + { + throw new RuntimeException("出库单新增失败,ID未回填"); + } + + /* ================== 5. 插入明细 ================== */ + for (WornOutboundItem item : wornOutboundBill.getItemList()) + { + if (item == null) + { + continue; + } + + item.setBillId(billId); + item.setBillNo(billNo); + item.setCreateTime(DateUtils.getNowDate()); + item.setCreateBy(String.valueOf(userId)); + item.setIsDelete(item.getIsDelete()); + + int itemRows = wornOutboundItemMapper.insertWornOutboundItem(item); + if (itemRows <= 0) + { + throw new RuntimeException("出库明细新增失败"); + } + + /* ================== 6. 唯一码联动 ================== */ + if (item.getUniqueCode() != null) + { + Integer code = item.getUniqueCode(); + + Long uniqueId = wornUniqueCodeMapper.selectIdByCode(code); + if (uniqueId == null) + { + throw new RuntimeException("唯一码不存在:" + code); + } + + WornUniqueCode unique = wornUniqueCodeMapper.selectByCode(code); + + // ❗必须是“已入库状态(2)”才能出库 + if (!"2".equals(unique.getStatus())){ + throw new RuntimeException("唯一码[" + code + "]未入库,不能出库"); + } + + /* ===== 状态更新:2 → 3(出库申请) ===== */ + WornUniqueCode update = new WornUniqueCode(); + update.setCode(code); + update.setStatus("3"); // ⭐已出库 + update.setUpdateBy(String.valueOf(userId)); + update.setUpdateTime(DateUtils.getNowDate()); + + int updateRows = wornUniqueCodeMapper.updateByCode(update); + if (updateRows <= 0) + { + throw new RuntimeException("唯一码状态更新失败:" + code); + } + + /* ================== 7. 插入事件 ================== */ + WornUniqueCodeEvent event = new WornUniqueCodeEvent(); + event.setUniqueCodeId(uniqueId); + event.setEventType("3"); // ⭐生成出库单 + event.setEventStatus("3"); // ⭐完成出库 + event.setEventDesc("生成出库单:" + billNo); + event.setOperatorId(userId); + event.setOperatorName(SecurityUtils.getUsername()); + event.setCreateBy(String.valueOf(userId)); + event.setCreateTime(DateUtils.getNowDate()); + event.setIsDelete("0"); + + int eventRows = eventMapper.insertWornUniqueCodeEvent(event); + if (eventRows <= 0) + { + throw new RuntimeException("唯一码事件记录失败:" + code); + } + } + } + + return 1; + } + + /** + * 修改出库单据 + * + * @param wornOutboundBill 出库单据 + * @return 结果 + */ + @Override + public int updateWornOutboundBill(WornOutboundBill wornOutboundBill) + { + wornOutboundBill.setUpdateTime(DateUtils.getNowDate()); + return wornOutboundBillMapper.updateWornOutboundBill(wornOutboundBill); + } + + /** + * 批量删除出库单据 + * + * @param ids 需要删除的出库单据主键 + * @return 结果 + */ + @Override + public int deleteWornOutboundBillByIds(Long[] ids) + { + return wornOutboundBillMapper.deleteWornOutboundBillByIds(ids); + } + + /** + * 删除出库单据信息 + * + * @param id 出库单据主键 + * @return 结果 + */ + @Override + public int deleteWornOutboundBillById(Long id) + { + return wornOutboundBillMapper.deleteWornOutboundBillById(id); + } + /** + * 完成出库 + * + * @param wornOutboundBill 出库单 + * @return 结果 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int completeWornOutboundBill(WornOutboundBill wornOutboundBill) + { + /* ================== 1. 参数校验 ================== */ + if (wornOutboundBill == null) + { + throw new RuntimeException("出库单参数不能为空"); + } + if (StringUtils.isEmpty(wornOutboundBill.getBillNo())) + { + throw new RuntimeException("出库单号不能为空"); + } + + /* ================== 2. 当前用户 ================== */ + Long userId = SecurityUtils.getLoginUser().getUser().getUserId(); + Date now = DateUtils.getNowDate(); + + /* ================== 3. 查询出库单 ================== */ + WornOutboundBill dbBill = wornOutboundBillMapper.selectWornOutboundBillByBillNo(wornOutboundBill.getBillNo()); + if (dbBill == null) + { + throw new RuntimeException("出库单不存在:" + wornOutboundBill.getBillNo()); + } + + /* ================== 4. 查询出库明细 ================== */ + WornOutboundItem param = new WornOutboundItem(); + param.setBillNo(wornOutboundBill.getBillNo()); + + List itemList = wornOutboundItemMapper.selectWornOutboundItemList(param); + if (itemList == null || itemList.isEmpty()) + { + throw new RuntimeException("出库明细不能为空"); + } + + /* ================== 5. 循环处理每个唯一码 ================== */ + for (WornOutboundItem item : itemList) + { + if (item == null){ + continue; + } + if ("1".equals(item.getIsDelete())){ + continue; + } + if (item.getUniqueCode() == null){ + throw new RuntimeException("出库明细存在空唯一码"); + } + + Integer code = item.getUniqueCode(); + + /* ===== 5.1 查询唯一码 ===== */ + WornUniqueCode uniqueCode = wornUniqueCodeMapper.selectByCode(code); + if (uniqueCode == null){ + throw new RuntimeException("唯一码不存在:" + code); + } + + /* ===== 5.2 只有状态3才能完成出库 ===== */ + if (!"3".equals(uniqueCode.getStatus())){ + if ("2".equals(uniqueCode.getStatus())){ + throw new RuntimeException("唯一码[" + code + "]尚未生成出库单号,不能完成出库"); + }else if ("4".equals(uniqueCode.getStatus())){ + throw new RuntimeException("唯一码[" + code + "]已完成出库,请勿重复操作"); + }else if ("9".equals(uniqueCode.getStatus())){ + throw new RuntimeException("唯一码[" + code + "]已作废"); + }else{ + throw new RuntimeException("唯一码[" + code + "]当前状态不允许完成出库"); + } + } + + /* ===== 5.3 更新唯一码状态:3 -> 4 ===== */ + WornUniqueCode update = new WornUniqueCode(); + update.setCode(code); + update.setStatus("4"); + update.setUpdateBy(String.valueOf(userId)); + update.setUpdateTime(now); + + int updateRows = wornUniqueCodeMapper.updateByCode(update); + if (updateRows <= 0){ + throw new RuntimeException("唯一码状态更新失败:" + code); + } + + /* ===== 5.4 同步更新唯一码物料表:逻辑删除 ===== */ + WornUniqueCodeMaterial codeMaterial = new WornUniqueCodeMaterial(); + codeMaterial.setUniqueCodeId(uniqueCode.getId()); + codeMaterial.setIsDelete("1"); + codeMaterial.setUpdateBy(String.valueOf(userId)); + codeMaterial.setUpdateTime(now); + + int materialRows = wornUniqueCodeMaterialMapper.updateWornUniqueCodeMaterial(codeMaterial); + if (materialRows <= 0){ + throw new RuntimeException("唯一码物料信息更新失败:" + code); + } + + /* ===== 5.5 写事件记录 ===== */ + WornUniqueCodeEvent event = new WornUniqueCodeEvent(); + event.setUniqueCodeId(uniqueCode.getId()); + event.setEventType("4"); + event.setEventStatus("4"); + event.setEventDesc("完成出库,出库单号:" + dbBill.getBillNo()); + event.setOperatorId(userId); + event.setOperatorName(SecurityUtils.getUsername()); + event.setCreateBy(String.valueOf(userId)); + event.setCreateTime(now); + event.setIsDelete("0"); + + int eventRows = eventMapper.insertWornUniqueCodeEvent(event); + if (eventRows <= 0){ + throw new RuntimeException("唯一码事件记录失败:" + code); + } + } + + /* ================== 6. 更新出库单状态 ================== */ + WornOutboundBill updateBill = new WornOutboundBill(); + updateBill.setBillNo(dbBill.getBillNo()); + updateBill.setUpdateBy(String.valueOf(userId)); + updateBill.setUpdateTime(now); + // 4. 判断该单据下是否全部明细都已出库 + int notOutboundCount = wornOutboundItemMapper.countNotOutboundByBillId(dbBill.getId()); + if (notOutboundCount == 0) + { + // 全部出库 + updateBill.setStatus("1"); // 已完成 + updateBill.setBillType("1"); // + } + else + { + // 部分出库 + updateBill.setStatus("2"); // 部分出库 + // billType 可不改 + } + + int billRows = wornOutboundBillMapper.updateWornOutboundBill(updateBill); + if (billRows <= 0) + { + throw new RuntimeException("出库单状态更新失败"); + } + + return 1; + } +} diff --git a/src/main/java/com/shzg/project/worn/service/impl/WornOutboundItemServiceImpl.java b/src/main/java/com/shzg/project/worn/service/impl/WornOutboundItemServiceImpl.java new file mode 100644 index 0000000..da234e7 --- /dev/null +++ b/src/main/java/com/shzg/project/worn/service/impl/WornOutboundItemServiceImpl.java @@ -0,0 +1,427 @@ +package com.shzg.project.worn.service.impl; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import com.shzg.common.utils.DateUtils; +import com.shzg.common.utils.SecurityUtils; +import com.shzg.common.utils.StringUtils; +import com.shzg.project.unique.domain.WornUniqueCode; +import com.shzg.project.unique.domain.WornUniqueCodeEvent; +import com.shzg.project.unique.domain.WornUniqueCodeMaterial; +import com.shzg.project.unique.mapper.WornUniqueCodeEventMapper; +import com.shzg.project.unique.mapper.WornUniqueCodeMapper; +import com.shzg.project.unique.mapper.WornUniqueCodeMaterialMapper; +import com.shzg.project.worn.domain.WornOutboundBill; +import com.shzg.project.worn.domain.dto.WornInboundItemDTO; +import com.shzg.project.worn.domain.dto.WornOutboundUpdateDTO; +import com.shzg.project.worn.mapper.WornInboundBillMapper; +import com.shzg.project.worn.mapper.WornOutboundBillMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.shzg.project.worn.mapper.WornOutboundItemMapper; +import com.shzg.project.worn.domain.WornOutboundItem; +import com.shzg.project.worn.service.IWornOutboundItemService; + +/** + * 出库单明细Service业务层处理 + * + * @author shzg + * @date 2026-04-08 + */ +@Service +public class WornOutboundItemServiceImpl implements IWornOutboundItemService +{ + @Autowired + private WornOutboundItemMapper wornOutboundItemMapper; + @Autowired + private WornUniqueCodeMapper wornUniqueCodeMapper; + @Autowired + private WornUniqueCodeEventMapper eventMapper; + @Autowired + private WornInboundBillMapper wornInboundBillMapper; + @Autowired + private WornUniqueCodeMaterialMapper wornUniqueCodeMaterialMapper; + @Autowired + private WornOutboundBillMapper wornOutboundBillMapper; + /** + * 查询出库单明细 + * + * @param id 出库单明细主键 + * @return 出库单明细 + */ + @Override + public WornOutboundItem selectWornOutboundItemById(Long id) + { + return wornOutboundItemMapper.selectWornOutboundItemById(id); + } + + /** + * 查询出库单明细列表 + * + * @param wornOutboundItem 出库单明细 + * @return 出库单明细 + */ + @Override + public List selectWornOutboundItemList(WornOutboundItem wornOutboundItem) + { + return wornOutboundItemMapper.selectWornOutboundItemList(wornOutboundItem); + } + + /** + * 新增出库单明细 + * + * @param wornOutboundItem 出库单明细 + * @return 结果 + */ + @Override + public int insertWornOutboundItem(WornOutboundItem wornOutboundItem) + { + wornOutboundItem.setCreateTime(DateUtils.getNowDate()); + return wornOutboundItemMapper.insertWornOutboundItem(wornOutboundItem); + } + + /** + * 修改出库单明细 + * + * @param dto 出库单明细 + * @return 结果 + */ + @Override + public int updateWornOutboundItem(WornOutboundUpdateDTO dto) + { + if (dto == null){ + throw new RuntimeException("出库单参数不能为空"); + } + + Long userId = SecurityUtils.getLoginUser().getUser().getUserId(); + Date now = DateUtils.getNowDate(); + + // 1. 更新主表 + WornOutboundBill bill = new WornOutboundBill(); + bill.setBillNo(dto.getBillNo()); + bill.setWarehouseCode(dto.getWarehouseCode()); + bill.setWarehouseName(dto.getWarehouseName()); + bill.setAreaCode(dto.getAreaCode()); + bill.setAreaName(dto.getAreaName()); + bill.setRemark(dto.getBillRemark()); + bill.setOutboundTime(dto.getOutboundTime()); + bill.setStatus("0"); + bill.setUpdateBy(String.valueOf(userId)); + bill.setUpdateTime(now); + + int billRows = wornOutboundBillMapper.updateWornOutboundBill(bill); + if (billRows <= 0){ + throw new RuntimeException("出库单更新失败"); + } + + WornOutboundBill billUp = wornOutboundBillMapper.selectWornOutboundBillByBillNo(dto.getBillNo()); + if (billUp == null){ + throw new RuntimeException("出库单不存在:" + dto.getBillNo()); + } + + // 2. 更新 / 新增 / 删除明细 + if (dto.getItemList() != null && !dto.getItemList().isEmpty()){ + for (WornInboundItemDTO itemDTO : dto.getItemList()){ + if (itemDTO == null){ + continue; + } + + // 删除 + if ("1".equals(itemDTO.getIsDelete())){ + if (itemDTO.getId() != null){ + WornOutboundItem oldItem = wornOutboundItemMapper.selectWornOutboundItemById(itemDTO.getId()); + if (oldItem != null){ + oldItem.setIsDelete("1"); + oldItem.setUpdateBy(String.valueOf(userId)); + oldItem.setUpdateTime(now); + + int deleteRows = wornOutboundItemMapper.updateWornOutboundItem(oldItem); + if (deleteRows <= 0){ + throw new RuntimeException("出库明细删除失败"); + } + + if (oldItem.getUniqueCode() != null){ + rollbackUniqueCodeOut(userId, oldItem.getUniqueCode(), now); + } + } + } + continue; + } + + // 新增 + if (itemDTO.getId() == null){ + WornOutboundItem newItem = new WornOutboundItem(); + newItem.setBillId(billUp.getId()); + newItem.setBillNo(dto.getBillNo()); + newItem.setMaterialId(itemDTO.getMaterialId()); + newItem.setQuantity(itemDTO.getQuantity()); + newItem.setRemark(itemDTO.getRemark()); + newItem.setUniqueCode(itemDTO.getUniqueCode()); + newItem.setIsDelete("0"); + newItem.setCreateBy(String.valueOf(userId)); + newItem.setCreateTime(now); + + int itemRows = wornOutboundItemMapper.insertWornOutboundItem(newItem); + if (itemRows <= 0){ + throw new RuntimeException("出库明细新增失败"); + } + + if (newItem.getUniqueCode() != null){ + handleUniqueCodeOut(userId, dto.getBillNo(), newItem.getUniqueCode(), now); + } + }else{ + // 更新 + WornOutboundItem oldItem = wornOutboundItemMapper.selectWornOutboundItemById(itemDTO.getId()); + if (oldItem == null) + { + throw new RuntimeException("出库明细不存在,ID:" + itemDTO.getId()); + } + + Integer oldCode = oldItem.getUniqueCode(); + Integer newCode = itemDTO.getUniqueCode(); + + oldItem.setMaterialId(itemDTO.getMaterialId()); + oldItem.setQuantity(itemDTO.getQuantity()); + oldItem.setRemark(itemDTO.getRemark()); + oldItem.setUniqueCode(newCode); + oldItem.setUpdateBy(String.valueOf(userId)); + oldItem.setUpdateTime(now); + + int itemRows = wornOutboundItemMapper.updateWornOutboundItem(oldItem); + if (itemRows <= 0) + { + throw new RuntimeException("出库明细更新失败"); + } + + // 唯一码物料表更改(如果你出库也维护这个表,就保留;如果不维护可删掉) + WornUniqueCode wornUniqueCode = new WornUniqueCode(); + wornUniqueCode.setCode(oldCode); + List list = wornUniqueCodeMapper.selectWornUniqueCodeList(wornUniqueCode); + if (list != null && list.size() > 0){ + Long uniqueCodeId = list.get(0).getId(); + WornUniqueCodeMaterial wornUniqueCodeMaterial = new WornUniqueCodeMaterial(); + wornUniqueCodeMaterial.setUniqueCodeId(uniqueCodeId); + wornUniqueCodeMaterial.setQuantity(itemDTO.getQuantity()); + wornUniqueCodeMaterial.setRemark(itemDTO.getRemark()); + wornUniqueCodeMaterialMapper.updateWornUniqueCodeMaterial(wornUniqueCodeMaterial); + } + + // 唯一码变更处理 + if (oldCode != null && !oldCode.equals(newCode)){ + rollbackUniqueCodeOut(userId, oldCode, now); + } + if (newCode != null && !newCode.equals(oldCode)){ + handleUniqueCodeOut(userId, dto.getBillNo(), newCode, now); + } + } + } + } + + return 1; + } + + /** + * 批量删除出库单明细 + * + * @param ids 需要删除的出库单明细主键 + * @return 结果 + */ + @Override + public int deleteWornOutboundItemByIds(Long[] ids) + { + return wornOutboundItemMapper.deleteWornOutboundItemByIds(ids); + } + + /** + * 删除出库单明细信息 + * + * @param id 出库单明细主键 + * @return 结果 + */ + @Override + public int deleteWornOutboundItemById(Long id) + { + return wornOutboundItemMapper.deleteWornOutboundItemById(id); + } + /** + * 查询出库单明细列表 + * + * @param wornOutboundItem 出库单明细 + * @return 出库单明细 + */ + @Override + public WornOutboundUpdateDTO selectWornOutboundItemByBillNo(WornOutboundItem wornOutboundItem) + { + String billNo = wornOutboundItem.getBillNo(); + if (billNo == null || "".equals(billNo.trim())) + { + return null; + } + + // 1. 查询明细列表 + WornOutboundItem param = new WornOutboundItem(); + param.setBillNo(billNo); + + List itemList = wornOutboundItemMapper.selectWornOutboundItemList(param); + + if (itemList == null || itemList.isEmpty()) + { + return null; + } + + // 2. 取第一条作为主数据 + WornOutboundItem first = itemList.get(0); + + // 3. 组装主表 DTO + WornOutboundUpdateDTO dto = new WornOutboundUpdateDTO(); + dto.setBillId(first.getBillId()); + dto.setBillNo(first.getBillNo()); + dto.setBillType(first.getBillType()); + dto.setWarehouseCode(first.getWarehouseCode()); + dto.setWarehouseName(first.getWarehouseName()); + dto.setAreaCode(first.getAreaCode()); + dto.setAreaName(first.getAreaName()); + dto.setBillRemark(first.getBillRemark()); + dto.setOutboundTime(first.getOutboundTime()); + dto.setStatus(first.getBillStatus()); + dto.setCreateTime(first.getCreateTime()); + + List dtoList = new ArrayList<>(); + + // 4. 组装明细 + for (WornOutboundItem item : itemList) + { + WornInboundItemDTO itemDTO = new WornInboundItemDTO(); + + itemDTO.setId(item.getId()); + itemDTO.setMaterialId(item.getMaterialId()); + itemDTO.setMaterialName(item.getMaterialName()); + itemDTO.setMaterialCode(item.getMaterialCode()); + itemDTO.setMaterialShortName(item.getMaterialShortName()); + itemDTO.setModel(item.getModel()); + itemDTO.setSpecification(item.getSpecification()); + itemDTO.setTypeName(item.getTypeName()); + itemDTO.setQuantity(item.getQuantity()); + itemDTO.setRemark(item.getRemark()); + itemDTO.setUniqueCode(item.getUniqueCode()); + itemDTO.setIsDelete(StringUtils.isEmpty(item.getIsDelete()) ? "0" : item.getIsDelete()); + itemDTO.setTypeParentNames(item.getTypeParentNames()); + itemDTO.setUnitId(item.getUnitId()); + itemDTO.setUnitName(item.getUnitName()); + itemDTO.setStatus(item.getStatus()); + + dtoList.add(itemDTO); + } + + dto.setItemList(dtoList); + + return dto; + } + /** + * 出库明细删除/替换时,唯一码状态回滚:3 -> 2 + */ + private void rollbackUniqueCodeOut(Long userId, Integer code, Date now) + { + if (code == null){ + return; + } + + WornUniqueCode uniqueCode = wornUniqueCodeMapper.selectByCode(code); + if (uniqueCode == null){ + throw new RuntimeException("唯一码不存在:" + code); + } + + // 只有“生成出库单号”状态才回滚 + if (!"3".equals(uniqueCode.getStatus())){ + return; + } + + WornUniqueCode update = new WornUniqueCode(); + update.setCode(code); + update.setBillNo(null); + update.setStatus("2"); + update.setUpdateBy(String.valueOf(userId)); + update.setUpdateTime(now); + + int updateRows = wornUniqueCodeMapper.updateByCode(update); + if (updateRows <= 0) + { + throw new RuntimeException("唯一码状态回滚失败:" + code); + } + + Long uniqueId = wornUniqueCodeMapper.selectIdByCode(code); + if (uniqueId != null){ + WornUniqueCodeEvent event = new WornUniqueCodeEvent(); + event.setUniqueCodeId(uniqueId); + event.setEventType("2"); + event.setEventStatus("2"); + event.setEventDesc("出库单编辑回滚,恢复已入库状态"); + event.setOperatorId(userId); + event.setOperatorName(SecurityUtils.getUsername()); + event.setCreateBy(String.valueOf(userId)); + event.setCreateTime(now); + event.setIsDelete("0"); + + eventMapper.insertWornUniqueCodeEvent(event); + } + } + /** + * 出库申请时,唯一码状态处理:2 -> 3 + */ + private void handleUniqueCodeOut(Long userId, String billNo, Integer code, Date now) + { + if (code == null){ + return; + } + + WornUniqueCode uniqueCode = wornUniqueCodeMapper.selectByCode(code); + if (uniqueCode == null) + { + throw new RuntimeException("唯一码不存在:" + code); + } + + if (!"2".equals(uniqueCode.getStatus())) { + if ("3".equals(uniqueCode.getStatus())) + { + throw new RuntimeException("唯一码已生成出库单号,请勿重复操作:" + code); + }else if ("4".equals(uniqueCode.getStatus())){ + throw new RuntimeException("唯一码已完成出库:" + code); + }else if ("9".equals(uniqueCode.getStatus())){ + throw new RuntimeException("唯一码已作废:" + code); + }else{ + throw new RuntimeException("唯一码状态不允许出库:" + code); + } + } + + WornUniqueCode update = new WornUniqueCode(); + update.setCode(code); + update.setBillNo(billNo); + update.setStatus("3"); + update.setUpdateBy(String.valueOf(userId)); + update.setUpdateTime(now); + + int updateRows = wornUniqueCodeMapper.updateByCode(update); + if (updateRows <= 0) + { + throw new RuntimeException("唯一码状态更新失败:" + code); + } + + Long uniqueId = wornUniqueCodeMapper.selectIdByCode(code); + if (uniqueId != null) + { + WornUniqueCodeEvent event = new WornUniqueCodeEvent(); + event.setUniqueCodeId(uniqueId); + event.setEventType("3"); + event.setEventStatus("3"); + event.setEventDesc("编辑出库单,生成出库单号:" + billNo); + event.setOperatorId(userId); + event.setOperatorName(SecurityUtils.getUsername()); + event.setCreateBy(String.valueOf(userId)); + event.setCreateTime(now); + event.setIsDelete("0"); + + eventMapper.insertWornUniqueCodeEvent(event); + } + } +} diff --git a/src/main/java/com/shzg/project/worn/service/impl/WornTechnicalAppraisalFileServiceImpl.java b/src/main/java/com/shzg/project/worn/service/impl/WornTechnicalAppraisalFileServiceImpl.java new file mode 100644 index 0000000..0ddb496 --- /dev/null +++ b/src/main/java/com/shzg/project/worn/service/impl/WornTechnicalAppraisalFileServiceImpl.java @@ -0,0 +1,229 @@ +package com.shzg.project.worn.service.impl; + +import java.io.File; +import java.util.*; + +import com.shzg.common.utils.DateUtils; +import com.shzg.common.utils.StringUtils; +import com.shzg.project.worn.domain.FileUploadConfig; +import com.shzg.project.worn.domain.dto.FileUrlDTO; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.shzg.project.worn.mapper.WornTechnicalAppraisalFileMapper; +import com.shzg.project.worn.domain.WornTechnicalAppraisalFile; +import com.shzg.project.worn.service.IWornTechnicalAppraisalFileService; +import com.shzg.common.exception.ServiceException; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.servlet.support.ServletUriComponentsBuilder; + +import javax.servlet.http.HttpServletRequest; +import java.text.SimpleDateFormat; + +/** + * 技术鉴定附件Service业务层处理 + * + * @author shzg + * @date 2026-04-10 + */ +@Service +public class WornTechnicalAppraisalFileServiceImpl implements IWornTechnicalAppraisalFileService +{ + @Autowired + private WornTechnicalAppraisalFileMapper wornTechnicalAppraisalFileMapper; + + @Autowired + private FileUploadConfig fileUploadConfig; + /** + * 查询技术鉴定附件 + * + * @param id 技术鉴定附件主键 + * @return 技术鉴定附件 + */ + @Override + public WornTechnicalAppraisalFile selectWornTechnicalAppraisalFileById(Long id) + { + return wornTechnicalAppraisalFileMapper.selectWornTechnicalAppraisalFileById(id); + } + + /** + * 查询技术鉴定附件列表 + * + * @param wornTechnicalAppraisalFile 技术鉴定附件 + * @return 技术鉴定附件 + */ + @Override + public List selectWornTechnicalAppraisalFileList(WornTechnicalAppraisalFile wornTechnicalAppraisalFile) + { + return wornTechnicalAppraisalFileMapper.selectWornTechnicalAppraisalFileList(wornTechnicalAppraisalFile); + } + + /** + * 新增技术鉴定附件 + * + * @param wornTechnicalAppraisalFile 技术鉴定附件 + * @return 结果 + */ + @Override + public int insertWornTechnicalAppraisalFile(WornTechnicalAppraisalFile wornTechnicalAppraisalFile) + { + wornTechnicalAppraisalFile.setCreateTime(DateUtils.getNowDate()); + return wornTechnicalAppraisalFileMapper.insertWornTechnicalAppraisalFile(wornTechnicalAppraisalFile); + } + + /** + * 修改技术鉴定附件 + * + * @param wornTechnicalAppraisalFile 技术鉴定附件 + * @return 结果 + */ + @Override + public int updateWornTechnicalAppraisalFile(WornTechnicalAppraisalFile wornTechnicalAppraisalFile) + { + return wornTechnicalAppraisalFileMapper.updateWornTechnicalAppraisalFile(wornTechnicalAppraisalFile); + } + + /** + * 批量删除技术鉴定附件 + * + * @param ids 需要删除的技术鉴定附件主键 + * @return 结果 + */ + @Override + public int deleteWornTechnicalAppraisalFileByIds(Long[] ids) + { + return wornTechnicalAppraisalFileMapper.deleteWornTechnicalAppraisalFileByIds(ids); + } + + /** + * 删除技术鉴定附件信息 + * + * @param id 技术鉴定附件主键 + * @return 结果 + */ + @Override + public int deleteWornTechnicalAppraisalFileById(Long id) + { + return wornTechnicalAppraisalFileMapper.deleteWornTechnicalAppraisalFileById(id); + } + private static final Logger log = LoggerFactory.getLogger(WornTechnicalAppraisalFileServiceImpl.class); + + /** + * 上传技术鉴定附件存放子目录 + * 最终物理路径:profile + /technical_appraisal/yyyy/MM/dd/ + * 最终访问路径:/profile/technical_appraisal/yyyy/MM/dd/xxx.jpg + */ + private static final String BASE_PATH = "/technical_appraisal/"; + + + + @Override + public List uploadBatch(MultipartFile[] files, String scene, String bizType, HttpServletRequest request) + { + if (files == null || files.length == 0) + { + throw new ServiceException("上传文件不能为空"); + } + if (StringUtils.isBlank(scene) || StringUtils.isBlank(bizType)) + { + throw new ServiceException("scene 和 bizType 不能为空"); + } + + scene = scene.trim().toLowerCase(Locale.ROOT); + bizType = bizType.trim().toLowerCase(Locale.ROOT); + + String dateFolder = new SimpleDateFormat("yyyy/MM/dd").format(new Date()); + String uploadPath = fileUploadConfig.getUploadPath(); + + File dir = new File(uploadPath + "/" + scene + "/" + bizType + "/" + dateFolder); + if (!dir.exists()) + { + dir.mkdirs(); + } + + List result = new ArrayList<>(); + + try + { + log.info("进入批量上传接口,scene={}, bizType={}, fileCount={}", scene, bizType, files.length); + + for (MultipartFile file : files) + { + if (file == null || file.isEmpty()) + { + continue; + } + + log.info("========== 上传文件信息 =========="); + log.info("originalFilename = {}", file.getOriginalFilename()); + log.info("contentType = {}", file.getContentType()); + log.info("size(bytes) = {}", file.getSize()); + log.info("================================="); + + String contentType = file.getContentType(); + if (contentType == null || !contentType.startsWith("image/")) + { + throw new ServiceException("上传失败:只允许上传图片文件"); + } + + String original = file.getOriginalFilename(); + String ext = ""; + + if (original != null && original.contains(".")) + { + ext = original.substring(original.lastIndexOf(".")); + } + + if (StringUtils.isBlank(ext)) + { + if ("image/jpeg".equals(contentType)) + { + ext = ".jpg"; + } + else if ("image/png".equals(contentType)) + { + ext = ".png"; + } + else if ("image/gif".equals(contentType)) + { + ext = ".gif"; + } + else if ("image/webp".equals(contentType)) + { + ext = ".webp"; + } + else + { + throw new ServiceException("无法识别图片类型"); + } + } + + String newName = UUID.randomUUID().toString().replace("-", "") + ext; + + File targetFile = new File(dir, newName); + file.transferTo(targetFile); + + String baseUrl = ServletUriComponentsBuilder.fromRequestUri(request) + .replacePath(null) + .build() + .toUriString(); + + String url = baseUrl + "/profile/" + scene + "/" + bizType + "/" + dateFolder + "/" + newName; + + FileUrlDTO dto = new FileUrlDTO(); + dto.setName(newName); + dto.setUrl(url); + result.add(dto); + } + + log.info("批量上传成功,result={}", result); + return result; + } + catch (Exception e) + { + log.error("批量上传失败", e); + throw new ServiceException("文件上传失败:" + e.getMessage()); + } + } +} diff --git a/src/main/java/com/shzg/project/worn/service/impl/WornTechnicalAppraisalServiceImpl.java b/src/main/java/com/shzg/project/worn/service/impl/WornTechnicalAppraisalServiceImpl.java new file mode 100644 index 0000000..8adc626 --- /dev/null +++ b/src/main/java/com/shzg/project/worn/service/impl/WornTechnicalAppraisalServiceImpl.java @@ -0,0 +1,264 @@ +package com.shzg.project.worn.service.impl; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import com.github.pagehelper.PageInfo; +import com.shzg.common.utils.DateUtils; +import com.shzg.common.utils.SecurityUtils; +import com.shzg.common.utils.StringUtils; +import com.shzg.framework.web.page.TableDataInfo; +import com.shzg.project.worn.domain.WornOutboundBill; +import com.shzg.project.worn.domain.WornTechnicalAppraisalFile; +import com.shzg.project.worn.domain.dto.AppraisalFileDTO; +import com.shzg.project.worn.domain.dto.WornTechnicalAppraisalSimpleDTO; +import com.shzg.project.worn.mapper.WornOutboundBillMapper; +import com.shzg.project.worn.mapper.WornTechnicalAppraisalFileMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.shzg.project.worn.mapper.WornTechnicalAppraisalMapper; +import com.shzg.project.worn.domain.WornTechnicalAppraisal; +import com.shzg.project.worn.service.IWornTechnicalAppraisalService; +import org.springframework.transaction.annotation.Transactional; + +/** + * 技术鉴定Service业务层处理 + * + * @author shzg + * @date 2026-04-10 + */ +@Service +public class WornTechnicalAppraisalServiceImpl implements IWornTechnicalAppraisalService +{ + @Autowired + private WornTechnicalAppraisalMapper wornTechnicalAppraisalMapper; + @Autowired + private WornOutboundBillMapper wornOutboundBillMapper; + @Autowired + private WornTechnicalAppraisalFileMapper wornTechnicalAppraisalFileMapper; + /** + * 查询技术鉴定 + * + * @param id 技术鉴定主键 + * @return 技术鉴定 + */ + @Override + public WornTechnicalAppraisal selectWornTechnicalAppraisalById(Long id) + { + return wornTechnicalAppraisalMapper.selectWornTechnicalAppraisalById(id); + } + + /** + * 查询技术鉴定列表 + * + * @param wornTechnicalAppraisal 技术鉴定 + * @return 技术鉴定 + */ + @Override + public List selectWornTechnicalAppraisalList(WornTechnicalAppraisal wornTechnicalAppraisal) + { + return wornTechnicalAppraisalMapper.selectWornTechnicalAppraisalList(wornTechnicalAppraisal); + } + + /** + * 新增技术鉴定 + * + * @param wornTechnicalAppraisal 技术鉴定 + * @return 结果 + */ + @Override + public int insertWornTechnicalAppraisal(WornTechnicalAppraisal wornTechnicalAppraisal) + { + wornTechnicalAppraisal.setCreateTime(DateUtils.getNowDate()); + return wornTechnicalAppraisalMapper.insertWornTechnicalAppraisal(wornTechnicalAppraisal); + } + + /** + * 修改技术鉴定 + * + * @param wornTechnicalAppraisal 技术鉴定 + * @return 结果 + */ + @Override + public int updateWornTechnicalAppraisal(WornTechnicalAppraisal wornTechnicalAppraisal) + { + wornTechnicalAppraisal.setUpdateTime(DateUtils.getNowDate()); + return wornTechnicalAppraisalMapper.updateWornTechnicalAppraisal(wornTechnicalAppraisal); + } + + /** + * 批量删除技术鉴定 + * + * @param ids 需要删除的技术鉴定主键 + * @return 结果 + */ + @Override + public int deleteWornTechnicalAppraisalByIds(Long[] ids) + { + return wornTechnicalAppraisalMapper.deleteWornTechnicalAppraisalByIds(ids); + } + + /** + * 删除技术鉴定信息 + * + * @param id 技术鉴定主键 + * @return 结果 + */ + @Override + public int deleteWornTechnicalAppraisalById(Long id) + { + return wornTechnicalAppraisalMapper.deleteWornTechnicalAppraisalById(id); + } + @Override + @Transactional(rollbackFor = Exception.class) + public int insertWornTechnicalAppraisalWithFiles(WornTechnicalAppraisal wornTechnicalAppraisal) + { + /* ================== 1. 参数校验 ================== */ + if (wornTechnicalAppraisal == null) + { + throw new RuntimeException("技术鉴定表参数不能为空"); + } + if (StringUtils.isEmpty(wornTechnicalAppraisal.getBillNo())) + { + throw new RuntimeException("出库单号不能为空"); + } + + /* ================== 2. 当前用户 ================== */ + Long userId = SecurityUtils.getLoginUser().getUser().getUserId(); + String userName = SecurityUtils.getLoginUser().getUser().getNickName(); + Long deptId = SecurityUtils.getLoginUser().getUser().getDeptId(); + Date now = DateUtils.getNowDate(); + + /* ================== 3. 校验一张出库单只能有一张技术鉴定表 ================== */ + WornTechnicalAppraisal query = new WornTechnicalAppraisal(); + query.setBillNo(wornTechnicalAppraisal.getBillNo()); + List oldList = wornTechnicalAppraisalMapper.selectWornTechnicalAppraisalList(query); + if (oldList != null && !oldList.isEmpty()) + { + throw new RuntimeException("该出库单已存在技术鉴定表,请勿重复新增"); + } + + /* ================== 4. 查询出库单(可选,但建议保留) ================== */ + WornOutboundBill outboundBill = wornOutboundBillMapper.selectWornOutboundBillByBillNo(wornTechnicalAppraisal.getBillNo()); + if (outboundBill == null) + { + throw new RuntimeException("关联出库单不存在:" + wornTechnicalAppraisal.getBillNo()); + } + + /* ================== 5. 主表赋值 ================== */ + if (StringUtils.isEmpty(wornTechnicalAppraisal.getAppraisalNo())) + { + wornTechnicalAppraisal.setAppraisalNo("TAR" + DateUtils.dateTimeNow("yyyyMMddHHmmssSSS")); + } + + wornTechnicalAppraisal.setBillId(outboundBill.getId()); + wornTechnicalAppraisal.setProjectId(deptId); + wornTechnicalAppraisal.setUserId(userId); + wornTechnicalAppraisal.setUserName(userName); + wornTechnicalAppraisal.setStatus("1"); + wornTechnicalAppraisal.setCreateBy(String.valueOf(userId)); + wornTechnicalAppraisal.setCreateTime(now); + wornTechnicalAppraisal.setIsDelete("0"); + + int rows = wornTechnicalAppraisalMapper.insertWornTechnicalAppraisal(wornTechnicalAppraisal); + if (rows <= 0) + { + throw new RuntimeException("技术鉴定表新增失败"); + } + + Long appraisalId = wornTechnicalAppraisal.getId(); + if (appraisalId == null) + { + throw new RuntimeException("技术鉴定表新增失败,ID未回填"); + } + + /* ================== 6. 保存附件 ================== */ + List fileList = wornTechnicalAppraisal.getFileList(); + if (fileList != null && !fileList.isEmpty()) + { + Long sortNum = 1L; + for (WornTechnicalAppraisalFile file : fileList) + { + if (file == null || StringUtils.isEmpty(file.getFileUrl())) + { + continue; + } + + file.setAppraisalId(appraisalId); + file.setSortNum(sortNum++); + file.setCreateBy(String.valueOf(userId)); + file.setCreateTime(now); + file.setIsDelete("0"); + + int fileRows = wornTechnicalAppraisalFileMapper.insertWornTechnicalAppraisalFile(file); + if (fileRows <= 0) + { + throw new RuntimeException("技术鉴定附件保存失败:" + file.getFileName()); + } + } + } + + return 1; + } + @Override + public TableDataInfo selectMyTechnicalAppraisalSimplePageList() + { + Long userId = SecurityUtils.getLoginUser().getUser().getUserId(); + + WornTechnicalAppraisal query = new WornTechnicalAppraisal(); + query.setUserId(userId); + + // 这里的分页由 Controller 里的 startPage() 生效 + List list = + wornTechnicalAppraisalMapper.selectMyTechnicalAppraisalList(query); + + // 保留原始分页信息 + PageInfo pageInfo = new PageInfo<>(list); + + List result = new ArrayList<>(); + + if (list != null && !list.isEmpty()) + { + for (WornTechnicalAppraisal appraisal : list) + { + WornTechnicalAppraisalSimpleDTO dto = new WornTechnicalAppraisalSimpleDTO(); + dto.setId(appraisal.getId()); + dto.setAppraisalNo(appraisal.getAppraisalNo()); + dto.setCreateTime(appraisal.getCreateTime()); + dto.setAppraisalDesc(appraisal.getAppraisalDesc()); + dto.setRemark(appraisal.getRemark()); + // 查询附件 + List fileList = + wornTechnicalAppraisalFileMapper.selectWornTechnicalAppraisalFileByAppraisalId(appraisal.getId()); + + List fileDtoList = new ArrayList<>(); + + if (fileList != null && !fileList.isEmpty()) + { + for (WornTechnicalAppraisalFile file : fileList) + { + if (file == null) + { + continue; + } + + AppraisalFileDTO fileDTO = new AppraisalFileDTO(); + fileDTO.setName(file.getFileName()); + fileDTO.setUrl(file.getFileUrl()); + fileDtoList.add(fileDTO); + } + } + + dto.setFileUrlList(fileDtoList); + result.add(dto); + } + } + + TableDataInfo rspData = new TableDataInfo(); + rspData.setCode(200); + rspData.setRows(result); + rspData.setTotal(pageInfo.getTotal()); + return rspData; + } +} diff --git a/src/main/resources/mybatis/unique/WornUniqueCodeMapper.xml b/src/main/resources/mybatis/unique/WornUniqueCodeMapper.xml index 20178a2..0372cc0 100644 --- a/src/main/resources/mybatis/unique/WornUniqueCodeMapper.xml +++ b/src/main/resources/mybatis/unique/WornUniqueCodeMapper.xml @@ -32,6 +32,8 @@ + + @@ -181,7 +183,8 @@ ucm.remark AS remark, uc.code AS uniqueCode, COALESCE(ucm.is_delete, '0') AS isDelete, - + m.unit_id AS unitId, + mu.unit_name AS unitName, m.material_name AS materialName, m.material_code AS materialCode, m.material_short_name AS materialShortName, @@ -202,7 +205,8 @@ ON ucm.material_id = m.id LEFT JOIN worn_material_type mt ON m.type_id = mt.id - + LEFT JOIN worn_material_unit mu + ON m.unit_id = mu.id WHERE uc.code = #{code} AND (uc.is_delete = '0' OR uc.is_delete IS NULL) AND (ucm.id IS NULL OR ucm.is_delete = '0') diff --git a/src/main/resources/mybatis/unique/WornUniqueCodeMaterialMapper.xml b/src/main/resources/mybatis/unique/WornUniqueCodeMaterialMapper.xml index 23d48de..743fb57 100644 --- a/src/main/resources/mybatis/unique/WornUniqueCodeMaterialMapper.xml +++ b/src/main/resources/mybatis/unique/WornUniqueCodeMaterialMapper.xml @@ -145,7 +145,6 @@ update worn_unique_code_material - unique_code_id = #{uniqueCodeId}, material_id = #{materialId}, unit_id = #{unitId}, quantity = #{quantity}, @@ -156,7 +155,7 @@ remark = #{remark}, is_delete = #{isDelete}, - where id = #{id} + where unique_code_id = #{uniqueCodeId} @@ -169,5 +168,10 @@ #{id} - + + UPDATE worn_unique_code_material + SET is_delete = '1', + update_time = NOW() + WHERE unique_code_id = #{uniqueCodeId} + \ No newline at end of file diff --git a/src/main/resources/mybatis/worn/WornInboundBillMapper.xml b/src/main/resources/mybatis/worn/WornInboundBillMapper.xml index 43a9706..cb12d6d 100644 --- a/src/main/resources/mybatis/worn/WornInboundBillMapper.xml +++ b/src/main/resources/mybatis/worn/WornInboundBillMapper.xml @@ -20,10 +20,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + - select id, bill_no, bill_type, warehouse_code, warehouse_name, area_code, area_name, remark, inbound_time, status, is_delete, create_by, create_time, update_by, update_time from worn_inbound_bill + select id, bill_no, bill_type, warehouse_code, warehouse_name, area_code, area_name, remark, inbound_time, status, is_delete, create_by, create_time, update_by, update_time,project_id from worn_inbound_bill + + + and bill_no = #{billNo} + and bill_type = #{billType} + and warehouse_code = #{warehouseCode} + and warehouse_name like concat('%', #{warehouseName}, '%') + and area_code = #{areaCode} + and area_name like concat('%', #{areaName}, '%') + and outbound_time = #{outboundTime} + and status = #{status} + and is_delete = #{isDelete} + and project_id = #{projectId} + + + + + + + insert into worn_outbound_bill + + bill_no, + bill_type, + warehouse_code, + warehouse_name, + area_code, + area_name, + remark, + outbound_time, + status, + is_delete, + create_by, + create_time, + update_by, + update_time, + project_id, + + + #{billNo}, + #{billType}, + #{warehouseCode}, + #{warehouseName}, + #{areaCode}, + #{areaName}, + #{remark}, + #{outboundTime}, + #{status}, + #{isDelete}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{projectId}, + + + + + update worn_outbound_bill + + bill_type = #{billType}, + warehouse_code = #{warehouseCode}, + warehouse_name = #{warehouseName}, + area_code = #{areaCode}, + area_name = #{areaName}, + remark = #{remark}, + outbound_time = #{outboundTime}, + status = #{status}, + is_delete = #{isDelete}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + project_id = #{projectId}, + + where bill_no = #{billNo} + + + + delete from worn_outbound_bill where id = #{id} + + + + delete from worn_outbound_bill where id in + + #{id} + + + + \ No newline at end of file diff --git a/src/main/resources/mybatis/worn/WornOutboundItemMapper.xml b/src/main/resources/mybatis/worn/WornOutboundItemMapper.xml new file mode 100644 index 0000000..98ffa36 --- /dev/null +++ b/src/main/resources/mybatis/worn/WornOutboundItemMapper.xml @@ -0,0 +1,175 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select id, bill_id, bill_no, material_id, quantity, unique_code, remark, status, is_delete, create_by, create_time, update_by, update_time from worn_outbound_item + + + + + + + + + insert into worn_outbound_item + + bill_id, + bill_no, + material_id, + quantity, + unique_code, + remark, + status, + is_delete, + create_by, + create_time, + update_by, + update_time, + + + #{billId}, + #{billNo}, + #{materialId}, + #{quantity}, + #{uniqueCode}, + #{remark}, + #{status}, + #{isDelete}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update worn_outbound_item + + bill_id = #{billId}, + bill_no = #{billNo}, + material_id = #{materialId}, + quantity = #{quantity}, + unique_code = #{uniqueCode}, + remark = #{remark}, + status = #{status}, + is_delete = #{isDelete}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where id = #{id} + + + + delete from worn_outbound_item where id = #{id} + + + + delete from worn_outbound_item where id in + + #{id} + + + + \ No newline at end of file diff --git a/src/main/resources/mybatis/worn/WornTechnicalAppraisalFileMapper.xml b/src/main/resources/mybatis/worn/WornTechnicalAppraisalFileMapper.xml new file mode 100644 index 0000000..939a835 --- /dev/null +++ b/src/main/resources/mybatis/worn/WornTechnicalAppraisalFileMapper.xml @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + select id, appraisal_id, file_name, file_url, file_type, sort_num, remark, create_by, create_time, is_delete from worn_technical_appraisal_file + + + + + + + + insert into worn_technical_appraisal_file + + appraisal_id, + file_name, + file_url, + file_type, + sort_num, + remark, + create_by, + create_time, + is_delete, + + + #{appraisalId}, + #{fileName}, + #{fileUrl}, + #{fileType}, + #{sortNum}, + #{remark}, + #{createBy}, + #{createTime}, + #{isDelete}, + + + + + update worn_technical_appraisal_file + + appraisal_id = #{appraisalId}, + file_name = #{fileName}, + file_url = #{fileUrl}, + file_type = #{fileType}, + sort_num = #{sortNum}, + remark = #{remark}, + create_by = #{createBy}, + create_time = #{createTime}, + is_delete = #{isDelete}, + + where id = #{id} + + + + delete from worn_technical_appraisal_file where id = #{id} + + + + delete from worn_technical_appraisal_file where id in + + #{id} + + + + \ No newline at end of file diff --git a/src/main/resources/mybatis/worn/WornTechnicalAppraisalMapper.xml b/src/main/resources/mybatis/worn/WornTechnicalAppraisalMapper.xml new file mode 100644 index 0000000..9554c7b --- /dev/null +++ b/src/main/resources/mybatis/worn/WornTechnicalAppraisalMapper.xml @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + select id, appraisal_no, bill_id, bill_no, project_id, user_id, user_name, appraisal_desc, status, remark, create_by, create_time, update_by, update_time, is_delete from worn_technical_appraisal + + + + + + + + insert into worn_technical_appraisal + + appraisal_no, + bill_id, + bill_no, + project_id, + user_id, + user_name, + appraisal_desc, + status, + remark, + create_by, + create_time, + is_delete, + + + + #{appraisalNo}, + #{billId}, + #{billNo}, + #{projectId}, + #{userId}, + #{userName}, + #{appraisalDesc}, + #{status}, + #{remark}, + #{createBy}, + #{createTime}, + #{isDelete}, + + + + + update worn_technical_appraisal + + appraisal_no = #{appraisalNo}, + bill_id = #{billId}, + bill_no = #{billNo}, + project_id = #{projectId}, + user_id = #{userId}, + user_name = #{userName}, + appraisal_desc = #{appraisalDesc}, + status = #{status}, + remark = #{remark}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + is_delete = #{isDelete}, + + where id = #{id} + + + + delete from worn_technical_appraisal where id = #{id} + + + + delete from worn_technical_appraisal where id in + + #{id} + + + + \ No newline at end of file