From e4a97da59a84a23a4f2c79f1f04432f1fe48e6fb Mon Sep 17 00:00:00 2001 From: zhaoxiaolin Date: Wed, 30 Oct 2024 17:43:09 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/op/system/api/RemoteSapService.java | 3 + .../system/api/domain/sap}/SapWBDemand.java | 2 +- .../api/factory/RemoteSapFallbackFactory.java | 5 + .../op/mes/controller/MesLineController.java | 3 + .../ProBPOrderWorkorderController.java | 2 + .../controller/ProWhiteOrderController.java | 6 + .../plan/mapper/ProOrderWorkorderMapper.java | 2 + .../service/IProOrderWorkorderService.java | 1 + .../plan/service/IProWhiteOrderService.java | 3 + .../impl/ProOrderWorkorderServiceImpl.java | 8 +- .../impl/ProWhiteOrderServiceImpl.java | 78 ++++- .../mapper/plan/ProOrderWorkorderMapper.xml | 18 ++ .../QcCheckTaskIncomeController.java | 12 + .../QcCheckTaskInventoryController.java | 14 +- .../controller/QcStaticTableController.java | 4 +- .../op/quality/domain/InventoryExportDTO.java | 271 ++++++++++++++++++ .../quality/domain/QcCheckTaskInventory.java | 13 +- .../mapper/QcCheckTaskIncomeMapper.java | 2 + .../mapper/QcCheckTypeProjectMapper.java | 2 + .../service/IQcCheckTaskIncomeService.java | 4 + .../impl/QcCheckTaskIncomeServiceImpl.java | 80 ++++++ .../impl/QcStaticTableServiceImpl.java | 3 + .../quality/QcCheckTaskIncomeMapper.xml | 8 + .../quality/QcCheckTaskInventoryMapper.xml | 27 +- .../quality/QcCheckTypeProjectMapper.xml | 6 + .../mapper/quality/QcStaticTableMapper.xml | 4 +- .../op/sap/service/impl/SapItemSyncImpl.java | 3 +- 27 files changed, 560 insertions(+), 24 deletions(-) rename {op-modules/op-sap/src/main/java/com/op/sap/domain/vo => op-api/op-api-system/src/main/java/com/op/system/api/domain/sap}/SapWBDemand.java (96%) create mode 100644 op-modules/op-quality/src/main/java/com/op/quality/domain/InventoryExportDTO.java diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/RemoteSapService.java b/op-api/op-api-system/src/main/java/com/op/system/api/RemoteSapService.java index 98b3f416..a1cdefcd 100644 --- a/op-api/op-api-system/src/main/java/com/op/system/api/RemoteSapService.java +++ b/op-api/op-api-system/src/main/java/com/op/system/api/RemoteSapService.java @@ -25,6 +25,9 @@ public interface RemoteSapService { @PostMapping("/sap/shopOrderSync") public R> shopOrderSync(@RequestBody SapShopOrderQuery sapProOrder); + @PostMapping("/sap/ZmesPurwqGet") + public R zmesPurwqGet(@RequestBody(required = false) Map mapList); + /**传递母订单号和母订单数量**/ @PostMapping("/sap/shopUpdateSync") public R shopUpdateSync(@RequestBody SapShopOrderQuery sapProOrder); diff --git a/op-modules/op-sap/src/main/java/com/op/sap/domain/vo/SapWBDemand.java b/op-api/op-api-system/src/main/java/com/op/system/api/domain/sap/SapWBDemand.java similarity index 96% rename from op-modules/op-sap/src/main/java/com/op/sap/domain/vo/SapWBDemand.java rename to op-api/op-api-system/src/main/java/com/op/system/api/domain/sap/SapWBDemand.java index ed2784fa..1ffd3e0e 100644 --- a/op-modules/op-sap/src/main/java/com/op/sap/domain/vo/SapWBDemand.java +++ b/op-api/op-api-system/src/main/java/com/op/system/api/domain/sap/SapWBDemand.java @@ -1,4 +1,4 @@ -package com.op.sap.domain.vo; +package com.op.system.api.domain.sap; import java.util.Date; diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/factory/RemoteSapFallbackFactory.java b/op-api/op-api-system/src/main/java/com/op/system/api/factory/RemoteSapFallbackFactory.java index 8578ab5f..bf398baa 100644 --- a/op-api/op-api-system/src/main/java/com/op/system/api/factory/RemoteSapFallbackFactory.java +++ b/op-api/op-api-system/src/main/java/com/op/system/api/factory/RemoteSapFallbackFactory.java @@ -23,6 +23,11 @@ public class RemoteSapFallbackFactory implements FallbackFactory mapList) { + return R.fail("SAP服务获取白坯SAP订单失败:" + throwable.getMessage()); + } + @Override public R sapRouterSync(SapRouterQuery sapRouterQuery) { return R.fail("SAP服务同步工艺失败:" + throwable.getMessage()); diff --git a/op-modules/op-mes/src/main/java/com/op/mes/controller/MesLineController.java b/op-modules/op-mes/src/main/java/com/op/mes/controller/MesLineController.java index fc4e81ad..4b4f15f4 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/controller/MesLineController.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/controller/MesLineController.java @@ -62,6 +62,9 @@ public class MesLineController extends BaseController { @PostMapping("/export") public void export(HttpServletResponse response, MesLine mesLine) { List list = mesLineService.selectMesLineList(mesLine); + for(MesLine mline:list){ + mline.setProductCode(mline.getProductCode().substring(7)); + } ExcelUtil util = new ExcelUtil(MesLine. class); util.exportExcel(response, list, "线体管理数据"); } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/controller/ProBPOrderWorkorderController.java b/op-modules/op-plan/src/main/java/com/op/plan/controller/ProBPOrderWorkorderController.java index 9c7375a0..5a410b24 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/controller/ProBPOrderWorkorderController.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/controller/ProBPOrderWorkorderController.java @@ -1,5 +1,6 @@ package com.op.plan.controller; +import com.op.common.core.domain.R; import com.op.common.core.exception.ServiceException; import com.op.common.core.utils.poi.ExcelUtil; import com.op.common.core.web.controller.BaseController; @@ -8,6 +9,7 @@ import com.op.common.core.web.page.TableDataInfo; import com.op.common.log.annotation.Log; import com.op.common.log.enums.BusinessType; import com.op.common.security.annotation.RequiresPermissions; +import com.op.plan.domain.ProOrder; import com.op.plan.domain.ProOrderWorkorder; import com.op.plan.domain.dto.SplitOrderDTO; import com.op.plan.service.IProOrderWorkorderService; diff --git a/op-modules/op-plan/src/main/java/com/op/plan/controller/ProWhiteOrderController.java b/op-modules/op-plan/src/main/java/com/op/plan/controller/ProWhiteOrderController.java index e1293505..43a0d87a 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/controller/ProWhiteOrderController.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/controller/ProWhiteOrderController.java @@ -164,4 +164,10 @@ public class ProWhiteOrderController { orderList.add(example); util.exportExcel(response, orderList, "订单基本信息"); } + + @Log(title = "同步白坯SAP订单", businessType = BusinessType.INSERT) + @PostMapping("/syncSAPbp") + public void syncSAPbp(@RequestBody ProOrder proOrder) { + proWhiteOrderService.syncSAPbp(proOrder); + } } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java index 25a6fdbd..6bdac342 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java @@ -258,5 +258,7 @@ public interface ProOrderWorkorderMapper { List getWorkList(String workorderCode); List getBatchList(String workorderId); + + int bpAddBatch(@Param("list") List orders); } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/IProOrderWorkorderService.java b/op-modules/op-plan/src/main/java/com/op/plan/service/IProOrderWorkorderService.java index 0a88237c..dc15c760 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/IProOrderWorkorderService.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/IProOrderWorkorderService.java @@ -3,6 +3,7 @@ package com.op.plan.service; import com.op.common.core.web.domain.AjaxResult; import com.op.plan.domain.ProLine; +import com.op.plan.domain.ProOrder; import com.op.plan.domain.ProOrderWorkorder; import com.op.plan.domain.ProOrderWorkorderBatch; import com.op.plan.domain.dto.SplitOrderDTO; diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/IProWhiteOrderService.java b/op-modules/op-plan/src/main/java/com/op/plan/service/IProWhiteOrderService.java index 8296e5e4..a2368740 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/IProWhiteOrderService.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/IProWhiteOrderService.java @@ -71,4 +71,7 @@ public interface IProWhiteOrderService { * @return */ AjaxResult getSplitInfo(ProOrder proOrder); + + + public void syncSAPbp(ProOrder proOrder); } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderWorkorderServiceImpl.java b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderWorkorderServiceImpl.java index d655c762..70055aa0 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderWorkorderServiceImpl.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderWorkorderServiceImpl.java @@ -25,10 +25,8 @@ import com.op.system.api.RemoteSapService; import com.op.system.api.domain.SysSapLog; import com.op.system.api.domain.dto.MesPrepareDTO; import com.op.system.api.domain.dto.MesPrepareDetailDTO; -import com.op.system.api.domain.sap.SapCloseOrderQuery; -import com.op.system.api.domain.sap.SapCreateOrder; -import com.op.system.api.domain.sap.SapMaterialPreparation; -import com.op.system.api.domain.sap.SapShopOrderQuery; +import com.op.system.api.domain.sap.*; +import com.op.system.api.model.SapProOrder; import net.bytebuddy.matcher.FilterableList; import org.apache.commons.collections4.ListUtils; import org.apache.commons.lang.StringUtils; @@ -72,6 +70,8 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { private RemoteSapService remoteSapService; @Autowired private ProWetMaterialPlanMapper proWetMaterialPlanMapper; + @Autowired + private ProWhiteOrderMapper proWhiteOrderMapper; /** * 查询生产工单 diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProWhiteOrderServiceImpl.java b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProWhiteOrderServiceImpl.java index df5f1cf8..fdab09a1 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProWhiteOrderServiceImpl.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProWhiteOrderServiceImpl.java @@ -1,8 +1,10 @@ package com.op.plan.service.impl; import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; import com.baomidou.dynamic.datasource.annotation.DS; import com.op.common.core.context.SecurityContextHolder; +import com.op.common.core.domain.R; import com.op.common.core.utils.DateUtils; import com.op.common.core.utils.uuid.IdUtils; import com.op.common.core.web.domain.AjaxResult; @@ -11,10 +13,17 @@ import com.op.plan.domain.vo.CascaderDTO; import com.op.plan.domain.vo.SplitProWhiteOrderVo; import com.op.plan.mapper.*; import com.op.plan.service.IProWhiteOrderService; +import com.op.system.api.RemoteSapService; +import com.op.system.api.domain.quality.HRInfo; +import com.op.system.api.domain.sap.SapWBDemand; +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; @@ -32,7 +41,7 @@ import static com.op.common.core.web.domain.AjaxResult.success; */ @Service public class ProWhiteOrderServiceImpl implements IProWhiteOrderService { - + protected Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private ProWhiteOrderMapper proWhiteOrderMapper; @Autowired @@ -47,7 +56,8 @@ public class ProWhiteOrderServiceImpl implements IProWhiteOrderService { private ProOrderWorkorderBatchMapper proOrderWorkorderBatchMapper; @Autowired private ProWetMaterialPlanDetailMapper proWetMaterialPlanDetailMapper; - + @Autowired + private RemoteSapService remoteSapService; /** * 查询白坯订单管理 * @@ -325,6 +335,70 @@ public class ProWhiteOrderServiceImpl implements IProWhiteOrderService { } } + /** + * 手动同步sap订单 + */ + @Override + @DS("#header.poolName") + public void syncSAPbp(ProOrder proOrder) { + + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String key = "#header.poolName"; + + + Map dataParams = new HashMap<>(); + dataParams.put("werks", request.getHeader(key.substring(8)).replace("ds_","")); + //dataParams.put("werks","1000"); + logger.info("白坯手动订单同步:【参数】" + JSONObject.toJSONString(dataParams)); + //取>=20230923的sap数据 + R rSapProOrder = remoteSapService.zmesPurwqGet(dataParams);//sap只能同步指定日期的数据 + + List sapWBDemandList = JSONArray.parseArray(JSONObject.toJSONString(rSapProOrder.getData()), SapWBDemand.class); + if (CollectionUtils.isEmpty(sapWBDemandList)) { + System.out.println("无最新的白坯订单"); + } else { + logger.info("白坯手动订单同步:【结果】" + JSONObject.toJSONString(sapWBDemandList)); + syncSAPbpFunc(sapWBDemandList, "bpsap"); + } + + } + @Transactional(rollbackFor = Exception.class) + public String syncSAPbpFunc(List newOrders,String syncUser){ + List orders = new ArrayList<>(); + ProOrder proOrder = null; + String bpDD = "DD" + DateUtils.parseDateToStr(DateUtils.YYYYMMDD, DateUtils.getNowDate()); + int m=1; + Date nowDate = DateUtils.getNowDate(); + for (SapWBDemand sapProOrder:newOrders) { + if(StringUtils.isNotBlank(sapProOrder.getMatnr())&&StringUtils.isNotBlank(sapProOrder.getMaktx())){ + //工单生产后整个订单就被锁定//订单存在就更新,不存在就插入 + proOrder = new ProOrder(); + proOrder.setPlanFactoryCode(sapProOrder.getWerks()); + proOrder.setMaterialCode(sapProOrder.getMatnr()); + proOrder.setMaterialName(sapProOrder.getMaktx()); + double menge = sapProOrder.getMenge(); + proOrder.setQuantity((long)menge); + proOrder.setUnit(sapProOrder.getMeins()); + proOrder.setPlanProDate(sapProOrder.getBedat()); + proOrder.setPlanComplete(sapProOrder.getBedat()); + proOrder.setSyncUser(syncUser); + proOrder.setCreateBy(syncUser); + proOrder.setCreateTime(nowDate); + proOrder.setId(IdUtils.fastSimpleUUID()); + proOrder.setStatus("o0"); + proOrder.setOrderType("white"); + proOrder.setProdType("white"); + + int liushuiNum = proWhiteOrderMapper.getTodayMaxNum(proOrder)+(m++); + String liushuiStr = String.format("%04d", liushuiNum); + proOrder.setOrderCode(bpDD + liushuiStr); + orders.add(proOrder); + } + } + int snum = proOrderWorkorderMapper.bpAddBatch(orders); + logger.info("成功条数:"+snum); + return "成功条数:"+snum; + } public static void main(String args[]) { String formatted = String.format("%04d", 7); System.out.println(formatted); diff --git a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml index ee93c1ab..3f8b83cd 100644 --- a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml +++ b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml @@ -916,6 +916,24 @@ ) + + INSERT INTO pro_order ( + id,plan_factory_code,order_type,order_code, + prod_code,prod_desc, + quantity,unit, + plan_pro_date, plan_complete, + create_by,create_time + )VALUES + + ( + #{d.id},#{d.planFactoryCode},#{d.orderType},#{d.orderCode}, + #{d.materialCode},#{d.materialName}, + #{d.quantity},#{d.unit}, + #{d.planProDate},#{d.planComplete}, + #{d.createBy},#{d.createTime} + ) + + update pro_order_workorder diff --git a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckTaskIncomeController.java b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckTaskIncomeController.java index 93435c3c..77042c53 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckTaskIncomeController.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckTaskIncomeController.java @@ -509,4 +509,16 @@ public class QcCheckTaskIncomeController extends BaseController { } return success(); } + + /**应用最新检验方案,重新生成检验任务**/ + @PostMapping(value = "/changeTaskDetail") + public AjaxResult changeTaskDetail(@RequestBody QcCheckTaskIncome task) { + QcCheckTaskIncome taskInfo = qcCheckTaskIncomeService.getTaskInfoByRecordId(task.getRecordId()); + if(taskInfo.getCheckStatus().equals("2")){ + return error("任务已经检验无法重新生成检验任务!"); + } + task.setMaterialCode(taskInfo.getMaterialCode()); + task.setCheckType(taskInfo.getCheckType()); + return toAjax(qcCheckTaskIncomeService.changeTaskDetail(task)); + } } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckTaskInventoryController.java b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckTaskInventoryController.java index 322566ac..b63458d1 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckTaskInventoryController.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckTaskInventoryController.java @@ -2,6 +2,7 @@ package com.op.quality.controller; import java.time.LocalDate; import java.time.format.DateTimeFormatter; +import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServletResponse; @@ -9,8 +10,10 @@ import com.alibaba.fastjson2.JSONObject; import com.op.common.core.domain.R; import com.op.common.core.utils.DateUtils; import com.op.common.core.utils.StringUtils; +import com.op.quality.domain.InventoryExportDTO; import com.op.quality.domain.OACheckTaskDTO; import com.op.quality.domain.QcCheckTaskIncome; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.GetMapping; @@ -71,8 +74,15 @@ public class QcCheckTaskInventoryController extends BaseController { @Log(title = "库存检验任务", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, QcCheckTaskInventory qcCheckTaskInventory) { - List list = qcCheckTaskInventoryService.selectQcCheckTaskInventoryList(qcCheckTaskInventory); - ExcelUtil util = new ExcelUtil(QcCheckTaskInventory.class); + List list0 = qcCheckTaskInventoryService.selectQcCheckTaskInventoryList(qcCheckTaskInventory); + + List list = new ArrayList<>(); + for(QcCheckTaskInventory dto0:list0){ + InventoryExportDTO dto = new InventoryExportDTO(); + BeanUtils.copyProperties(dto0,dto); + list.add(dto); + } + ExcelUtil util = new ExcelUtil(InventoryExportDTO.class); util.exportExcel(response, list, "库存检验任务数据"); } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcStaticTableController.java b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcStaticTableController.java index 8cd962c9..e20eefc4 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcStaticTableController.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcStaticTableController.java @@ -613,7 +613,7 @@ public class QcStaticTableController extends BaseController { //表格结构数据 ArrayList excelCols = new ArrayList<>(); excelCols.add(new ExcelCol("时间", "timeCol", 15)); - excelCols.add(new ExcelCol("抽检数", "sampleQuality", 10)); + excelCols.add(new ExcelCol("抽样数", "sampleQuality", 10)); for (int n = 0; n < title2Cols.size(); n++) { excelCols.add(new ExcelCol(title2Cols.get(n), "col" + (n), 15)); @@ -649,7 +649,7 @@ public class QcStaticTableController extends BaseController { List list = qcStaticTableService.getTableHzDataSC(qcStaticTable); List title2Cols = titledto.getColumns1(); //String titleRow1 = String.join(",", title2Cols); - String titleRow1 = "巡检分析报表"; + String titleRow1 = "来料统计分析"; //表格结构数据 ArrayList excelCols = new ArrayList<>(); excelCols.add(new ExcelCol("时间", "timeCol", 15)); diff --git a/op-modules/op-quality/src/main/java/com/op/quality/domain/InventoryExportDTO.java b/op-modules/op-quality/src/main/java/com/op/quality/domain/InventoryExportDTO.java new file mode 100644 index 00000000..8c8e1b41 --- /dev/null +++ b/op-modules/op-quality/src/main/java/com/op/quality/domain/InventoryExportDTO.java @@ -0,0 +1,271 @@ +package com.op.quality.domain; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.op.common.core.annotation.Excel; +import com.op.common.core.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * 库存检验任务对象 qc_check_task_inventory + * + * @author Open Platform + * @date 2024-01-12 + */ +public class InventoryExportDTO extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * id + */ + private String recordId; + + /** + * 检验任务编号 + */ + @Excel(name = "检验任务编号") + private String checkNo; + + /** + * 订单号 + */ + @Excel(name = "订单号") + private String orderNo; + /** + * 物料号 + */ + @Excel(name = "物料号") + private String materialCode; + + /** + * 物料名称 + */ + @Excel(name = "物料名称") + private String materialName; + + /** + * 收货数量 + */ + @Excel(name = "收货数量") + private BigDecimal quality; + + /** + * 单位 + */ + //@Excel(name = "单位") + private String unit; + + /** + * 供应商编码 + */ + @Excel(name = "仓库编码") + private String supplierCode; + + /** + * 供应商名称 + */ + @Excel(name = "仓库名称") + private String supplierName; + + /** + * 来料时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "入库时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date incomeTime; + + /** + * 检测状态0待检测1检测中2检测完成 + */ + @Excel(name = "检测状态", readConverterExp = "0=待检测,1=检测中,2=检测完成") + private String checkStatus; + + /** + * 检测人工号 + */ + @Excel(name = "检测人工号") + private String checkManCode; + + /** + * 检测人姓名 + */ + @Excel(name = "检测人姓名") + private String checkManName; + + /** + * 检验时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "检验时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date checkTime; + + /** + * 检验结果Y合格 + */ + @Excel(name = "检验结果", readConverterExp = "Y=合格,N=不合格") + private String checkResult; + + + @Excel(name = "检验节点", readConverterExp = "checkTypeCC=库存检验") + private String checkType; + + /** + * 不合格数量 + */ + @Excel(name = "不合格数量") + private BigDecimal noOkQuality; + + /** + * 抽样数量 + */ + @Excel(name = "抽样数量") + private BigDecimal sampleQuality; + + public String getRecordId() { + return recordId; + } + + public void setRecordId(String recordId) { + this.recordId = recordId; + } + + public String getCheckNo() { + return checkNo; + } + + public void setCheckNo(String checkNo) { + this.checkNo = checkNo; + } + + public String getOrderNo() { + return orderNo; + } + + public void setOrderNo(String orderNo) { + this.orderNo = orderNo; + } + + public BigDecimal getSampleQuality() { + return sampleQuality; + } + + public void setSampleQuality(BigDecimal sampleQuality) { + this.sampleQuality = sampleQuality; + } + + public String getMaterialCode() { + return materialCode; + } + + public void setMaterialCode(String materialCode) { + this.materialCode = materialCode; + } + + public String getMaterialName() { + return materialName; + } + + public void setMaterialName(String materialName) { + this.materialName = materialName; + } + + public BigDecimal getQuality() { + return quality; + } + + public void setQuality(BigDecimal quality) { + this.quality = quality; + } + + public String getUnit() { + return unit; + } + + public void setUnit(String unit) { + this.unit = unit; + } + + public String getSupplierCode() { + return supplierCode; + } + + public void setSupplierCode(String supplierCode) { + this.supplierCode = supplierCode; + } + + public String getSupplierName() { + return supplierName; + } + + public void setSupplierName(String supplierName) { + this.supplierName = supplierName; + } + + public Date getIncomeTime() { + return incomeTime; + } + + public void setIncomeTime(Date incomeTime) { + this.incomeTime = incomeTime; + } + + public String getCheckStatus() { + return checkStatus; + } + + public void setCheckStatus(String checkStatus) { + this.checkStatus = checkStatus; + } + + public String getCheckManCode() { + return checkManCode; + } + + public void setCheckManCode(String checkManCode) { + this.checkManCode = checkManCode; + } + + public String getCheckManName() { + return checkManName; + } + + public void setCheckManName(String checkManName) { + this.checkManName = checkManName; + } + + public Date getCheckTime() { + return checkTime; + } + + public void setCheckTime(Date checkTime) { + this.checkTime = checkTime; + } + + public String getCheckResult() { + return checkResult; + } + + public void setCheckResult(String checkResult) { + this.checkResult = checkResult; + } + + public String getCheckType() { + return checkType; + } + + public void setCheckType(String checkType) { + this.checkType = checkType; + } + + public BigDecimal getNoOkQuality() { + return noOkQuality; + } + + public void setNoOkQuality(BigDecimal noOkQuality) { + this.noOkQuality = noOkQuality; + } +} diff --git a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskInventory.java b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskInventory.java index 8668ec6c..64184c0b 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskInventory.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskInventory.java @@ -39,9 +39,10 @@ public class QcCheckTaskInventory extends BaseEntity { /** * 订单号 */ - @Excel(name = "订单号") + @Excel(name = "工单号") private String orderNo; - + @Excel(name = "订单号") + private String workorderCodeSap; /** * 物料号 */ @@ -525,6 +526,14 @@ public class QcCheckTaskInventory extends BaseEntity { this.serialNumber = serialNumber; } + public String getWorkorderCodeSap() { + return workorderCodeSap; + } + + public void setWorkorderCodeSap(String workorderCodeSap) { + this.workorderCodeSap = workorderCodeSap; + } + @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) diff --git a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckTaskIncomeMapper.java b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckTaskIncomeMapper.java index c58ce192..3971ab33 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckTaskIncomeMapper.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckTaskIncomeMapper.java @@ -159,4 +159,6 @@ public interface QcCheckTaskIncomeMapper { void deleteTaskDetail(String deleteIds); void deleteTaskUser(String deleteIds); + + QcCheckTaskIncome getTaskInfoByRecordId(String recordId); } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckTypeProjectMapper.java b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckTypeProjectMapper.java index f1d302eb..8effb62f 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckTypeProjectMapper.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckTypeProjectMapper.java @@ -84,4 +84,6 @@ public interface QcCheckTypeProjectMapper { QcMaterialGroupDetail selectExist(QcMaterialGroupDetail materialGroupDetail); + int clearTaskDetail(String recordId); + int clearTaskDefect(String recordId); } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/IQcCheckTaskIncomeService.java b/op-modules/op-quality/src/main/java/com/op/quality/service/IQcCheckTaskIncomeService.java index 1502f8f0..fae5392f 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/IQcCheckTaskIncomeService.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/IQcCheckTaskIncomeService.java @@ -113,4 +113,8 @@ public interface IQcCheckTaskIncomeService { int commitCheckResultsCg(QcCheckTaskIncome qcCheckTaskIncome); int togetherTask(QcCheckTaskIncome income); + + QcCheckTaskIncome getTaskInfoByRecordId(String recordId); + + int changeTaskDetail(QcCheckTaskIncome task); } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java index c3781f90..ae8cbdc1 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java @@ -26,6 +26,7 @@ import com.op.system.api.domain.SysNoticeGroup; import com.op.system.api.domain.SysUser; import com.op.system.api.domain.dto.WechartDTO; import com.op.system.api.domain.quality.QcCheckTaskIncomeDTO; +import com.op.system.api.domain.quality.QcMaterialGroupDetailDTO; import com.op.system.api.domain.quality.QcUserMaterialDTO; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -870,6 +871,85 @@ public class QcCheckTaskIncomeServiceImpl implements return m; } + @Override + @DS("#header.poolName") + public QcCheckTaskIncome getTaskInfoByRecordId(String recordId) { + return qcCheckTaskIncomeMapper.getTaskInfoByRecordId(recordId); + } + + @Override + @DS("#header.poolName") + public int changeTaskDetail(QcCheckTaskIncome task) { + + //清理检验明细项目 + int dnum1 = qcCheckTypeProjectMapper.clearTaskDetail(task.getRecordId()); + System.out.println("删除1:"+dnum1); + int dnum2 = qcCheckTypeProjectMapper.clearTaskDefect(task.getRecordId()); + System.out.println("删除2:"+dnum2); + + /**取检测项**/ + QcCheckTypeProject qctp= new QcCheckTypeProject(); + qctp.setTypeId(task.getCheckType());//检验节点 + qctp.setMaterialCode(task.getMaterialCode());//特性 + /**qc_check_type_project**///个性 + List items = qcCheckTypeProjectMapper.getTPByTypeMaterial(qctp); + /**qc_material_group_detail**/ + QcMaterialGroupDetail group = qcMaterialGroupDetailMapper.getGroupByMaterial(task.getMaterialCode()); + //共性 + if(group == null){//默认 + if(task.getCheckType().equals("checkTypeLL")){ + group = new QcMaterialGroupDetail(); + QcProjectType initGroup = qcCheckTypeProjectMapper.getProductGroup(task.getMaterialCode()); + if(initGroup != null){ + group.setGroupId(initGroup.getGroupId()); + }else{ + return 0;//没有找到检测项目 + } + }else if(task.getCheckType().equals("checkTypeSCXJ") + ||task.getCheckType().equals("checkTypeSC") + ||task.getCheckType().equals("checkTypeCP")){ + group = new QcMaterialGroupDetail(); + group.setGroupId("3dc0655fea3449c59c76a01cc5b91565");//成品蚊香物料组 + }else if(task.getCheckType().equals("checkTypeCC")){ + group = new QcMaterialGroupDetail(); + QcProjectType initGroup = qcCheckTypeProjectMapper.getProductGroup(task.getMaterialCode()); + if(initGroup != null){//包材共性 + group.setGroupId(initGroup.getGroupId()); + }else{//成品共性 + group.setGroupId("3dc0655fea3449c59c76a01cc5b91565"); + } + } + } + List itemsGG = new ArrayList<>(); + if(StringUtils.isNotBlank(group.getGroupId())){ + qctp.setGroupId(group.getGroupId()); + itemsGG = qcCheckTypeProjectMapper.getTPByTypeGroup(qctp); + } + items.addAll(itemsGG); + + /**qc_check_task_detail**/ + if(CollectionUtils.isEmpty(items)){ + logger.info("检验任务创建参数缺失:"+task.getMaterialCode()); + return 0;//没有找到检测项目 + } + /**qc_check_task_detail**/ + Date nowDate = DateUtils.getNowDate(); + String createBy = SecurityUtils.getUsername(); + //获取当前所选工厂 + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String key = "#header.poolName"; + String factoryCode = request.getHeader(key.substring(8)).replace("ds_",""); + for(QcCheckTaskDetail item:items){ + item.setRecordId(IdUtils.fastSimpleUUID()); + item.setBelongTo(task.getRecordId()); + item.setCreateTime(nowDate); + item.setCreateBy(createBy); + item.setFactoryCode(factoryCode); + item.setStatus("Y"); + } + return qcCheckTaskDetailMapper.addBatch(items); + } + @Override //@Transactional(rollbackFor = Exception.class) public int commitCheckResults(QcCheckTaskIncome qcCheckTaskIncome) { diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcStaticTableServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcStaticTableServiceImpl.java index c1484de1..84038bf8 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcStaticTableServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcStaticTableServiceImpl.java @@ -1125,9 +1125,12 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService { BigDecimal noOkRate = new BigDecimal(sampl.getNoOkQuality()).multiply(new BigDecimal("100.00")) .divide(new BigDecimal(sampl.getSampleQuality()),2, BigDecimal.ROUND_HALF_UP); colMap.put("noOkRate",noOkRate); + colMap.put("noOkQua",sampl.getNoOkQuality()); + }else{ colMap.put("sampleQuality","0"); colMap.put("noOkRate","0"); + colMap.put("noOkQua","0"); } //不良数(不折算) Map noOks = qcStaticTableMapper.getNoOkPCNum(qcStaticTable); diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskIncomeMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskIncomeMapper.xml index 9f58eaa0..a9b77507 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskIncomeMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskIncomeMapper.xml @@ -861,6 +861,14 @@ where qct.record_id in(${ids}) order by qct.check_no desc + diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskInventoryMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskInventoryMapper.xml index fc6fc6d9..11b2b9be 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskInventoryMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskInventoryMapper.xml @@ -41,6 +41,8 @@ + + @@ -54,7 +56,8 @@ @@ -301,7 +310,9 @@ t0.supplierName, t0.check_Type from (--> - select t.order_no orderNo, + select + SUBSTRING(pow.workorder_code_sap,4,10) workorderCodeSap, + t.order_no orderNo, t.material_code materialCode, t.material_name materialName, t.quality quality, @@ -317,14 +328,14 @@ left join ( select order_no,material_code,max(create_time) create_time from qc_check_task where check_type='checkTypeCC' and del_flag = '0' GROUP BY order_no,material_code - ) qct on qct.order_no = t.order_no - and t.material_code = qct.material_code - where bp.warehouse_cycle is not null and t.check_type in('checkTypeLL','checkTypeCP') and t.del_flag = '0' + ) qct on qct.order_no = t.order_no and t.material_code = qct.material_code + left join pro_order_workorder pow on pow.workorder_code = qct.order_no + where bp.warehouse_cycle is not null and t.check_type in('checkTypeLL','checkTypeCP') and t.del_flag = '0' and pow.del_flag = '0' and t.material_code like concat('%',#{materialCode}, '%') and t.material_name like concat('%',#{materialName}, '%') and t.order_no like concat('%',#{orderNo}, '%') - - order by t.income_time desc,t.order_no,t.material_code + and pow.workorder_code_sap like concat('%',#{workorderCodeSap},'%') + order by t.income_time desc,t.order_no,t.material_code diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTypeProjectMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTypeProjectMapper.xml index 82bc7ed1..5ce06a85 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTypeProjectMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTypeProjectMapper.xml @@ -271,6 +271,12 @@ #{id} + + delete from qc_check_task_detail where belong_to = #{recordId} + + + delete from qc_check_task_defect where belong_to = #{recordId} + @@ -1020,6 +1021,7 @@ left join base_equipment be on be.equipment_code = qct.check_loc where qct.check_type = 'checkTypeSCXJ' and qct.del_flag = '0' and qct.check_status = '2' and be.del_flag = '0' and pow.del_flag = '0' and qct.check_no like concat('%',#{orderNo},'%') + and pow.workorder_code_sap like concat('%',#{workorderCodeSap},'%') and qct.material_code like concat('%',#{materialCode},'%') and qct.income_batch_no like concat('%',#{incomeBatchNo},'%') and CONVERT(varchar(10),pow.product_date, 120) = #{incomeTimeStr} diff --git a/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapItemSyncImpl.java b/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapItemSyncImpl.java index 83d9b05f..3a837677 100644 --- a/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapItemSyncImpl.java +++ b/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapItemSyncImpl.java @@ -10,7 +10,7 @@ import com.op.common.core.utils.StringUtils; import com.op.common.core.utils.bean.BeanValidators; import com.op.common.core.utils.uuid.IdUtils; import com.op.common.security.utils.SecurityUtils; -import com.op.sap.domain.vo.SapWBDemand; +import com.op.system.api.domain.sap.SapWBDemand; import com.op.system.api.domain.quality.QcCheckTaskIncomeDTO; import com.op.system.api.domain.sap.SapBackflushMPQuery; import com.op.sap.domain.vo.SapItemQuery; @@ -25,7 +25,6 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.stereotype.Service; -import org.springframework.web.bind.annotation.RequestBody; import javax.validation.Validator; import java.math.BigDecimal;