diff --git a/src/main/java/com/xujie/sys/modules/pms/controller/QcController.java b/src/main/java/com/xujie/sys/modules/pms/controller/QcController.java index f7cbec09..bef3a143 100644 --- a/src/main/java/com/xujie/sys/modules/pms/controller/QcController.java +++ b/src/main/java/com/xujie/sys/modules/pms/controller/QcController.java @@ -1493,6 +1493,17 @@ public class QcController { return R.ok(); } + /** + * 取消审核 + * @param data + * @return + */ + @PostMapping("/cancelApproval") + public R cancelApproval(@RequestBody QcFAIRecordData data){ + qcService.cancelApproval(data); + return R.ok(); + } + /** * @description: 删除检验记录 * @author: fengyuan_yang diff --git a/src/main/java/com/xujie/sys/modules/pms/data/PoOrderRollNoData.java b/src/main/java/com/xujie/sys/modules/pms/data/PoOrderRollNoData.java new file mode 100644 index 00000000..70cd2759 --- /dev/null +++ b/src/main/java/com/xujie/sys/modules/pms/data/PoOrderRollNoData.java @@ -0,0 +1,29 @@ +package com.xujie.sys.modules.pms.data; + +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class PoOrderRollNoData { + private Integer id; + private String orderNo; + private String itemNo; + private String rollNo; + private BigDecimal rollQty; + private String partNo; + private String partDesc; + private String supplierId; + private String supplierName; + private String orderQty; + private String delflag; + private Integer version; + private Integer printFlag; + private String citemClass; + private String sendtoAddress; + private String hardtagInFlag; + private String site; + private String citemCode; + private String inspectionNo; + private String batchNo; +} diff --git a/src/main/java/com/xujie/sys/modules/pms/mapper/QcMapper.java b/src/main/java/com/xujie/sys/modules/pms/mapper/QcMapper.java index 9e0364ac..79765149 100644 --- a/src/main/java/com/xujie/sys/modules/pms/mapper/QcMapper.java +++ b/src/main/java/com/xujie/sys/modules/pms/mapper/QcMapper.java @@ -580,4 +580,14 @@ public interface QcMapper { Integer getQCDetailOrderId(QcTemplateData data); void updateQCDetailOrderIdNull(); + + List selectInfoByInspectionNo(QcFAIRecordData qcData); + + void updateIQCMasterSubmitFlag2(QcFAIRecordData qcData); + + void updateIQCDetailSubmitFlag2(QcFAIRecordData qcData); + + void updateIQCSubDetailSubmitFlag2(QcFAIRecordData qcData); + + void deleteReceivingTaskByInspectionNo(QcFAIRecordData qcData); } diff --git a/src/main/java/com/xujie/sys/modules/pms/service/Impl/QcServiceImpl.java b/src/main/java/com/xujie/sys/modules/pms/service/Impl/QcServiceImpl.java index e1c29886..b606006c 100644 --- a/src/main/java/com/xujie/sys/modules/pms/service/Impl/QcServiceImpl.java +++ b/src/main/java/com/xujie/sys/modules/pms/service/Impl/QcServiceImpl.java @@ -4142,16 +4142,14 @@ public class QcServiceImpl implements QcService { @Override @Transactional public void saveIQCSubmitResult(QcFAIRecordData data) { - for (QcFAIRecordData qcData : data.getSubmitList()) { + for (QcFAIRecordData recordData : data.getSubmitList()) { // 修改主记录标识为已提交 - qcMapper.updateIQCMasterSubmitFlag(qcData); + qcMapper.updateIQCMasterSubmitFlag(recordData); // 修改明细记录标识为已提交 - qcMapper.updateIQCDetailSubmitFlag(qcData); + qcMapper.updateIQCDetailSubmitFlag(recordData); // 修改子明细记录标识为已提交 - qcMapper.updateIQCSubDetailSubmitFlag(qcData); - } + qcMapper.updateIQCSubDetailSubmitFlag(recordData); - for (QcFAIRecordData recordData : data.getSubmitList()) { // 判断检验结论是否合格 if ("合格".equals(recordData.getInspectionResult()) || "让步接收".equals(recordData.getDisposalMeasures()) || "挑选使用".equals(recordData.getDisposalMeasures())) { // 根据 site、po_orderNo、po_itemNo 从 view_po_order 中查出数据 @@ -4216,8 +4214,6 @@ public class QcServiceImpl implements QcService { throw new RuntimeException("未查询到采购订单!"); } } - } - for (QcFAIRecordData recordData : data.getSubmitList()) { // 发送邮件 if ("不合格".equals(recordData.getInspectionResult())) { try { @@ -4231,6 +4227,36 @@ public class QcServiceImpl implements QcService { } } + /** + * 取消审核 + * @param data + */ + @Override + @Transactional + public void cancelApproval(QcFAIRecordData data) { + for (QcFAIRecordData qcData : data.getSubmitList()) { + // 物料的controlMes为G的不允许取消审核 + List partInformationList = qcMapper.getPartInformation(qcData); + if (partInformationList.isEmpty()) { + throw new RuntimeException("未查到该物料数据!"); + } + if ("G".equals(partInformationList.get(0).getControlMes())) { + throw new RuntimeException("检验单物料的管控类型为不适用,不允许取消审核 {" + qcData.getInspectionNo() + "} !"); + } + // po_order_roll_no里如果有数据则不允许取消审核 + List rollNos = qcMapper.selectInfoByInspectionNo(qcData); + if (!rollNos.isEmpty()) { + throw new RuntimeException("该检验单已发行入库标签,不允许取消审核 {" + qcData.getInspectionNo() + "} !"); + } + // 状态改为待检验,并将提交标识改为N + qcMapper.updateIQCMasterSubmitFlag2(qcData); + qcMapper.updateIQCDetailSubmitFlag2(qcData); + qcMapper.updateIQCSubDetailSubmitFlag2(qcData); + // 删除相应task表的数据 + qcMapper.deleteReceivingTaskByInspectionNo(qcData); + } + } + public void sendMailIQC(QcFAIRecordData data, String type) throws Exception { // 判断检验结论,不合格则发送邮件 diff --git a/src/main/java/com/xujie/sys/modules/pms/service/QcService.java b/src/main/java/com/xujie/sys/modules/pms/service/QcService.java index 1a8c3d22..66700009 100644 --- a/src/main/java/com/xujie/sys/modules/pms/service/QcService.java +++ b/src/main/java/com/xujie/sys/modules/pms/service/QcService.java @@ -340,4 +340,6 @@ public interface QcService { * @throw */ void goDownItem(QcTemplateData inData); + + void cancelApproval(QcFAIRecordData data); } diff --git a/src/main/resources/mapper/pms/QcMapper.xml b/src/main/resources/mapper/pms/QcMapper.xml index 27aefe1b..c4fe697f 100644 --- a/src/main/resources/mapper/pms/QcMapper.xml +++ b/src/main/resources/mapper/pms/QcMapper.xml @@ -3105,7 +3105,7 @@ - SELECT DISTINCT top 3 a.seqno, a.orderno, @@ -3116,7 +3116,7 @@ - SELECT a.site, a.seqno as seqNo, @@ -3128,7 +3128,7 @@ - SELECT site, part_no, @@ -3151,7 +3151,7 @@ - SELECT site, UMID as umId, @@ -3161,7 +3161,7 @@ - SELECT site, bu_no, @@ -3188,7 +3188,7 @@ - SELECT site, bu_no, @@ -3215,14 +3215,14 @@ - + UPDATE qc_iqc_record SET detail_flag = 'N' WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo} - SELECT site, bu_no, @@ -3234,7 +3234,7 @@ - SELECT site, bu_no, @@ -3247,7 +3247,7 @@ - SELECT site, bu_no, @@ -3324,7 +3324,7 @@ - SELECT id, start_time, @@ -3334,7 +3334,7 @@ WHERE del_flag = 'N' and site = #{site} - + UPDATE interface_time set updated_by = #{updatedBy}, @@ -3342,7 +3342,7 @@ del_flag = #{delFlag} - SELECT crdcode, crdname, @@ -3353,7 +3353,7 @@ WHERE crdname = #{crdName} - + INSERT INTO purchase_in_storage_count (site, trans_no, created_date, created_by, erp_flag, toacc, logindate, cordercode, cdepcode, cwhcode, crdcode, coutcode, ddate, bredvouch, cmemo, verify, irowno, cinvcode, iquantity, citemcode, erp_remark, trans_date, csource, trans_type) @@ -3361,7 +3361,7 @@ #{cmemo}, #{verify}, #{irowno}, #{cinvcode}, #{iquantity}, #{citemcode}, #{erpRemark}, #{transDate}, #{csource}, #{transType}) - + insert into TransHeader (TransNo, Site, WarehouseID, TransDate, TransType_DB, TransType, UserName, Receiver, TransYear, TransMonth, PartnerID, PartnerType, AuthorizeFlag, AuthorizeDate, Authorizor, TransferFlag, TransferDate, TransferGuys, VoucherDate, ProjectID, EnterDate, Remark, UseLocation, OrderRef1, LinkOrderFlag, DelAddID, Status, ProjectName, PartnerName, erp_warehouse_id, ERP, @@ -3371,14 +3371,14 @@ #{departmentNo}, #{pickingStatus}, #{scanType}, #{inCategory}, #{pmProject}, #{remarks}, #{itemNoMat}, #{remark3}, #{locationId}, #{countId}) - + INSERT INTO TransDetail (TransNo, Site, PartNo, LocationID, TransQty, Direction, OrderRef1, ItemNo, OrderRef2, OrderRef3, OrderRef5, Remark, citem_code) values (#{TransNo}, #{Site}, #{PartNo}, #{LocationID}, #{TransQty}, #{Direction}, #{OrderRef1}, #{ItemNo}, #{OrderRef2}, #{OrderRef3}, #{OrderRef5}, #{Remark}, #{citemCode}) - SELECT id, site, @@ -3392,7 +3392,7 @@ WHERE site = #{site} and send_type = #{type} and del_flag = 'N' - SELECT port, host, @@ -3407,20 +3407,20 @@ - + insert into send_mail_record (site, bu_no, document_no, sender, recipient, send_date, type) values (#{site}, #{buNo}, #{documentNo}, #{sender}, #{recipient}, getDate(), #{type}) - SELECT distinct order_type FROM view_po_order - + update qc_iqc_record set action_date = getDate(), action_by = #{actionBy}, @@ -3428,7 +3428,7 @@ where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo} - + update qc_fai_record set action_date = getDate(), action_by = #{actionBy}, @@ -3436,7 +3436,7 @@ where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo} - + update qc_ipqc_record set action_date = getDate(), action_by = #{actionBy}, @@ -3444,7 +3444,7 @@ where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo} - + update qc_fqc_record set action_date = getDate(), action_by = #{actionBy}, @@ -3472,12 +3472,12 @@ - + DELETE FROM eam_actual_operator WHERE site = #{site} and order_no = #{inspectionNo} and bu_no = #{buNo} - select distinct site, bu_no, @@ -3490,7 +3490,7 @@ where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo} - select distinct site, bu_no, @@ -3503,7 +3503,7 @@ where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo} and item_no = #{itemNo} - select id, site, @@ -3542,7 +3542,7 @@ and batch_no = (select MAX(batch_no) from Equipment_data_detail where site = #{site} and bu_no = #{buNo} and equipment_no = #{equipmentNo}) - select id, site, @@ -3563,7 +3563,7 @@ and batch_no = (select MAX(batch_no) from Equipment_data_detail where site = #{site} and bu_no = #{buNo} and equipment_no = #{equipmentNo}) - select site as orderRef1, bu_no as orderRef4, @@ -3575,7 +3575,7 @@ and batch_no = (select MAX(batch_no) from Equipment_data_detail where site = #{site} and bu_no = #{buNo} and equipment_no = #{equipmentNo}) - select a.site, a.bu_no, @@ -3591,7 +3591,7 @@ order by a.order_id - select a.site, a.bu_no, @@ -3608,7 +3608,7 @@ - select a.site, a.bu_no, @@ -3624,7 +3624,7 @@ order by a.order_id - select a.site, a.bu_no, @@ -3640,7 +3640,7 @@ order by a.order_id - select b.site, b.bu_no, @@ -3680,7 +3680,7 @@ - select equipment_no from Equipment_folder_location @@ -3688,7 +3688,7 @@ - SELECT operator_id as adminID, operator_name as adminName @@ -3704,14 +3704,14 @@ - select content_desc from qc_collection_data_content where site = #{site} and bu_no = #{buNo} and active = 'Y' - select collection_data_content from eam_properties_item @@ -3719,7 +3719,7 @@ - SELECT a.site, a.bu_no, @@ -3731,7 +3731,7 @@ - SELECT a.site, a.bu_no, @@ -3744,7 +3744,7 @@ - SELECT a.site, a.bu_no, @@ -3787,7 +3787,7 @@ WHERE site = #{site} and bu_no = #{buNo} and ItemNo = #{itemNo} and ObjectID = #{objectID} - select a.site, a.bu_no, @@ -3802,7 +3802,7 @@ order by a.order_id - select a.site, a.bu_no, @@ -3817,7 +3817,7 @@ order by a.order_id - select a.site, a.bu_no, @@ -3832,7 +3832,7 @@ order by a.order_id - select a.site, a.bu_no, @@ -3847,12 +3847,12 @@ order by a.order_id - + delete from Equipment_data_acquisition where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo} - select site, bu_no, @@ -3868,12 +3868,12 @@ where site = #{site} and bu_no = #{buNo} and template_id = #{templateId} and item_no = #{itemNo} - + delete from qc_inspection_standards where site = #{site} and bu_no = #{buNo} and template_id = #{templateId} and item_no = #{itemNo} - + delete from qc_inspection_standards where site = #{site} and bu_no = #{buNo} and template_id = #{templateId} and item_no = #{itemNo} @@ -3887,7 +3887,7 @@ - select site, bu_no, @@ -3909,7 +3909,7 @@ order by order_id - getUpItemdata + getUpItemdata update Equipment_data_detail set inspection_no = #{inspectionNo} where id = #{id} @@ -3921,8 +3921,13 @@ - select top 1 site,bu_no,template_id,ItemNo, - order_id + select + top 1 + site, + bu_no, + template_id, + ItemNo, + order_id from qc_template_detailed where order_id > #{orderId} - and site = #{site} - and bu_no= #{buNo} - and template_id = #{templateId} + and site = #{site} + and bu_no= #{buNo} + and template_id = #{templateId} order by order_id - + update qc_template_detailed set order_id=#{orderId} where site = #{site} - and bu_no= #{buNo} - and template_id = #{templateId} - and ItemNo = #{itemNo} + and bu_no= #{buNo} + and template_id = #{templateId} + and ItemNo = #{itemNo} - SELECT isnull(max(order_id), 0) + 1 from qc_template_detailed - where site = #{site} - and bu_no= #{buNo} - and template_id = #{templateId} + where site = #{site} + and bu_no= #{buNo} + and template_id = #{templateId} + + + + + UPDATE qc_iqc_record + SET submit_flag = 'N', + state = '待检验' + WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo} + + + + UPDATE qc_iqc_detailed_record + SET is_submit = 'N' + WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo} + + + + UPDATE qc_iqc_sub_detail_record + SET is_submit = 'N' + WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo} + + + + delete receiving_task + where site = #{site} and citem_code = #{buNo} and inspection_no = #{inspectionNo} +