diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityOrderController.java index 671b19df..e9d1787d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityOrderController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityOrderController.java @@ -4,10 +4,14 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import com.ruoyi.aftersales.domain.AfterSalesShippingDevice; +import com.ruoyi.aftersales.service.IAfterSalesShippingDeviceService; import com.ruoyi.quality.domain.QualityOrderDetail; import com.ruoyi.quality.domain.QualityOrderReport; +import com.ruoyi.quality.domain.QualityShippingDevice; import com.ruoyi.quality.service.IQualityOrderDetailService; import com.ruoyi.quality.service.IQualityOrderReportService; +import com.ruoyi.quality.service.IQualityShippingDeviceService; import com.ruoyi.warehouse.domain.WarehouseOutOrder; import com.ruoyi.warehouse.domain.WarehouseOutOrderDetail; import org.apache.shiro.authz.annotation.RequiresPermissions; @@ -45,6 +49,9 @@ public class QualityOrderController extends BaseController @Autowired private IQualityOrderReportService orderReportService; + @Autowired + private IQualityShippingDeviceService qualitySDeviceService; + @RequiresPermissions("quality:qualityOrder:view") @GetMapping() public String qualityOrder() @@ -146,7 +153,27 @@ public class QualityOrderController extends BaseController return toAjax(qualityOrderService.updateQualityOrder(qualityOrder)); } + /** + * 跳转选择出货设备 + */ + @GetMapping("/addShippingDevice/{qualityOrderCode}") + public String addShippingDevice(@PathVariable("qualityOrderCode") String qualityOrderCode, ModelMap mmap) + { + mmap.put("qualityOrderCode", qualityOrderCode); + return prefix + "/addShippingDevice"; + } + /** + * 选择出货设备列表 + */ + @PostMapping("/selectShippingDevice") + @ResponseBody + public TableDataInfo selectShippingDevice(QualityShippingDevice qualityShippingDevice) + { + startPage(); + List shippingDevices = qualitySDeviceService.selectQualityShippingDeviceList(qualityShippingDevice); + return getDataTable(shippingDevices); + } /** * 品质单列表详情接口 @@ -360,7 +387,7 @@ public class QualityOrderController extends BaseController /*1111111111*/ /** - * 生产入库品质单开始品质 + * 生产入库品质单(成品)开始品质 */ @GetMapping("/makeStartingQuality/{qualityOrderId}") public String makeStartingQuality(@PathVariable("qualityOrderId") Long qualityOrderId, ModelMap mmap) @@ -371,7 +398,7 @@ public class QualityOrderController extends BaseController } /** - * 修改保存生产入库品质单开始品质 + * 修改保存生产入库品质单(成品开始品质 */ @RequiresPermissions("quality:qualityOrder:makeStartingQuality") @Log(title = "品质管理品质单", businessType = BusinessType.UPDATE) @@ -381,7 +408,16 @@ public class QualityOrderController extends BaseController { return toAjax(qualityOrderService.updateMakeStartingQuality(qualityOrder)); } - + /** + * 生产入库品质单(其他)开始品质 + */ + @GetMapping("/makeOtherStartingQuality/{qualityOrderId}") + public String makeOtherStartingQuality(@PathVariable("qualityOrderId") Long qualityOrderId, ModelMap mmap) + { + QualityOrder qualityOrder = qualityOrderService.selectQualityOrderById(qualityOrderId); + mmap.put("qualityOrder", qualityOrder); + return prefix + "/makeOtherStartingQuality"; + } /** diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityOrderReportController.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityOrderReportController.java new file mode 100644 index 00000000..73777456 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityOrderReportController.java @@ -0,0 +1,278 @@ +package com.ruoyi.quality.controller; + +import java.util.HashMap; +import java.util.List; + +import com.ruoyi.process.general.service.IProcessService; +import com.ruoyi.quality.domain.QualityOrderReportUnqualified; +import com.ruoyi.quality.domain.QualityShippingDevice; +import com.ruoyi.quality.domain.VO.QualityOrderReportVO; +import com.ruoyi.quality.service.IQualityOrderReportUnqualifiedService; +import com.ruoyi.quality.service.IQualityShippingDeviceService; +import com.ruoyi.system.domain.Vo.BaseEmpRequisiteOrderVO; +import com.ruoyi.system.service.ISysRoleService; +import com.ruoyi.warehouse.service.IWarehouseOutOrderService; +import org.activiti.engine.RuntimeService; +import org.activiti.engine.TaskService; +import org.activiti.engine.runtime.ProcessInstance; +import org.activiti.engine.task.Task; +import org.apache.commons.lang3.BooleanUtils; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.*; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.quality.domain.QualityOrderReport; +import com.ruoyi.quality.service.IQualityOrderReportService; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; + +/** + * 品质管理品质报告单Controller + * + * @author 刘晓旭 + * @date 2024-11-19 + */ +@Controller +@RequestMapping("/quality/qualityReport") +public class QualityOrderReportController extends BaseController +{ + private String prefix = "quality/qualityReport"; + + @Autowired + private IQualityOrderReportService qualityOrderReportService; + + @Autowired + private IQualityShippingDeviceService qualityShippingDeviceService; + + @Autowired + private IQualityOrderReportUnqualifiedService unqualifiedService; + + @Autowired + private TaskService taskService; + + @Autowired + private RuntimeService runtimeService; + + @Autowired + private IProcessService processService; + + @Autowired + private ISysRoleService roleService; + + @RequiresPermissions("quality:qualityReport:view") + @GetMapping() + public String qualityReport() + { + return prefix + "/qualityReport"; + } + + + @RequiresPermissions("quality:qualityReport:iqcView") + @GetMapping("/iqcQualityReport") + public String iqcQualityReport() + { + return prefix + "/iqcQualityReport"; + } + + /** + * 查询品质管理品质单报告列表 + */ + @RequiresPermissions("quality:qualityReport:list") + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(QualityOrderReportVO qualityOrderReport) + { + startPage(); + List list = qualityOrderReportService.selectQualityOrderReportList(qualityOrderReport); + return getDataTable(list); + } + + /** + * 导出品质管理品质单报告列表 + */ + @RequiresPermissions("quality:qualityReport:export") + @Log(title = "品质管理品质单报告", businessType = BusinessType.EXPORT) + @PostMapping("/export") + @ResponseBody + public AjaxResult export(QualityOrderReportVO qualityOrderReport) + { + List list = qualityOrderReportService.selectQualityOrderReportList(qualityOrderReport); + ExcelUtil util = new ExcelUtil(QualityOrderReportVO.class); + return util.exportExcel(list, "品质管理品质单报告数据"); + } + + /** + * 新增品质管理品质单报告 + */ + @GetMapping("/add") + public String add() + { + return prefix + "/add"; + } + + /** + * 新增保存品质管理品质报告单 + */ + @Log(title = "品质报告单", businessType = BusinessType.INSERT) + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(@RequestBody QualityOrderReportVO qualityOrderReportVO) + { + qualityOrderReportVO.setAuditStatus("0"); + qualityOrderReportService.submitApply(qualityOrderReportVO); + return AjaxResult.success(); + } + + /** + * 加载审批弹窗 + * @param taskId + * @param mmap + * @return + */ + @GetMapping("/showVerifyDialog/{taskId}") + public String showVerifyDialog(@PathVariable("taskId") String taskId, ModelMap mmap) { + Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); + String processInstanceId = task.getProcessInstanceId(); + ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult(); + QualityOrderReportVO qualityOrderReportVO = qualityOrderReportService.selectQualityOrderReportById(new Long(processInstance.getBusinessKey())); + mmap.put("formData", qualityOrderReportVO); + mmap.put("taskId", taskId); + String verifyName = task.getTaskDefinitionKey().substring(0, 1).toUpperCase() + task.getTaskDefinitionKey().substring(1); + return prefix + "/task" + verifyName; + } + /** + * 自动绑定页面字段 + */ + @ModelAttribute("preloadObj") + public QualityOrderReportVO getObj(@RequestParam(value = "requisiteId", required = false) Long qualityOrderReportId, HttpSession session) { + if (qualityOrderReportId != null) { + + return qualityOrderReportService.selectQualityOrderReportById(qualityOrderReportId); + } + return new QualityOrderReportVO(); + } + /** + * 完成任务 + * + * @return + */ + @RequestMapping(value = "/complete/{taskId}", method = {RequestMethod.POST, RequestMethod.GET}) + @ResponseBody + public AjaxResult complete(@PathVariable("taskId") String taskId, @RequestParam(value = "saveEntity", required = false) String saveEntity, + @ModelAttribute("preloadObj") QualityOrderReportVO qualityOrderReportVO, HttpServletRequest request) { + boolean saveEntityBoolean = BooleanUtils.toBoolean(saveEntity); + //获取实例id + String instanceId = qualityOrderReportVO.getInstanceId(); + //获取实例类型 + String instanceType = qualityOrderReportVO.getInstanceType(); + boolean approvedFlag = processService.complete(taskId, instanceId, qualityOrderReportVO.getApplyTitle(), qualityOrderReportVO.getQualityOrderReportCode(), "qualityOrderReport", new HashMap(), request); + QualityOrderReportVO tempQualityReport = qualityOrderReportService.selectQualityOrderReportById(qualityOrderReportVO.getQualityOrderReportId()); + // 如果任务已结束更新业务表状态 + boolean processIsFinish = processService.judgeProcessIsFinish(instanceId); + if (processIsFinish) { + + if(!approvedFlag){ + // 审核状态-审核拒绝 + tempQualityReport.setAuditStatus("2"); + qualityOrderReportService.updateDisApprovedInfo(tempQualityReport); + }else{ + // 审核状态-审核通过 + tempQualityReport.setAuditStatus("1"); + //生产品质 + if(tempQualityReport.getQualityOrderReportType().equals("0") + ||tempQualityReport.getQualityOrderReportType().equals("1")){ + qualityOrderReportService.updateApprovedInfo(tempQualityReport); + } + } + } + qualityOrderReportService.updateMakeOrderQualityReport(tempQualityReport); + return success("任务已完成"); + } + + /** + * 品质管理品质单报告详情 + */ + @GetMapping("/detail/{qualityOrderReportId}") + public String detail(@PathVariable("qualityOrderReportId") Long qualityOrderReportId, ModelMap mmap) + { + QualityOrderReportVO qualityOrderReport = qualityOrderReportService.selectQualityOrderReportById(qualityOrderReportId); + mmap.put("qualityOrderReport", qualityOrderReport); + return prefix + "/detail"; + } + + @PostMapping("/getReportDevice") + @ResponseBody + public TableDataInfo getReportDevice(QualityShippingDevice qualityShippingDevice) + { + startPage(); + List list = qualityShippingDeviceService.selectQualityShippingDeviceList(qualityShippingDevice); + return getDataTable(list); + } + + @PostMapping("/getReportUnqualified") + @ResponseBody + public TableDataInfo getReportUnqualified(QualityOrderReportUnqualified unqualified) + { + startPage(); + List list = unqualifiedService.selectQualityOrderReportUnqualifiedList(unqualified); + return getDataTable(list); + } + + /** + * 修改保存品质管理品质单报告 + */ + @RequiresPermissions("quality:qualityReport:edit") + @Log(title = "品质管理品质单报告", businessType = BusinessType.UPDATE) + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(QualityOrderReport qualityOrderReport) + { + return toAjax(qualityOrderReportService.updateQualityOrderReport(qualityOrderReport)); + } + + /** + * 删除品质管理品质单报告 + */ + @RequiresPermissions("quality:qualityReport:remove") + @Log(title = "品质管理品质单报告", businessType = BusinessType.DELETE) + @PostMapping( "/remove") + @ResponseBody + public AjaxResult remove(String ids) + { + return toAjax(qualityOrderReportService.deleteQualityOrderReportByIds(ids)); + } + + /** + * 作废品质管理品质单报告 + */ + @RequiresPermissions("quality:qualityReport:cancel") + @Log(title = "品质管理品质单报告", businessType = BusinessType.CANCEL) + @GetMapping( "/cancel/{id}") + @ResponseBody + public AjaxResult cancel(@PathVariable("id") Long id){ + return toAjax(qualityOrderReportService.cancelQualityOrderReportById(id)); + } + + /** + * 恢复品质管理品质单报告 + */ + @RequiresPermissions("quality:qualityReport:restore") + @Log(title = "品质管理品质单报告", businessType = BusinessType.RESTORE) + @GetMapping( "/restore/{id}") + @ResponseBody + public AjaxResult restore(@PathVariable("id")Long id) + { + return toAjax(qualityOrderReportService.restoreQualityOrderReportById(id)); + } + + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderReportUnqualified.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderReportUnqualified.java index 6cbb0a3c..bb429d18 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderReportUnqualified.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderReportUnqualified.java @@ -21,6 +21,12 @@ public class QualityOrderReportUnqualified extends BaseEntity /** 品质单报告Id */ private Long qualityOrderReportId; + /** 品质单报告单号 */ + private String qualityOrderReportCode; + + /** 品质报告关联出货设备ID */ + private String shippingDeviceId; + /** 供应商Id */ @Excel(name = "供应商Id") private String supplierCode; @@ -144,6 +150,22 @@ public class QualityOrderReportUnqualified extends BaseEntity return unqualifiedReportUrl; } + public String getQualityOrderReportCode() { + return qualityOrderReportCode; + } + + public void setQualityOrderReportCode(String qualityOrderReportCode) { + this.qualityOrderReportCode = qualityOrderReportCode; + } + + public String getShippingDeviceId() { + return shippingDeviceId; + } + + public void setShippingDeviceId(String shippingDeviceId) { + this.shippingDeviceId = shippingDeviceId; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityReportDevice.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityReportDevice.java new file mode 100644 index 00000000..74a03101 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityReportDevice.java @@ -0,0 +1,65 @@ +package com.ruoyi.quality.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 品质报告单关联出货设备对象 quality_report_device + * + * @author ruoyi + * @date 2024-11-19 + */ +public class QualityReportDevice extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** id */ + private Long id; + + /** 出货设备id */ + @Excel(name = "出货设备id") + private String shippingDeviceId; + + /** 关联品质报告单号 */ + @Excel(name = "关联品质报告单号") + private String qualityOrderReportCode; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setShippingDeviceId(String shippingDeviceId) + { + this.shippingDeviceId = shippingDeviceId; + } + + public String getShippingDeviceId() + { + return shippingDeviceId; + } + public void setQualityOrderReportCode(String qualityOrderReportCode) + { + this.qualityOrderReportCode = qualityOrderReportCode; + } + + public String getQualityOrderReportCode() + { + return qualityOrderReportCode; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("shippingDeviceId", getShippingDeviceId()) + .append("qualityOrderReportCode", getQualityOrderReportCode()) + .toString(); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityOrderReportMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityOrderReportMapper.java index 7977d3b8..2adc449a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityOrderReportMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityOrderReportMapper.java @@ -2,6 +2,7 @@ package com.ruoyi.quality.mapper; import java.util.List; import com.ruoyi.quality.domain.QualityOrderReport; +import com.ruoyi.quality.domain.VO.QualityOrderReportVO; /** * 品质管理品质单报告Mapper接口 @@ -17,41 +18,41 @@ public interface QualityOrderReportMapper * @param qualityOrderReportId 品质管理品质单报告ID * @return 品质管理品质单报告 */ - public QualityOrderReport selectQualityOrderReportById(Long qualityOrderReportId); + public QualityOrderReportVO selectQualityOrderReportById(Long qualityOrderReportId); /** * 查询品质管理品质单报告列表 * - * @param qualityOrderReport 品质管理品质单报告 + * @param qualityOrderReportVO 品质管理品质单报告 * @return 品质管理品质单报告集合 */ - public List selectQualityOrderReportList(QualityOrderReport qualityOrderReport); + public List selectQualityOrderReportList(QualityOrderReportVO qualityOrderReportVO); /** * 新增品质管理品质单报告 * - * @param qualityOrderReport 品质管理品质单报告 + * @param qualityOrderReportVO 品质管理品质单报告 * @return 结果 */ - public int insertQualityOrderReport(QualityOrderReport qualityOrderReport); + public int insertQualityOrderReport(QualityOrderReportVO qualityOrderReportVO); /** * 通过品质单报告物料号和供应商编号修改品质管理品质单报告 * - * @param qualityOrderReport 品质管理品质单报告 + * @param qualityOrderReportVO 品质管理品质单报告 * @return 结果 */ - public int updateQualityOrderReport(QualityOrderReport qualityOrderReport); + public int updateQualityOrderReport(QualityOrderReportVO qualityOrderReportVO); /** * 通过品质单报告Id修改品质管理品质单报告 * - * @param qualityOrderReport 品质管理品质单报告 + * @param qualityOrderReportVO 品质管理品质单报告 * @return 结果 */ - public int updateQualityOrderReportById(QualityOrderReport qualityOrderReport); + public int updateQualityOrderReportById(QualityOrderReportVO qualityOrderReportVO); /** @@ -87,11 +88,11 @@ public interface QualityOrderReportMapper public int restoreQualityOrderReportById(Long qualityOrderReportId); /*根据供应商ID和物料号以及品质单号查询品质报告*/ - QualityOrderReport selectQualityOrderReportByNoAndCode(QualityOrderReport qualityOrderReport); + QualityOrderReportVO selectQualityOrderReportByNoAndCode(QualityOrderReportVO qualityOrderReportVO); /* * 查询委内加工入库单品质报告 * */ - QualityOrderReport selectMakeInOrderReportByNoAndCode(QualityOrderReport tempQualityOrderReport); + QualityOrderReportVO selectMakeInOrderReportByNoAndCode(QualityOrderReportVO qualityOrderReportVO); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityReportDeviceMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityReportDeviceMapper.java new file mode 100644 index 00000000..be460bb9 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityReportDeviceMapper.java @@ -0,0 +1,77 @@ +package com.ruoyi.quality.mapper; + +import java.util.List; +import com.ruoyi.quality.domain.QualityReportDevice; + +/** + * 品质报告单关联出货设备Mapper接口 + * + * @author ruoyi + * @date 2024-11-19 + */ +public interface QualityReportDeviceMapper +{ + /** + * 查询品质报告单关联出货设备 + * + * @param id 品质报告单关联出货设备ID + * @return 品质报告单关联出货设备 + */ + public QualityReportDevice selectQualityReportDeviceById(Long id); + + /** + * 查询品质报告单关联出货设备列表 + * + * @param qualityReportDevice 品质报告单关联出货设备 + * @return 品质报告单关联出货设备集合 + */ + public List selectQualityReportDeviceList(QualityReportDevice qualityReportDevice); + + /** + * 新增品质报告单关联出货设备 + * + * @param qualityReportDevice 品质报告单关联出货设备 + * @return 结果 + */ + public int insertQualityReportDevice(QualityReportDevice qualityReportDevice); + + /** + * 修改品质报告单关联出货设备 + * + * @param qualityReportDevice 品质报告单关联出货设备 + * @return 结果 + */ + public int updateQualityReportDevice(QualityReportDevice qualityReportDevice); + + /** + * 删除品质报告单关联出货设备 + * + * @param id 品质报告单关联出货设备ID + * @return 结果 + */ + public int deleteQualityReportDeviceById(Long id); + + /** + * 批量删除品质报告单关联出货设备 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteQualityReportDeviceByIds(String[] ids); + + /** + * 作废品质报告单关联出货设备 + * + * @param id 品质报告单关联出货设备ID + * @return 结果 + */ + public int cancelQualityReportDeviceById(Long id); + + /** + * 恢复品质报告单关联出货设备 + * + * @param id 品质报告单关联出货设备ID + * @return 结果 + */ + public int restoreQualityReportDeviceById(Long id); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityOrderReportService.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityOrderReportService.java index 0dd64487..3ac6fb1a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityOrderReportService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityOrderReportService.java @@ -2,6 +2,10 @@ package com.ruoyi.quality.service; import java.util.List; import com.ruoyi.quality.domain.QualityOrderReport; +import com.ruoyi.quality.domain.VO.QualityOrderReportVO; +import com.ruoyi.system.domain.Vo.BaseEmpRequisiteOrderVO; +import org.activiti.engine.runtime.ProcessInstance; +import org.springframework.transaction.annotation.Transactional; /** * 品质管理品质单报告Service接口 @@ -17,23 +21,23 @@ public interface IQualityOrderReportService * @param qualityOrderReportId 品质管理品质单报告ID * @return 品质管理品质单报告 */ - public QualityOrderReport selectQualityOrderReportById(Long qualityOrderReportId); + public QualityOrderReportVO selectQualityOrderReportById(Long qualityOrderReportId); /** * 查询品质管理品质单报告列表 * - * @param qualityOrderReport 品质管理品质单报告 + * @param qualityOrderReportVO 品质管理品质单报告 * @return 品质管理品质单报告集合 */ - public List selectQualityOrderReportList(QualityOrderReport qualityOrderReport); + public List selectQualityOrderReportList(QualityOrderReportVO qualityOrderReportVO); /** * 新增品质管理品质单报告 * - * @param qualityOrderReport 品质管理品质单报告 + * @param qualityOrderReportVO 品质管理品质单报告 * @return 结果 */ - public int insertQualityOrderReport(QualityOrderReport qualityOrderReport); + public int insertMakeQualityOrderReport(QualityOrderReportVO qualityOrderReportVO); /** * 修改品质管理品质单报告 @@ -85,4 +89,21 @@ public interface IQualityOrderReportService * 修改保存委内加工入库单品质报告按钮 */ int updateMakeInOrderReport(QualityOrderReport qualityOrderReport); + + int updateMakeOrderQualityReport(QualityOrderReportVO qualityOrderReportVO); + + /** + * 审批流程启动 + * */ + ProcessInstance submitApply(QualityOrderReportVO qualityOrderReportVO); + + /* + * 审核通过后更新数据(生产入库,成品品质) + * 更新品质单表、品质单详情表、品质单关联设备表、售后设备表、生产订单、生产订单bom已完成数*/ + void updateApprovedInfo(QualityOrderReportVO qualityOrderReportVO); + + /* + * 审核拒绝后更新数据(生产入库,成品品质) + * 更新品质单表、品质单详情表、品质单关联设备表、售后设备表*/ + void updateDisApprovedInfo(QualityOrderReportVO qualityOrderReportVO); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderReportServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderReportServiceImpl.java index ffae4fbb..6ec19bb7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderReportServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderReportServiceImpl.java @@ -1,27 +1,42 @@ package com.ruoyi.quality.service.impl; -import java.text.DecimalFormat; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.List; - +import java.util.*; + +import com.github.pagehelper.Page; +import com.ruoyi.aftersales.domain.AfterSalesShippingDevice; +import com.ruoyi.aftersales.mapper.AfterSalesShippingDeviceMapper; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.page.PageDomain; +import com.ruoyi.common.core.page.TableSupport; import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.exception.BusinessException; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.process.general.service.IProcessService; +import com.ruoyi.process.todoitem.mapper.BizTodoItemMapper; import com.ruoyi.quality.domain.*; -import com.ruoyi.quality.mapper.QualityOrderDetailMapper; -import com.ruoyi.quality.mapper.QualityOrderReportUnqualifiedMapper; -import com.ruoyi.quality.mapper.QualityRefundsExchangesOrderMapper; -import org.apache.avalon.framework.service.ServiceException; +import com.ruoyi.quality.domain.VO.QualityOrderReportVO; +import com.ruoyi.quality.mapper.*; +import com.ruoyi.system.domain.SysMakeOrder; +import com.ruoyi.system.domain.SysMakeorderBom; +import com.ruoyi.system.mapper.SysMakeOrderMapper; +import com.ruoyi.system.mapper.SysMakeorderBomMapper; +import com.ruoyi.system.mapper.SysUserMapper; +import com.ruoyi.system.service.ISysRoleService; +import com.ruoyi.warehouse.domain.WarehouseStorageOrder; +import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail; +import com.ruoyi.warehouse.mapper.WarehouseStorageOrderDetailMapper; +import com.ruoyi.warehouse.mapper.WarehouseStorageOrderMapper; +import org.activiti.engine.TaskService; +import org.activiti.engine.impl.persistence.entity.TaskEntityImpl; +import org.activiti.engine.runtime.ProcessInstance; +import org.activiti.engine.task.Task; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.ruoyi.quality.mapper.QualityOrderReportMapper; import com.ruoyi.quality.service.IQualityOrderReportService; import com.ruoyi.common.core.text.Convert; import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.CollectionUtils; /** * 品质管理品质单报告Service业务层处理 @@ -30,8 +45,7 @@ import org.springframework.util.CollectionUtils; * @date 2024-05-20 */ @Service -public class QualityOrderReportServiceImpl implements IQualityOrderReportService -{ +public class QualityOrderReportServiceImpl implements IQualityOrderReportService { @Autowired private QualityOrderReportMapper qualityOrderReportMapper; @@ -44,170 +58,231 @@ public class QualityOrderReportServiceImpl implements IQualityOrderReportService @Autowired private QualityRefundsExchangesOrderMapper refundsExchangesOrderMapper; + @Autowired + private QualityShippingDeviceMapper shippingDeviceMapper; + + @Autowired + private AfterSalesShippingDeviceMapper afterSalesDeviceMapper; + + @Autowired + private QualityReportDeviceMapper qualityReportDeviceMapper; + + @Autowired + private QualityOrderMapper qualityOrderMapper; + + @Autowired + private ISysRoleService roleService; + + @Autowired + private TaskService taskService; + + @Autowired + private BizTodoItemMapper todoItemMapper; + + @Autowired + private IProcessService processService; + + @Autowired + private SysMakeOrderMapper makeOrderMapper; + + @Autowired + private SysMakeorderBomMapper makeorderBomMapper; + + @Autowired + private SysUserMapper userMapper; + + @Autowired + private WarehouseStorageOrderMapper storageOrderMapper; + + @Autowired + private WarehouseStorageOrderDetailMapper storageDetailMapper; + @Autowired private RedisCache redisCache; /** * 查询品质管理品质单报告 - * + * * @param qualityOrderReportId 品质管理品质单报告ID * @return 品质管理品质单报告 */ @Override - public QualityOrderReport selectQualityOrderReportById(Long qualityOrderReportId) - { - return qualityOrderReportMapper.selectQualityOrderReportById(qualityOrderReportId); + public QualityOrderReportVO selectQualityOrderReportById(Long qualityOrderReportId) { + QualityOrderReportVO qualityOrderReport = qualityOrderReportMapper.selectQualityOrderReportById(qualityOrderReportId); + QualityReportDevice tempDevice = new QualityReportDevice(); + tempDevice.setQualityOrderReportCode(qualityOrderReport.getQualityOrderReportCode()); + List reportDevices = qualityReportDeviceMapper.selectQualityReportDeviceList(tempDevice); + List deviceIds = new ArrayList<>(); + if (StringUtils.isNotEmpty(reportDevices)) { + for (QualityReportDevice device : reportDevices) { + deviceIds.add(device.getShippingDeviceId()); + } + } + qualityOrderReport.setQualityReportDeviceIds(deviceIds); + return qualityOrderReport; } /** * 查询品质管理品质单报告列表 - * - * @param qualityOrderReport 品质管理品质单报告 + * + * @param qualityOrderReportVO 品质管理品质单报告 * @return 品质管理品质单报告 */ @Override - public List selectQualityOrderReportList(QualityOrderReport qualityOrderReport) - { - return qualityOrderReportMapper.selectQualityOrderReportList(qualityOrderReport); + public List selectQualityOrderReportList(QualityOrderReportVO qualityOrderReportVO) { + PageDomain pageDomain = TableSupport.buildPageRequest(); + Integer pageNum = pageDomain.getPageNum(); + Integer pageSize = pageDomain.getPageSize(); + + // PageHelper 仅对第一个 List 分页 + Page list = (Page) qualityOrderReportMapper.selectQualityOrderReportList(qualityOrderReportVO); + Page returnList = new Page<>(); + for (QualityOrderReportVO orderReportVO : list) { + SysUser sysUser = userMapper.selectUserByLoginName(orderReportVO.getCreateBy()); + if (sysUser != null) { + orderReportVO.setCreateUserName(sysUser.getUserName()); + } + SysUser sysUser2 = userMapper.selectUserByLoginName(orderReportVO.getApplyUser()); + if (sysUser2 != null) { + orderReportVO.setApplyUserName(sysUser2.getUserName()); + } + String instanceId = orderReportVO.getInstanceId(); + // 当前环节 + if (StringUtils.isNotBlank(instanceId)) { + List taskList = taskService.createTaskQuery() + .processInstanceId(instanceId) +// .singleResult(); + .list(); // 例如请假会签,会同时拥有多个任务 + if (!org.springframework.util.CollectionUtils.isEmpty(taskList)) { + TaskEntityImpl task = (TaskEntityImpl) taskList.get(0); + String taskId = task.getId(); + orderReportVO.setTaskId(taskId); + // 设置待办用户 + List todoUserList = todoItemMapper.selectUndealTodoUserList(taskId); + if (!org.springframework.util.CollectionUtils.isEmpty(taskList)) { + orderReportVO.setTodoUserId(String.join(",", todoUserList)); + } + if (task.getSuspensionState() == 2) { + orderReportVO.setTaskName("已挂起"); + orderReportVO.setSuspendState("2"); + } else { + orderReportVO.setTaskName(task.getName()); + orderReportVO.setSuspendState("1"); + } + } else { + // 已办结或者已撤销 + orderReportVO.setTaskName("已结束"); + } + } else { + orderReportVO.setTaskName("未启动"); + } + orderReportVO.setTaskStatus(orderReportVO.getTaskName()); + if (orderReportVO.getAuditStatus() == null) { + orderReportVO.setTaskStatus("未启动"); + } else if (orderReportVO.getAuditStatus().equals("1")) { + orderReportVO.setTaskStatus("审核通过"); + } else if (orderReportVO.getAuditStatus().equals("2")) { + orderReportVO.setTaskStatus("审核拒绝"); + } + returnList.add(orderReportVO); + } + returnList.setTotal(org.springframework.util.CollectionUtils.isEmpty(list) ? 0 : list.getTotal()); + returnList.setPageNum(pageNum); + returnList.setPageSize(pageSize); + return returnList; } /** - * 新增品质管理品质单报告 - * - * @param qualityOrderReport 品质管理品质单报告 + * 新增生产成品品质单报告 + * + * @param qualityOrderReportVO 品质管理品质单报告 * @return 结果 */ @Override - public int insertQualityOrderReport(QualityOrderReport qualityOrderReport) - { + @Transactional(rollbackFor = Exception.class) + public int insertMakeQualityOrderReport(QualityOrderReportVO qualityOrderReportVO) { String loginName = ShiroUtils.getLoginName(); - qualityOrderReport.setCreateBy(loginName); - qualityOrderReport.setCreateTime(DateUtils.getNowDate()); - return qualityOrderReportMapper.insertQualityOrderReport(qualityOrderReport); + String qualityOrderCode = qualityOrderReportVO.getQualityOrderCode(); + String qualityReportCode = redisCache.generateBillNo("PZBG"); + QualityOrderDetail qualityOrderDetail = orderDetailMapper.selectQualityOrderDetailByCode(qualityOrderCode); + qualityOrderReportVO.setQualityOrderType(qualityOrderDetail.getQualityOrderType()); + qualityOrderReportVO.setQualityStorageStatus(qualityOrderDetail.getQualityStorageStatus()); + //更新品质单详情待审核数 + int qualifiedNum = qualityOrderReportVO.getOkAcceptedNum() + qualityOrderReportVO.getSpecialConcessionsNum(); + int pendingReviewNum = qualifiedNum + qualityOrderReportVO.getProcessBadNum(); + int detailPendingNum = qualityOrderDetail.getPendingReviewNum(); + detailPendingNum = detailPendingNum + pendingReviewNum; + qualityOrderDetail.setPendingReviewNum(detailPendingNum); + orderDetailMapper.updateQualityOrderDetail(qualityOrderDetail); + //更新品质单待审核数、品检员 + QualityOrder qualityOrder = qualityOrderMapper.selectQualityOrderByCode(qualityOrderCode); + int orderPendingNum = qualityOrder.getPendingReviewNum(); + orderPendingNum = orderPendingNum + pendingReviewNum; + qualityOrder.setPendingReviewNum(orderPendingNum); + qualityOrder.setQualityEmployee(loginName); + qualityOrder.setUpdateBy(loginName); + qualityOrder.setUpdateTime(DateUtils.getNowDate()); + qualityOrderMapper.updateQualityOrder(qualityOrder); + + //新增不良分类列表 + List unqualifiedList = qualityOrderReportVO.getUnqualifiedDataList(); + if (StringUtils.isNotEmpty(unqualifiedList)) { + for (QualityOrderReportUnqualified unqualified : unqualifiedList) { + unqualified.setQualityOrderReportCode(qualityReportCode); + unqualified.setCreateBy(ShiroUtils.getLoginName()); + unqualified.setCreateTime(DateUtils.getNowDate()); + int result = unqualifiedMapper.insertQualityOrderReportUnqualified(unqualified); + if (result <= 0) { + throw new BusinessException("新增不良分类失败!"); + } + } + } + + if(qualityOrderReportVO.getQualityOrderReportType().equals("0")){ + //品质报告单关联出货设备ID集合 + List uniqueDeviceIds = qualityOrderReportVO.getQualityReportDeviceIds(); + + for (String deviceId : uniqueDeviceIds) { + //保存品质报告单关联设备表 + QualityReportDevice qualityReportDevice = new QualityReportDevice(); + qualityReportDevice.setQualityOrderReportCode(qualityReportCode); + qualityReportDevice.setShippingDeviceId(deviceId); + qualityReportDeviceMapper.insertQualityReportDevice(qualityReportDevice); + //更新品质单关联设备表提交/审核状态 + QualityShippingDevice shippingDevice = shippingDeviceMapper.selectQualityShippingDeviceByDeviceId(deviceId); + if (shippingDevice == null) { + throw new BusinessException(deviceId + "设备不存在于该品质单中"); + } + shippingDevice.setQualityAuditStatus("3");//已提交 + shippingDeviceMapper.updateQualityShippingDevice(shippingDevice); + + //更新售后设备品质状态为待品质 + AfterSalesShippingDevice afterSalesDevice = afterSalesDeviceMapper.selectAfterSalesShippingDeviceByShippingDeviceId(deviceId); + afterSalesDevice.setQualityStatus("1");//待品质 + afterSalesDevice.setUpdateBy(ShiroUtils.getLoginName()); + afterSalesDevice.setUpdateTime(DateUtils.getNowDate()); + afterSalesDeviceMapper.updateAfterSalesShippingDevice(afterSalesDevice); + } + } + + qualityOrderReportVO.setQualityHasqualifiedNum(qualifiedNum); + qualityOrderReportVO.setCheckNum(pendingReviewNum); + qualityOrderReportVO.setQualityOrderReportCode(qualityReportCode); + qualityOrderReportVO.setCreateBy(loginName); + qualityOrderReportVO.setCreateTime(DateUtils.getNowDate()); + return qualityOrderReportMapper.insertQualityOrderReport(qualityOrderReportVO); } /** * 修改品质管理品质单报告 - * + * * @param qualityOrderReport 品质管理品质单报告 * @return 结果 */ @Transactional(rollbackFor = Exception.class) @Override - public int updateQualityOrderReport(QualityOrderReport qualityOrderReport) - { - String loginName = ShiroUtils.getLoginName(); - - QualityOrderReportUnqualified tempOrderReportUnqualified = new QualityOrderReportUnqualified(); - String materialNo = qualityOrderReport.getMaterialNo(); - String supplierCode = qualityOrderReport.getSupplierCode(); - String qualityOrderCode = qualityOrderReport.getQualityOrderCode(); - tempOrderReportUnqualified.setMaterialNo(materialNo); - tempOrderReportUnqualified.setSupplierCode(supplierCode); - - QualityOrderDetail tempQualityOrderDetail = new QualityOrderDetail(); - tempQualityOrderDetail.setMaterialNo(materialNo); - tempQualityOrderDetail.setSupplierCode(supplierCode); - tempQualityOrderDetail.setQualityOrderCode(qualityOrderCode); - - //从数据库查询品质报告详情数据 - QualityOrderDetail qualityOrderDetail = orderDetailMapper.selectQualityOrderDetailByCodeAndNo(tempQualityOrderDetail); - //计算品质单详情中的品质合格数量 - Integer okAcceptedNum = qualityOrderReport.getOkAcceptedNum(); - Integer specialConcessionsNum = qualityOrderReport.getSpecialConcessionsNum(); - //品质合格数 - Integer qualityQualifiedNum = okAcceptedNum + specialConcessionsNum; - //后续要处理这个本次到货数 - //本次到货数 -// Integer thisArrivedNum = qualityOrderDetail.getThisArrivedNum(); -// if (thisArrivedNum != null){ -// if (qualityQualifiedNum>thisArrivedNum){ -// throw new BusinessException("OK允收数和特采/让步数总和小于等于本次到货数"); -// } -// } - //更新品质报告详情中的品质合格数的数据 - qualityOrderDetail.setQualityQualifiedNum(qualityQualifiedNum); - //更新品质已合格数 - qualityOrderDetail.setQualityHasqualifiedNum(qualityQualifiedNum); - //获得品质报告中的不合格数模块数据 - List unqualifiedDataList = qualityOrderReport.getUnqualifiedDataList(); - - /*如果进行品质的订单类型是采购或者委外*/ -// if (qualityOrderDetail.getQualityOrderType().equals("0") || qualityOrderDetail.getQualityOrderType().equals("2")){ -// /*有品质不合格,需要在退换货入库前退货进行记录*/ -// -// String refundsExchangesCode = redisCache.generateBillNo("ZCGX"); -// QualityRefundsExchanges qualityRefundsExchanges = new QualityRefundsExchanges(); -// qualityRefundsExchanges.setRefundsExchangesCode(refundsExchangesCode); -// qualityRefundsExchanges.setRefundsExchangesStatus("0"); -// -// for (QualityOrderReportUnqualified tempQualityOrderReportUnqualified : unqualifiedDataList) { -// QualityRefundsExchangesOrder qualityRefundsExchangesOrder = new QualityRefundsExchangesOrder(); -// qualityRefundsExchangesOrder.setRefundsExchangesCode(refundsExchangesCode); -// qualityRefundsExchangesOrder.setOkReportUrl(qualityOrderReport.getOkReportUrl()); -// qualityRefundsExchangesOrder.setOkAcceptedNum(qualityOrderReport.getOkAcceptedNum()); -// qualityRefundsExchangesOrder.setSpecialReportUrl(qualityOrderReport.getSpecialReportUrl()); -// qualityRefundsExchangesOrder.setSpecialConcessionsNum(qualityOrderReport.getSpecialConcessionsNum()); -// qualityRefundsExchangesOrder.setMaterialNo(materialNo); -// qualityRefundsExchangesOrder.setMaterialName(qualityOrderReport.getMaterialName()); -// qualityRefundsExchangesOrder.setMakeTotal(qualityOrderReport.getMakeTotal()); -// qualityRefundsExchangesOrder.setQualityHasqualifiedNum(qualityOrderReport.getQualityHasqualifiedNum()); -// qualityRefundsExchangesOrder.setProcessBadNum(tempQualityOrderReportUnqualified.getProcessBadNum()); -// qualityRefundsExchangesOrder.setProcessBadClassification(tempQualityOrderReportUnqualified.getProcessBadClassification()); -// qualityRefundsExchangesOrder.setProcessBadGrade(tempQualityOrderReportUnqualified.getProcessBadGrade()); -// qualityRefundsExchangesOrder.setUpdateBy(loginName); -// qualityRefundsExchangesOrder.setUpdateTime(new Date()); -// refundsExchangesOrderMapper.insertQualityRefundsExchangesOrder(qualityRefundsExchangesOrder); -// } -// } - - //计算不良数量的合计值 - - int processBadNumTotal = 0; - if (!CollectionUtils.isEmpty(unqualifiedDataList)){ - processBadNumTotal = unqualifiedDataList.stream().mapToInt(QualityOrderReportUnqualified::getProcessBadNum).sum(); - } - - //后续处理本次到货数 -// if (processBadNumTotal>thisArrivedNum){ -// throw new BusinessException("不良数量的总和小于等于本次到货数"); -// } - - //更新品质报告详情品质不合格数 - qualityOrderDetail.setQualityUnqualifiedNum(processBadNumTotal); - qualityOrderDetail.setUpdateBy(loginName); - qualityOrderDetail.setUpdateTime(new Date()); - //更新品质报告详情数据表 - int updateQualityOrderDetailResult = orderDetailMapper.updateQualityOrderDetail(qualityOrderDetail); - - if (updateQualityOrderDetailResult <= 0){ - throw new BusinessException("更新品质单详情数据失败"); - } - - - List qualityOrderReportUnqualifieds = unqualifiedMapper.selectQualityOrderReportUnqualifiedByCodeAndNo(tempOrderReportUnqualified); - if (StringUtils.isEmpty(qualityOrderReportUnqualifieds)){ - //如果后端不合格数列表值为空,就新增一个 - for (QualityOrderReportUnqualified tempQualityOrderReportUnqualified : unqualifiedDataList) { - QualityOrderReportUnqualified qualityOrderReportUnqualified = getQualityOrderReportUnqualified(materialNo, supplierCode, tempQualityOrderReportUnqualified); - qualityOrderReportUnqualified.setCreateBy(loginName); - qualityOrderReportUnqualified.setCreateTime(new Date()); - unqualifiedMapper.insertQualityOrderReportUnqualified(qualityOrderReportUnqualified); - } - }else { - //如果后端不合格数列表值为不空,就更新 - for (QualityOrderReportUnqualified tempQualityOrderReportUnqualified : unqualifiedDataList) { - QualityOrderReportUnqualified qualityOrderReportUnqualified = getQualityOrderReportUnqualified(materialNo, supplierCode, tempQualityOrderReportUnqualified); - qualityOrderReportUnqualified.setUpdateBy(loginName); - qualityOrderReportUnqualified.setUpdateTime(new Date()); - unqualifiedMapper.updateQualityOrderReportUnqualified(qualityOrderReportUnqualified); - } - - } - - qualityOrderReport.setUpdateBy(loginName); - qualityOrderReport.setUpdateTime(new Date()); - return qualityOrderReportMapper.updateQualityOrderReport(qualityOrderReport); + public int updateQualityOrderReport(QualityOrderReport qualityOrderReport) { + return 0; } //更新品质报告不合格数量模块的数据 @@ -223,25 +298,23 @@ public class QualityOrderReportServiceImpl implements IQualityOrderReportService /** * 删除品质管理品质单报告对象 - * + * * @param ids 需要删除的数据ID * @return 结果 */ @Override - public int deleteQualityOrderReportByIds(String ids) - { + public int deleteQualityOrderReportByIds(String ids) { return qualityOrderReportMapper.deleteQualityOrderReportByIds(Convert.toStrArray(ids)); } /** * 删除品质管理品质单报告信息 - * + * * @param qualityOrderReportId 品质管理品质单报告ID * @return 结果 */ @Override - public int deleteQualityOrderReportById(Long qualityOrderReportId) - { + public int deleteQualityOrderReportById(Long qualityOrderReportId) { return qualityOrderReportMapper.deleteQualityOrderReportById(qualityOrderReportId); } @@ -252,8 +325,7 @@ public class QualityOrderReportServiceImpl implements IQualityOrderReportService * @return 结果 */ @Override - public int cancelQualityOrderReportById(Long qualityOrderReportId) - { + public int cancelQualityOrderReportById(Long qualityOrderReportId) { return qualityOrderReportMapper.cancelQualityOrderReportById(qualityOrderReportId); } @@ -264,21 +336,20 @@ public class QualityOrderReportServiceImpl implements IQualityOrderReportService * @return 结果 */ @Override - public int restoreQualityOrderReportById(Long qualityOrderReportId) - { + public int restoreQualityOrderReportById(Long qualityOrderReportId) { return qualityOrderReportMapper.restoreQualityOrderReportById(qualityOrderReportId); } /*根据供应商ID和物料号以及品质单号查询品质报告*/ @Override - public QualityOrderReport selectQualityOrderReportByNoAndCode(String materialNo, String supplierCode,String qualityOrderCode) { + public QualityOrderReportVO selectQualityOrderReportByNoAndCode(String materialNo, String supplierCode, String qualityOrderCode) { - QualityOrderReport tempQualityOrderReport = new QualityOrderReport(); + QualityOrderReportVO tempQualityOrderReport = new QualityOrderReportVO(); tempQualityOrderReport.setMaterialNo(materialNo); tempQualityOrderReport.setSupplierCode(supplierCode); tempQualityOrderReport.setQualityOrderCode(qualityOrderCode); - QualityOrderReport qualityOrderReport = qualityOrderReportMapper.selectQualityOrderReportByNoAndCode(tempQualityOrderReport); - return qualityOrderReport; + QualityOrderReportVO qualityOrderReportVO = qualityOrderReportMapper.selectQualityOrderReportByNoAndCode(tempQualityOrderReport); + return qualityOrderReportVO; } /* @@ -286,10 +357,7 @@ public class QualityOrderReportServiceImpl implements IQualityOrderReportService * */ @Override public QualityOrderReport selectMakeInOrderReportByNoAndCode(String materialNo, String qualityOrderCode) { - QualityOrderReport tempQualityOrderReport = new QualityOrderReport(); - tempQualityOrderReport.setMaterialNo(materialNo); - tempQualityOrderReport.setQualityOrderCode(qualityOrderCode); - QualityOrderReport qualityOrderReport = qualityOrderReportMapper.selectMakeInOrderReportByNoAndCode(tempQualityOrderReport); + QualityOrderReport qualityOrderReport = new QualityOrderReport(); return qualityOrderReport; } @@ -300,101 +368,318 @@ public class QualityOrderReportServiceImpl implements IQualityOrderReportService @Transactional(rollbackFor = Exception.class) @Override public int updateMakeInOrderReport(QualityOrderReport qualityOrderReport) { + return 0; + } - String loginName = ShiroUtils.getLoginName(); - + /** + * 修改保存品质报告按钮 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public int updateMakeOrderQualityReport(QualityOrderReportVO qualityOrderReportVO) { + qualityOrderReportVO.setUpdateBy(ShiroUtils.getLoginName()); + qualityOrderReportVO.setUpdateTime(DateUtils.getNowDate()); + return qualityOrderReportMapper.updateQualityOrderReportById(qualityOrderReportVO); + } - String materialNo = qualityOrderReport.getMaterialNo(); - String qualityOrderCode = qualityOrderReport.getQualityOrderCode(); - - QualityOrderDetail tempQualityOrderDetail = new QualityOrderDetail(); - tempQualityOrderDetail.setMaterialNo(materialNo); - tempQualityOrderDetail.setQualityOrderCode(qualityOrderCode); - - //从数据库查询品质报告详情数据 - QualityOrderDetail qualityOrderDetail = orderDetailMapper.selectMakeInOrderDetailByCodeAndNo(tempQualityOrderDetail); - //计算品质单详情中的品质合格数量 - Integer okAcceptedNum = qualityOrderReport.getOkAcceptedNum(); - Integer specialConcessionsNum = qualityOrderReport.getSpecialConcessionsNum(); - //品质合格数 - Integer qualityQualifiedNum = okAcceptedNum + specialConcessionsNum; - //后续要处理这个本次到货数 - //本次到货数 -// Integer thisArrivedNum = qualityOrderDetail.getThisArrivedNum(); -// if (thisArrivedNum != null){ -// if (qualityQualifiedNum>thisArrivedNum){ -// throw new BusinessException("OK允收数和特采/让步数总和小于等于本次到货数"); -// } -// } - //更新品质报告详情中的品质合格数的数据 - qualityOrderDetail.setQualityQualifiedNum(qualityQualifiedNum); - //更新品质已合格数 - qualityOrderDetail.setQualityHasqualifiedNum(qualityQualifiedNum); - //获得品质报告中的不合格数模块数据 - List unqualifiedDataList = qualityOrderReport.getUnqualifiedDataList(); -// if (CollectionUtils.isEmpty(unqualifiedDataList)){ -// throw new BusinessException("品质单不合格数数据为空"); -// } - int processBadNumTotal = 0; - if (!CollectionUtils.isEmpty(unqualifiedDataList)){ - //计算不良数量的合计值 - processBadNumTotal = unqualifiedDataList.stream().mapToInt(QualityOrderReportUnqualified::getProcessBadNum).sum(); + /** + * 审批流程启动 + */ + @Override + public ProcessInstance submitApply(QualityOrderReportVO qualityOrderReportVO) { + SysUser user = ShiroUtils.getSysUser(); + qualityOrderReportVO.setApplyUser(user.getLoginName()); + qualityOrderReportVO.setApplyTime(DateUtils.getNowDate()); + // 保存 + insertMakeQualityOrderReport(qualityOrderReportVO); + // 启动流程 + String applyTitle = user.getUserName() + "发起了品质报告单提交审批-" + DateUtils.dateTimeNow(); + String instanceType = "submit"; + ProcessInstance processInstance = startProcessInstance(applyTitle, instanceType, qualityOrderReportVO, user); + String processInstanceId = processInstance.getProcessInstanceId(); + // 提交实例id + qualityOrderReportVO.setSubmitInstanceId(processInstanceId); + // 存在提交完就流程结束的情况 + boolean processIsFinish = processService.judgeProcessIsFinish(processInstanceId); + if (processIsFinish) { + // 审核状态-审核通过 + qualityOrderReportVO.setAuditStatus("1"); + String materialNo = qualityOrderReportVO.getMaterialNo(); + //成品品质 + if(materialNo.startsWith("8")){ + updateApprovedInfo(qualityOrderReportVO); + } } + qualityOrderReportMapper.updateQualityOrderReportById(qualityOrderReportVO); + return processInstance; + } + /** + * 创建品质报告审核流程 + */ + private ProcessInstance startProcessInstance(String applyTitle, String instanceType, QualityOrderReportVO qualityOrderReportVO, SysUser user) { + Long reportId = qualityOrderReportVO.getQualityOrderReportId(); + String businessKey = reportId.toString(); // 实体类 ID,作为流程的业务 key + String key = "qualityOrderReport"; + Map variables = new HashMap<>(); + // 构造authority传参 + buildAuthority(user, variables); + qualityOrderReportVO.setApplyTitle(applyTitle); + // 启动流程 + ProcessInstance processInstance = processService.submitApply(user.getLoginName(), businessKey, applyTitle, qualityOrderReportVO.getQualityOrderReportCode(), key, variables); + String processInstanceId = processInstance.getId(); + qualityOrderReportVO.setInstanceId(processInstanceId); // 建立双向关系 + qualityOrderReportVO.setInstanceType(instanceType); + return processInstance; + } - //更新品质报告详情品质不合格数 - qualityOrderDetail.setQualityUnqualifiedNum(processBadNumTotal); - qualityOrderDetail.setUpdateBy(loginName); - qualityOrderDetail.setUpdateTime(new Date()); - //更新品质报告详情数据表 - int updateQualityOrderDetailResult = orderDetailMapper.updateQualityOrderDetail(qualityOrderDetail); - - if (updateQualityOrderDetailResult <= 0){ - throw new BusinessException("更新品质单详情数据失败"); + /** + * 发起人节点判断 + */ + private void buildAuthority(SysUser user, Map variables) { + Set roleKeys = roleService.selectRoleKeys(user.getUserId()); + if (roleKeys.contains("pzwyRole")) { + variables.put("authority", 1); + } + if (roleKeys.contains("pzjlRole") || roleKeys.contains("admin")) { + variables.put("authority", 2); } + } + /* + * 审核通过后更新数据(生产入库,成品品质) + * 成品品质更新品质单表、品质单详情表、品质单关联设备表、售后设备表、生产订单、生产订单bom已完成数和状态,新增入库单、入库单详情 + * 半成品其他品质更新品质单表、品质单详情表、生产订单、生产订单bom已完成数和状态,新增入库单、入库单详情*/ + @Override + public void updateApprovedInfo(QualityOrderReportVO qualityOrderReportVO) { + String quaoityOrderCode = qualityOrderReportVO.getQualityOrderCode(); + String materialNo = qualityOrderReportVO.getMaterialNo(); + String makeNo = qualityOrderReportVO.getRelatedOrderCode(); + String loginName = ShiroUtils.getLoginName(); - //生成品质报告不合格数 - for (QualityOrderReportUnqualified qualityOrderReportUnqualified : unqualifiedDataList) { - qualityOrderReportUnqualified.setQualityOrderReportId(qualityOrderReport.getQualityOrderReportId()); - qualityOrderReportUnqualified.setCreateBy(loginName); - qualityOrderReportUnqualified.setCreateTime(new Date()); - qualityOrderReportUnqualified.setMaterialNo(qualityOrderReport.getMaterialNo()); - qualityOrderReportUnqualified.setMaterialName(qualityOrderReport.getMaterialName()); - int insertUnqualifiedResult = unqualifiedMapper.insertQualityOrderReportUnqualified(qualityOrderReportUnqualified); - if (insertUnqualifiedResult <= 0){ - throw new BusinessException("新增品质报告不合格数数据失败"); + int qualifiedNum = qualityOrderReportVO.getQualityHasqualifiedNum(); + int unQualifiedNum = qualityOrderReportVO.getProcessBadNum(); + int checkNum = qualityOrderReportVO.getCheckNum(); + + /** + 更新品质单详情合格数、不良数 + */ + QualityOrderDetail qualityOrderDetail = orderDetailMapper.selectQualityOrderDetailByCode(quaoityOrderCode); + qualityOrderDetail.setQualityQualifiedNum(qualifiedNum); + qualityOrderDetail.setQualityUnqualifiedNum(unQualifiedNum); + //更新待审核数 + int detailPendingReviewNum = qualityOrderDetail.getPendingReviewNum(); + detailPendingReviewNum = detailPendingReviewNum - checkNum; + qualityOrderDetail.setPendingReviewNum(detailPendingReviewNum); + qualityOrderDetail.setUpdateBy(loginName); + qualityOrderDetail.setUpdateTime(DateUtils.getNowDate()); + orderDetailMapper.updateQualityOrderDetail(qualityOrderDetail); + /** + 更新品质单合格数、不良数*/ + QualityOrder qualityOrder = qualityOrderMapper.selectQualityOrderByCode(quaoityOrderCode); + qualityOrder.setQualityQualifiedNum(qualifiedNum); + qualityOrder.setQualityUnqualifiedNum(unQualifiedNum); + //更新待审核数 + int orderPendingReviewNum = qualityOrder.getPendingReviewNum(); + orderPendingReviewNum = orderPendingReviewNum - checkNum; + qualityOrder.setPendingReviewNum(orderPendingReviewNum); + qualityOrder.setUpdateBy(loginName); + qualityOrder.setUpdateTime(DateUtils.getNowDate()); + int orderQualifiedNum = qualityOrder.getQualityQualifiedNum(); + int orderUnqualifiedNum = qualityOrder.getQualityUnqualifiedNum(); + int orderCheckNum = qualityOrder.getThisArrivedNum(); + if(orderQualifiedNum + orderUnqualifiedNum + orderPendingReviewNum < orderCheckNum){ + qualityOrder.setQualityStatus("1");//部分品质 + } + if(orderQualifiedNum + orderUnqualifiedNum + orderPendingReviewNum == orderCheckNum){ + qualityOrder.setQualityStatus("2");//全部品质 + } + qualityOrderMapper.updateQualityOrder(qualityOrder); + /* + * 更新设备状态*/ + List deviceIds = qualityOrderReportVO.getQualityReportDeviceIds(); + if (StringUtils.isNotEmpty(deviceIds)) { + for (String deviceId : deviceIds) { + //更新品质单关联设备状态 + QualityShippingDevice shippingDevice = shippingDeviceMapper.selectQualityShippingDeviceByDeviceId(deviceId); + shippingDevice.setQualityAuditStatus("1");//审核通过 + shippingDevice.setQualityStatus("3");//品质不合格(审核通过) + shippingDevice.setUpdateBy(loginName); + shippingDevice.setUpdateTime(DateUtils.getNowDate()); + shippingDeviceMapper.updateQualityShippingDevice(shippingDevice); + //更新售后出货设备状态 + AfterSalesShippingDevice afterSalesDevice = afterSalesDeviceMapper.selectAfterSalesShippingDeviceByShippingDeviceId(deviceId); + afterSalesDevice.setQualityStatus("3");//品质不合格(审核通过) + afterSalesDevice.setUpdateBy(loginName); + afterSalesDevice.setUpdateTime(DateUtils.getNowDate()); + afterSalesDeviceMapper.updateAfterSalesShippingDevice(afterSalesDevice); } } - - qualityOrderReport.setUpdateBy(loginName); - qualityOrderReport.setUpdateTime(new Date()); - return qualityOrderReportMapper.updateQualityOrderReportById(qualityOrderReport); + //更新生产订单bom已完成数 + SysMakeorderBom tempBom = new SysMakeorderBom(); + tempBom.setMakeNo(makeNo); + tempBom.setMaterialNo(materialNo); + SysMakeorderBom makeorderBom = makeorderBomMapper.selectSysMakeorderBomByNo(tempBom); + if(makeorderBom == null){ + throw new BusinessException("关联生产单bom为空!请检查"); + } + int bomFinishNum = makeorderBom.getFinishNum(); + bomFinishNum = bomFinishNum + qualifiedNum; + makeorderBom.setFinishNum(bomFinishNum); + makeorderBomMapper.updateSysMakeorderBom(makeorderBom); + + //更新生产订单已完成数 + SysMakeOrder makeOrder = makeOrderMapper.selectMakeOrderByMakeNo(makeNo); + if(makeOrder == null){ + throw new BusinessException("关联生产订单不存在!请检查"); + } + int makeOrderFinishNum = makeOrder.getFinishNum(); + int makeOrderNum = makeOrder.getMaterialSum(); + makeOrderFinishNum = makeOrderFinishNum + qualifiedNum; + makeOrder.setFinishNum(makeOrderFinishNum); + //订单数>完成数,部分完成,部分品质 + if(makeOrderNum > makeOrderFinishNum){ + makeOrder.setMakeStatus("5"); + makeOrder.setQualityStatus("1"); + } + //订单数=完成数,全部完成,全部品质 + if(makeOrderNum == makeOrderFinishNum){ + makeOrder.setMakeStatus("6"); + makeOrder.setQualityStatus("2"); + } + makeOrder.setUpdateBy(ShiroUtils.getLoginName()); + makeOrder.setUpdateTime(DateUtils.getNowDate()); + makeOrderMapper.updateSysMakeOrder(makeOrder); + + //合格数大于0生成入库单 + if (qualifiedNum > 0) { + String storageOrderCode = redisCache.generateBillNo("RK"); + WarehouseStorageOrderDetail storageOrderDetail = generateWarehouseDetail(storageOrderCode,qualityOrderReportVO,qualityOrderDetail); + storageOrderDetail.setWarehouseStorageStatus("2");//待入库 + storageOrderDetail.setWarehouseQualityStatus("2");//全部品质 + storageOrderDetail.setWarehouseStorageType("5");//生产入库 + storageOrderDetail.setWarehouseOrderType("1");//生产订单 + storageOrderDetail.setWarehouseDeptType("0");//入库部门:仓库 + int detailResult = storageDetailMapper.insertWarehouseStorageOrderDetail(storageOrderDetail); + if(detailResult<=0){ + throw new BusinessException("新增入库单详情失败"); + } + WarehouseStorageOrder storageOrder = generateWarehouseStorageOrderByMakeOrder(storageOrderCode,qualityOrderReportVO); + storageOrder.setWarehouseStorageStatus("2");//待入库 + storageOrder.setWarehouseQualityStatus("2");//全部品质 + storageOrder.setWarehouseStorageType("5");//生产入库 + storageOrder.setWarehouseOrderType("1");//生产订单 + storageOrder.setWarehouseDeptType("0");//入库部门:仓库 + if(qualityOrderReportVO.getQualityOrderReportType().equals("0")){ + storageOrder.setQualityUnqualifiedNum(0); + } + int storageResult = storageOrderMapper.insertWarehouseStorageOrder(storageOrder); + if(storageResult<=0){ + throw new BusinessException("新增入库单失败"); + } + //更新品质报告单入库单号 + qualityOrderReportVO.setInStorageCode(storageOrderCode); + qualityOrderReportMapper.updateQualityOrderReportById(qualityOrderReportVO); + } } - /** - *退换货单号生产规则 - *系统自动生成,按照特定编码,编码暂用【THH+年月日+001】, - *自增长,如:THH20231111001,THH20231111002 - * - */ - - private String generateNewCode(String prefix, String maxCode) { - if (StringUtils.isEmpty(maxCode)){ - return prefix+"001"; - } - //解析并递增编号 - int sequence = Integer.parseInt(maxCode.substring(4)) + 1 ; + /* + * 审核拒绝后更新数据(生产入库,成品品质) + * 更新品质单表、品质单详情表、品质单关联设备表、售后设备表*/ + @Override + public void updateDisApprovedInfo(QualityOrderReportVO qualityOrderReportVO) { + String quaoityOrderCode = qualityOrderReportVO.getQualityOrderCode(); + String materialNo = qualityOrderReportVO.getMaterialNo(); + String makeNo = qualityOrderReportVO.getRelatedOrderCode(); + String loginName = ShiroUtils.getLoginName(); - //检查序列号是否溢出 - if (sequence > 999){ - throw new BusinessException("当日编号已达到最大值999,请检查或调整策略"); + int checkNum = qualityOrderReportVO.getCheckNum(); + /** + 更新品质单详情待审核数 + */ + QualityOrderDetail qualityOrderDetail = orderDetailMapper.selectQualityOrderDetailByCode(quaoityOrderCode); + int detailPendingReviewNum = qualityOrderDetail.getPendingReviewNum(); + detailPendingReviewNum = detailPendingReviewNum - checkNum; + qualityOrderDetail.setPendingReviewNum(detailPendingReviewNum); + qualityOrderDetail.setUpdateBy(loginName); + qualityOrderDetail.setUpdateTime(DateUtils.getNowDate()); + orderDetailMapper.updateQualityOrderDetail(qualityOrderDetail); + /** + 更新品质单待审核数*/ + QualityOrder qualityOrder = qualityOrderMapper.selectQualityOrderByCode(quaoityOrderCode); + int orderPendingReviewNum = qualityOrder.getPendingReviewNum(); + orderPendingReviewNum = orderPendingReviewNum - checkNum; + qualityOrder.setPendingReviewNum(orderPendingReviewNum); + qualityOrder.setUpdateBy(loginName); + qualityOrder.setUpdateTime(DateUtils.getNowDate()); + qualityOrderMapper.updateQualityOrder(qualityOrder); + + + /* + * 更新设备状态(成品品质时才存在)*/ + List deviceIds = qualityOrderReportVO.getQualityReportDeviceIds(); + if (StringUtils.isNotEmpty(deviceIds)) { + for (String deviceId : deviceIds) { + //更新品质单关联设备状态 + QualityShippingDevice shippingDevice = shippingDeviceMapper.selectQualityShippingDeviceByDeviceId(deviceId); + shippingDevice.setQualityAuditStatus("2");//审核拒绝 + shippingDevice.setQualityStatus("1");//待品质 + shippingDevice.setUpdateBy(loginName); + shippingDevice.setUpdateTime(DateUtils.getNowDate()); + shippingDeviceMapper.updateQualityShippingDevice(shippingDevice); + //更新售后出货设备状态 + AfterSalesShippingDevice afterSalesDevice = afterSalesDeviceMapper.selectAfterSalesShippingDeviceByShippingDeviceId(deviceId); + afterSalesDevice.setQualityStatus("1");//待品质 + afterSalesDevice.setUpdateBy(loginName); + afterSalesDevice.setUpdateTime(DateUtils.getNowDate()); + afterSalesDeviceMapper.updateAfterSalesShippingDevice(afterSalesDevice); + } } + } - //格式化序列号,自动补零至三位 - DecimalFormat df = new DecimalFormat("000"); + //根据品质报告生成入库单 + public WarehouseStorageOrder generateWarehouseStorageOrderByMakeOrder(String storageOrderCode,QualityOrderReportVO qualityReportVO){ + WarehouseStorageOrder storageOrder = new WarehouseStorageOrder(); + storageOrder.setWarehouseStorageCode(storageOrderCode); + storageOrder.setRelatedOrderCode(qualityReportVO.getRelatedOrderCode()); + storageOrder.setNotifyArrivedNum(qualityReportVO.getQualityHasqualifiedNum()); + storageOrder.setQualityQualifiedNum(qualityReportVO.getQualityHasqualifiedNum()); + storageOrder.setQualityUnqualifiedNum(qualityReportVO.getProcessBadNum()); + storageOrder.setDeliveryInspectionTime(qualityReportVO.getDeliveryInspectionTime()); + storageOrder.setQualityTime(qualityReportVO.getCheckoutCompletionTime()); + storageOrder.setArrivedTime(DateUtils.getNowDate()); + storageOrder.setCreateBy(ShiroUtils.getLoginName()); + storageOrder.setCreateTime(DateUtils.getNowDate()); + return storageOrder; + } - return prefix + df.format(sequence); + //根据品质报告、品质单详情生成入库单详情 + public WarehouseStorageOrderDetail generateWarehouseDetail(String storageOrderCode,QualityOrderReportVO reportVO,QualityOrderDetail qualityOrderDetail){ + WarehouseStorageOrderDetail storageOrderDetail = new WarehouseStorageOrderDetail(); + storageOrderDetail.setWarehouseStorageCode(storageOrderCode); + storageOrderDetail.setRelatedOrderCode(reportVO.getRelatedOrderCode()); + storageOrderDetail.setNotifyArriveNum(reportVO.getQualityHasqualifiedNum()); + storageOrderDetail.setNotifyHasArrivedNum(reportVO.getQualityHasqualifiedNum()); + storageOrderDetail.setQualityQualifiedNum(reportVO.getQualityHasqualifiedNum()); + storageOrderDetail.setQualityHasQualifiedNum(reportVO.getQualityHasqualifiedNum()); + storageOrderDetail.setDeliveryInspectionTime(reportVO.getDeliveryInspectionTime()); + storageOrderDetail.setQualityTime(reportVO.getCheckoutCompletionTime()); + storageOrderDetail.setMaterialNo(reportVO.getMaterialNo()); + storageOrderDetail.setMaterialName(reportVO.getMaterialName()); + storageOrderDetail.setMaterialType(qualityOrderDetail.getMaterialType()); + storageOrderDetail.setMaterialUnit(qualityOrderDetail.getMaterialUnit()); + storageOrderDetail.setMaterialBrand(qualityOrderDetail.getMaterialBrand()); + storageOrderDetail.setMaterialPhotourl(qualityOrderDetail.getMaterialPhotourl()); + storageOrderDetail.setMaterialDescribe(qualityOrderDetail.getMaterialDescribe()); + storageOrderDetail.setMaterialModel(qualityOrderDetail.getMaterialModel()); + storageOrderDetail.setMaterialProcessMethod(qualityOrderDetail.getMaterialProcessMethod()); + storageOrderDetail.setMaterialDeptType(qualityOrderDetail.getMaterialDeptType()); + storageOrderDetail.setMakeTotal(qualityOrderDetail.getMakeTotal()); + storageOrderDetail.setArrivedTime(DateUtils.getNowDate()); + storageOrderDetail.setCreateBy(ShiroUtils.getLoginName()); + storageOrderDetail.setCreateTime(DateUtils.getNowDate()); + return storageOrderDetail; } } + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java index 9854c417..48b03ed8 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java @@ -821,7 +821,7 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS tempDetail.setMaterialNo(warehouseStorageOrderDetail.getMaterialNo()); QualityOrderDetail qualityOrderDetail = qualityOrderDetailMapper.selectQualityOrderDetailByStorageCodeAndno(tempDetail); - Integer actualArriveNum = qualityOrderDetail.getActualArriveNum(); + Integer actualArriveNum = qualityOrderDetail.getCheckNum(); Integer qualityUnqualifiedNum = qualityOrderDetail.getQualityUnqualifiedNum(); historicalTotal = BigDecimal.valueOf(actualArriveNum) @@ -923,54 +923,7 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS * */ @Override public int insertWarehouseStorageOrderByMakeInQualityOrder(QualityOrder tempQualityOrder, List qualityOrderDetailList) { - WarehouseStorageOrder warehouseStorageOrder = new WarehouseStorageOrder(); - String loginName = ShiroUtils.getLoginName(); - - warehouseStorageOrder.setWarehouseStorageCode(tempQualityOrder.getWarehouseCode()); - warehouseStorageOrder.setRelatedOrderCode(tempQualityOrder.getRelatedOrderCode()); - //暂收设置为全部品质 - warehouseStorageOrder.setWarehouseQualityStatus("2"); - warehouseStorageOrder.setWarehouseStorageStatus("2"); - warehouseStorageOrder.setWarehouseStorageType("2"); - warehouseStorageOrder.setWarehouseOrderType("1"); - warehouseStorageOrder.setDeliveryInspectionTime(tempQualityOrder.getDeliveryInspectionTime()); - warehouseStorageOrder.setQualityUnqualifiedNum(tempQualityOrder.getQualityUnqualifiedNum()); - warehouseStorageOrder.setQualityQualifiedNum(tempQualityOrder.getQualityQualifiedNum()); - warehouseStorageOrder.setCreateBy(loginName); - warehouseStorageOrder.setQualityTime(DateUtils.getNowDate()); - warehouseStorageOrder.setCreateTime(DateUtils.getNowDate()); - //设置委内完成数总价 - warehouseStorageOrder.setMakeInTotalPrice(tempQualityOrder.getMakeInTotalPrice()); - //插入入库单详情数据 - for (QualityOrderDetail qualityOrderDetail : qualityOrderDetailList) { - - WarehouseStorageOrderDetail warehouseStorageOrderDetail = new WarehouseStorageOrderDetail(); - warehouseStorageOrderDetail.setWarehouseStorageCode(tempQualityOrder.getWarehouseCode()); - warehouseStorageOrderDetail.setRelatedOrderCode(tempQualityOrder.getRelatedOrderCode()); - warehouseStorageOrderDetail.setWarehouseQualityStatus("2"); - warehouseStorageOrderDetail.setWarehouseStorageStatus("2"); - warehouseStorageOrderDetail.setWarehouseStorageType("2"); - warehouseStorageOrderDetail.setWarehouseOrderType("1"); - //当作委内入库数 - warehouseStorageOrderDetail.setMakeStorageNum(qualityOrderDetail.getMakeInNum()); - //设置委内加工费单价 - warehouseStorageOrderDetail.setMakeInUnitPrice(qualityOrderDetail.getMakeInUnitPrice()); - //设置品质已合格数 - warehouseStorageOrderDetail.setQualityHasQualifiedNum(qualityOrderDetail.getQualityQualifiedNum()); - warehouseStorageOrderDetail.setMaterialNo(qualityOrderDetail.getMaterialNo()); - warehouseStorageOrderDetail.setMaterialName(qualityOrderDetail.getMaterialName()); - warehouseStorageOrderDetail.setMaterialBrand(qualityOrderDetail.getMaterialBrand()); - warehouseStorageOrderDetail.setMaterialDescribe(qualityOrderDetail.getMaterialDescribe()); - warehouseStorageOrderDetail.setMaterialPhotourl(qualityOrderDetail.getMaterialPhotourl()); - warehouseStorageOrderDetail.setMaterialProcessMethod(qualityOrderDetail.getMaterialProcessMethod()); - warehouseStorageOrderDetail.setMaterialType(qualityOrderDetail.getMaterialType()); - warehouseStorageOrderDetail.setMaterialUnit(qualityOrderDetail.getMaterialUnit()); - warehouseStorageOrderDetail.setCreateBy(loginName); - warehouseStorageOrderDetail.setCreateTime(DateUtils.getNowDate()); - storageOrderDetailMapper.insertWarehouseStorageOrderDetail(warehouseStorageOrderDetail); - } - - return warehouseStorageOrderMapper.insertWarehouseStorageOrder(warehouseStorageOrder); + return 0; } /* @@ -1321,7 +1274,7 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS //更新生产订单的数据 SysMakeOrder tempSysMakeOrder = sysMakeOrderMapper.selectMakeOrderByMakeNo(warehouseStorageOrder.getRelatedOrderCode()); - tempSysMakeOrder.setEceiptNum(Long.valueOf(storageNum)); + tempSysMakeOrder.setEceiptNum(storageNum); //设置生产状态为全部完成 tempSysMakeOrder.setMakeStatus("6"); int updateMakeOrderResult = sysMakeOrderService.updateByMakeNo(tempSysMakeOrder); diff --git a/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderDetailMapper.xml b/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderDetailMapper.xml index d70dccf7..560d6a4b 100644 --- a/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderDetailMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderDetailMapper.xml @@ -24,6 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -31,18 +32,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - - - + + @@ -65,6 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" material_name, material_type, material_photoUrl, + material_model, material_brand, material_unit, material_describe, @@ -72,18 +72,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" material_dept_type, make_total, make_completion_num, - actual_arrive_num, - this_arrived_num, quality_hasqualified_num, quality_qualified_num, quality_unqualified_num, - make_in_num, - make_in_unit_price, remark, create_by, create_time, update_by, - update_time + update_time, + check_num, + pending_review_num from quality_order_detail @@ -150,6 +148,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" material_name, material_type, material_photoUrl, + material_model, material_brand, material_unit, material_describe, @@ -157,18 +156,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" material_dept_type, make_total, make_completion_num, - actual_arrive_num, - this_arrived_num, quality_hasqualified_num, quality_qualified_num, quality_unqualified_num, - make_in_num, - make_in_unit_price, remark, create_by, create_time, update_by, update_time, + check_num, + pending_review_num, #{qualityOrderCode}, @@ -189,6 +186,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{materialName}, #{materialType}, #{materialPhotourl}, + #{materialModel}, #{materialBrand}, #{materialUnit}, #{materialDescribe}, @@ -196,18 +194,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{materialDeptType}, #{makeTotal}, #{makeCompletionNum}, - #{actualArriveNum}, - #{thisArrivedNum}, #{qualityHasqualifiedNum}, #{qualityQualifiedNum}, #{qualityUnqualifiedNum}, - #{makeInNum}, - #{makeInUnitPrice}, #{remark}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime}, + #{checkNum}, + #{pendingReviewNum}, @@ -232,6 +228,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" material_name = #{materialName}, material_type = #{materialType}, material_photoUrl = #{materialPhotourl}, + material_model = #{materialModel}, material_brand = #{materialBrand}, material_unit = #{materialUnit}, material_describe = #{materialDescribe}, @@ -239,18 +236,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" material_dept_type = #{materialDeptType}, make_total = #{makeTotal}, make_completion_num = #{makeCompletionNum}, - actual_arrive_num = #{actualArriveNum}, - this_arrived_num = #{thisArrivedNum}, quality_hasqualified_num = #{qualityHasqualifiedNum}, quality_qualified_num = #{qualityQualifiedNum}, quality_unqualified_num = #{qualityUnqualifiedNum}, - make_in_num = #{makeInNum}, - make_in_unit_price= #{makeInUnitPrice}, remark = #{remark}, create_by = #{createBy}, create_time = #{createTime}, update_by = #{updateBy}, update_time = #{updateTime}, + check_num = #{checkNum}, + pending_review_num = #{pendingReviewNum}, where quality_order_detail_id = #{qualityOrderDetailId} diff --git a/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderMapper.xml b/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderMapper.xml index 43f588ce..f8dbadc5 100644 --- a/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderMapper.xml @@ -16,7 +16,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + @@ -26,6 +26,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + @@ -48,7 +51,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" create_time, update_by, update_time, - make_in_total_price + material_no, + material_name, + pending_review_num from quality_order @@ -100,7 +105,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" qo.create_time, qo.update_by, qo.update_time, - qo.make_in_total_price, + qo.material_no, + qo.material_name, + qo.pending_review_num, wso.storage_num from quality_order qo left join warehouse_storage_order wso on wso.related_order_code = qo.related_order_code @@ -114,7 +121,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and qo.quality_storage_status = #{qualityStorageStatus} and qo.quality_employee = #{qualityEmployee} and create_time between #{params.beginCreateTime} and #{params.endCreateTime} - and (qo.quality_storage_status = '1' or qo.quality_storage_status = '4') + and (qo.quality_storage_status = '4') order by qo.create_time desc @@ -142,6 +149,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" create_time, update_by, update_time, + material_no, + material_name, + pending_review_num, #{qualityOrderCode}, @@ -163,6 +173,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{createTime}, #{updateBy}, #{updateTime}, + #{materialNo}, + #{materialName}, + #{pendingReviewNum}, @@ -188,6 +201,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" create_time = #{createTime}, update_by = #{updateBy}, update_time = #{updateTime}, + material_no = #{materialNo}, + material_name = #{materialName}, + pending_review_num = #{pendingReviewNum}, where quality_order_id = #{qualityOrderId} diff --git a/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderReportMapper.xml b/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderReportMapper.xml index ff95d6b7..55a8c159 100644 --- a/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderReportMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderReportMapper.xml @@ -3,42 +3,78 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - select quality_order_report_id, quality_order_code, supplier_code, supplier_name, material_no, material_name, make_total, make_in_num, actual_arrive_num,quality_hasqualified_num, ok_accepted_num, ok_report_url, special_concessions_num, special_report_url, checkout_completion_time, process_bad_classification, process_bad_grade, process_bad_num, unqualified_report_url, remark, create_by, create_time, update_by, update_time from quality_order_report + select quality_order_report_id, supplier_code, quality_order_report_code, + quality_order_code, supplier_name, material_no, in_storage_code, + quality_order_type, material_name, make_total, quality_storage_status, + delivery_inspection_time, quality_hasqualified_num, ok_accepted_num, + ok_report_url, special_concessions_num, special_report_url,quality_order_report_type, + checkout_completion_time, check_num, process_bad_num, unqualified_report_url, + remark, create_by, create_time, update_by, update_time, audit_status, + use_status, instance_id, instance_type, submit_instance_id, apply_title,apply_time, + apply_user, restore_instance_id, cancel_instance_id, cancel_remark,related_order_code + from quality_order_report - - + + and quality_order_report_code = #{qualityOrderReportCode} + and quality_order_code = #{qualityOrderCode} + and material_no like concat('%', #{materialNo}, '%') + and in_storage_code = #{inStorageCode} + and quality_order_type = #{qualityOrderType} + and quality_order_report_type = #{qualityOrderReportType} + and material_name like concat('%', #{materialName}, '%') + and quality_storage_status = #{qualityStorageStatus} + and create_time between #{params.beginCreateTime} and #{params.endCreateTime} + and audit_status = #{auditStatus} + and apply_user = #{applyUser} + order by create_time desc,audit_status asc - where material_no = #{materialNo} and supplier_code = #{supplierCode} and quality_order_code = #{qualityOrderCode} - where material_no = #{materialNo} and quality_order_code = #{qualityOrderCode} @@ -61,25 +97,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + insert into quality_order_report - quality_order_code, supplier_code, supplier_name, + quality_order_report_code, + quality_order_report_type, + quality_order_code, + related_order_code, material_no, + in_storage_code, + quality_order_type, material_name, make_total, - make_in_num, - actual_arrive_num, + quality_storage_status, + delivery_inspection_time, quality_hasqualified_num, ok_accepted_num, ok_report_url, special_concessions_num, special_report_url, checkout_completion_time, - process_bad_classification, - process_bad_grade, + check_num, process_bad_num, unqualified_report_url, remark, @@ -87,24 +127,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" create_time, update_by, update_time, - + audit_status, + use_status, + instance_id, + instance_type, + submit_instance_id, + apply_title, + apply_user, + apply_time, + restore_instance_id, + cancel_instance_id, + cancel_remark, + - #{qualityOrderCode}, #{supplierCode}, #{supplierName}, + #{qualityOrderReportCode}, + #{qualityOrderReportType}, + #{qualityOrderCode}, + #{relatedOrderCode}, #{materialNo}, + #{inStorageCode}, + #{qualityOrderType}, #{materialName}, #{makeTotal}, - #{makeInNum}, - #{actualArriveNum}, + #{qualityStorageStatus}, + #{deliveryInspectionTime}, #{qualityHasqualifiedNum}, #{okAcceptedNum}, #{okReportUrl}, #{specialConcessionsNum}, #{specialReportUrl}, #{checkoutCompletionTime}, - #{processBadClassification}, - #{processBadGrade}, + #{checkNum}, #{processBadNum}, #{unqualifiedReportUrl}, #{remark}, @@ -112,28 +167,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{createTime}, #{updateBy}, #{updateTime}, - + #{auditStatus}, + #{useStatus}, + #{instanceId}, + #{instanceType}, + #{submitInstanceId}, + #{applyTitle}, + #{applyUser}, + #{applyTime}, + #{restoreInstanceId}, + #{cancelInstanceId}, + #{cancelRemark}, + - + update quality_order_report - quality_order_code = #{qualityOrderCode}, supplier_code = #{supplierCode}, supplier_name = #{supplierName}, + quality_order_report_code = #{qualityOrderReportCode}, + quality_order_report_type = #{qualityOrderReportType}, + quality_order_code = #{qualityOrderCode}, + related_order_code = #{relatedOrderCode}, material_no = #{materialNo}, + in_storage_code = #{inStorageCode}, + quality_order_type = #{qualityOrderType}, material_name = #{materialName}, make_total = #{makeTotal}, - make_in_num = #{makeInNum}, - actual_arrive_num = #{actualArriveNum}, + quality_storage_status = #{qualityStorageStatus}, + delivery_inspection_time = #{deliveryInspectionTime}, quality_hasqualified_num = #{qualityHasqualifiedNum}, ok_accepted_num = #{okAcceptedNum}, ok_report_url = #{okReportUrl}, special_concessions_num = #{specialConcessionsNum}, special_report_url = #{specialReportUrl}, checkout_completion_time = #{checkoutCompletionTime}, - process_bad_classification = #{processBadClassification}, - process_bad_grade = #{processBadGrade}, + check_num = #{checkNum}, process_bad_num = #{processBadNum}, unqualified_report_url = #{unqualifiedReportUrl}, remark = #{remark}, @@ -141,31 +211,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" create_time = #{createTime}, update_by = #{updateBy}, update_time = #{updateTime}, + audit_status = #{auditStatus}, + use_status = #{useStatus}, + instance_id = #{instanceId}, + instance_type = #{instanceType}, + submit_instance_id = #{submitInstanceId}, + apply_title = #{applyTitle}, + apply_user = #{applyUser}, + apply_time = #{applyTime}, + restore_instance_id = #{restoreInstanceId}, + cancel_instance_id = #{cancelInstanceId}, + cancel_remark = #{cancelRemark}, where material_no = #{materialNo} and supplier_code = #{supplierCode} - + update quality_order_report - quality_order_code = #{qualityOrderCode}, supplier_code = #{supplierCode}, supplier_name = #{supplierName}, + quality_order_report_code = #{qualityOrderReportCode}, + quality_order_report_type = #{qualityOrderReportType}, + quality_order_code = #{qualityOrderCode}, + related_order_code = #{relatedOrderCode}, material_no = #{materialNo}, + in_storage_code = #{inStorageCode}, + quality_order_type = #{qualityOrderType}, material_name = #{materialName}, make_total = #{makeTotal}, - make_in_num = #{makeInNum}, - actual_arrive_num = #{actualArriveNum}, + quality_storage_status = #{qualityStorageStatus}, + delivery_inspection_time = #{deliveryInspectionTime}, quality_hasqualified_num = #{qualityHasqualifiedNum}, ok_accepted_num = #{okAcceptedNum}, ok_report_url = #{okReportUrl}, special_concessions_num = #{specialConcessionsNum}, special_report_url = #{specialReportUrl}, checkout_completion_time = #{checkoutCompletionTime}, - process_bad_classification = #{processBadClassification}, - process_bad_grade = #{processBadGrade}, + check_num = #{checkNum}, process_bad_num = #{processBadNum}, unqualified_report_url = #{unqualifiedReportUrl}, remark = #{remark}, @@ -173,6 +258,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" create_time = #{createTime}, update_by = #{updateBy}, update_time = #{updateTime}, + audit_status = #{auditStatus}, + use_status = #{useStatus}, + instance_id = #{instanceId}, + instance_type = #{instanceType}, + submit_instance_id = #{submitInstanceId}, + apply_title = #{applyTitle}, + apply_user = #{applyUser}, + apply_time = #{applyTime}, + restore_instance_id = #{restoreInstanceId}, + cancel_instance_id = #{cancelInstanceId}, + cancel_remark = #{cancelRemark}, where quality_order_report_id = #{qualityOrderReportId} diff --git a/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderReportUnqualifiedMapper.xml b/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderReportUnqualifiedMapper.xml index df948a76..41a6b0a1 100644 --- a/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderReportUnqualifiedMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderReportUnqualifiedMapper.xml @@ -20,15 +20,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + - select order_report_unqualified_id, quality_order_report_id, supplier_code, supplier_name, material_no, material_name, process_bad_classification, process_bad_grade, process_bad_num, unqualified_report_url, remark, create_by, create_time, update_by, update_time from quality_order_report_unqualified + select order_report_unqualified_id, quality_order_report_id, supplier_code, supplier_name, + material_no, material_name, process_bad_classification, process_bad_grade, process_bad_num, + unqualified_report_url, remark, create_by, create_time, update_by, update_time, + quality_order_report_code,shipping_device_id from quality_order_report_unqualified @@ -53,6 +60,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" insert into quality_order_report_unqualified quality_order_report_id, + quality_order_report_code, + shipping_device_id, supplier_code, supplier_name, material_no, @@ -69,6 +78,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{qualityOrderReportId}, + #{qualityOrderReportCode}, + #{shippingDeviceId}, #{supplierCode}, #{supplierName}, #{materialNo}, @@ -89,6 +100,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update quality_order_report_unqualified quality_order_report_id= #{qualityOrderReportId}, + quality_order_report_code= #{qualityOrderReportCode}, + shipping_device_id= #{shippingDeviceId}, supplier_code = #{supplierCode}, supplier_name = #{supplierName}, material_no = #{materialNo}, diff --git a/ruoyi-admin/src/main/resources/mapper/quality/QualityReportDeviceMapper.xml b/ruoyi-admin/src/main/resources/mapper/quality/QualityReportDeviceMapper.xml new file mode 100644 index 00000000..4230494c --- /dev/null +++ b/ruoyi-admin/src/main/resources/mapper/quality/QualityReportDeviceMapper.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + select id, shipping_device_id, quality_order_report_code from quality_report_device + + + + + + + + insert into quality_report_device + + shipping_device_id, + quality_order_report_code, + + + #{shippingDeviceId}, + #{qualityOrderReportCode}, + + + + + update quality_report_device + + shipping_device_id = #{shippingDeviceId}, + quality_order_report_code = #{qualityOrderReportCode}, + + where id = #{id} + + + + delete from quality_report_device where id = #{id} + + + + delete from quality_report_device where id in + + #{id} + + + + + update quality_report_device set del_flag = '1' where id = #{id} + + + + update quality_report_device set del_flag = '0' where id = #{id} + + + \ No newline at end of file