From 8f6330c1c66b0d20d2cf522bd0ce586a0184e70a Mon Sep 17 00:00:00 2001 From: mengjiao <3338049200@qq,com> Date: Wed, 12 Jun 2024 16:34:37 +0800 Subject: [PATCH 1/3] =?UTF-8?q?wms=E6=88=90=E5=93=81=E9=80=80=E8=B4=A7?= =?UTF-8?q?=E6=8F=90=E5=8D=95=E4=BF=AE=E6=94=B92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WmsToWCSmissionController.java | 18 +-- .../impl/WmsProductPutServiceImpl.java | 124 +++++++++--------- 2 files changed, 71 insertions(+), 71 deletions(-) diff --git a/op-modules/op-wms/src/main/java/com/op/wms/controller/WmsToWCSmissionController.java b/op-modules/op-wms/src/main/java/com/op/wms/controller/WmsToWCSmissionController.java index 77ffba98..b0742daf 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/controller/WmsToWCSmissionController.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/controller/WmsToWCSmissionController.java @@ -342,14 +342,7 @@ public class WmsToWCSmissionController { return AjaxResult.success(wmsProductPutService.selectFinishedProductSales(wmsSellOutEmbryo)); } - /** - * 成品销售退货--提单查询接口 - * - */ - @PostMapping("/finishedProductSalesReturnTD") - public AjaxResult finishedProductSalesReturnTD(@RequestBody WmsRuturnPutEmbryo wmsRuturnPutEmbryo) { - return AjaxResult.success(wmsProductPutService.finishedProductSalesReturnTD(wmsRuturnPutEmbryo)); - } + /** * 成品销售出库--确认接口 @@ -377,7 +370,14 @@ public class WmsToWCSmissionController { return AjaxResult.success(wmsProductPutService.ScanCodeSingleBox(wmsProductPutTrayCode)); } - + /** + * 成品销售退货--提单查询接口 + * + */ + @PostMapping("/finishedProductSalesReturnTD") + public AjaxResult finishedProductSalesReturnTD(@RequestBody WmsRuturnPutEmbryo wmsRuturnPutEmbryo) { + return AjaxResult.success(wmsProductPutService.finishedProductSalesReturnTD(wmsRuturnPutEmbryo)); + } /** * 成品销售退货--查询接口 diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/WmsProductPutServiceImpl.java b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/WmsProductPutServiceImpl.java index 8b52e18a..eb365e37 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/WmsProductPutServiceImpl.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/WmsProductPutServiceImpl.java @@ -908,7 +908,67 @@ public class WmsProductPutServiceImpl implements IWmsProductPutService { List wmsSellOutEmbryoList= wmsSellOutEmbryoMapper.selectWmsSellOutEmbryoList(wmsSellOutEmbryo); return wmsSellOutEmbryoList; } - + @Override + public String finishedProductSalesReturnTD(WmsRuturnPutEmbryo wmsRuturnPutEmbryo) { + String results="提单成功";//退货单 + DynamicDataSourceContextHolder.push("ds_" + wmsRuturnPutEmbryo.getFactoryCode()); + Map objectMap=new HashMap<>(); + objectMap.put("S_MATNR",wmsRuturnPutEmbryo.getProductCode());//物料号, + objectMap.put("S_TDDAT",wmsRuturnPutEmbryo.getAttr1());//String 计划运输日期 + objectMap.put("S_VBELN",wmsRuturnPutEmbryo.getProductOrder());//成品销售退货单 + objectMap.put("S_AUART","ZRE"); + R result = remoteSapService.FPinventory(objectMap); + int code = result.getCode(); + String msg = result.getMsg(); + if(code==200){ + List> mapList= (List>) result.getData(); + for ( Map stringStringMap: mapList){ + String MAKTX=stringStringMap.get("MAKTX");//物料描述 + String MATNR=stringStringMap.get("MATNR");//物料号 + String KUNNR=stringStringMap.get("KUNNR");//送达方 + String VBELN=stringStringMap.get("VBELN");//交货单---一销售单对多交货单 + String VBELN_VA=stringStringMap.get("VBELN_VA");//销售单 + String MENGE=stringStringMap.get("MENGE");//数量 + String MEINS=stringStringMap.get("MEINS");//单位 + String TDDAT=stringStringMap.get("TDDAT");//计划日期 + String KUNNR_NM=stringStringMap.get("KUNNR_NM");//送达方描述 + String LIFNR=stringStringMap.get("LIFNR");//货运代理 + String LIFNR_NM=stringStringMap.get("LIFNR_NM");//货运代理描述 + String ZSAREA=stringStringMap.get("ZSAREA");//销售大区 + String BZTXT1=stringStringMap.get("BZTXT1");//销售大区描述 + WmsSellOutEmbryo wmsSellOutEmbryo1=new WmsSellOutEmbryo(); + wmsSellOutEmbryo1.setId(IdUtils.fastSimpleUUID()); + wmsSellOutEmbryo1.setDeliveryOrder(VBELN);//交货单号 + wmsSellOutEmbryo1.setAttr1(VBELN_VA); + wmsSellOutEmbryo1.setProductCode(MATNR); + wmsSellOutEmbryo1.setProductName(MAKTX); + wmsSellOutEmbryo1.setFactoryCode(wmsRuturnPutEmbryo.getFactoryCode()); + wmsSellOutEmbryo1.setOutQuantity(new BigDecimal("0")); + wmsSellOutEmbryo1.setAttr2(KUNNR); + wmsSellOutEmbryo1.setAttr3(KUNNR_NM); + wmsSellOutEmbryo1.setAttr4(LIFNR); + wmsSellOutEmbryo1.setAttr5(LIFNR_NM); + wmsSellOutEmbryo1.setAttr6(ZSAREA); + wmsSellOutEmbryo1.setAttr7(BZTXT1); + wmsSellOutEmbryo1.setAttr8(TDDAT); + wmsSellOutEmbryo1.setPlanQuantity(new BigDecimal(MENGE)); + wmsSellOutEmbryo1.setUnitOfMeasure(MEINS); + wmsSellOutEmbryo1.setStatus("0"); + wmsSellOutEmbryo1.setSapStatus("0"); + wmsSellOutEmbryo1.setActiveFlag("1"); + wmsSellOutEmbryo1.setCreateBy(wmsRuturnPutEmbryo.getCreateBy()); + wmsSellOutEmbryo1.setCreateTime(new Date()); + //用行项目和订单进行判断 + // WmsSellOutEmbryo wmsSellOutEmbryo2= wmsRuturnPutEmbryoMapper.selectWmsRuturnPutEmbryo(VBELN,MATNR); +// if (wmsSellOutEmbryo2==null){ +// wmsSellOutEmbryoMapper.insertWmsSellOutEmbryo(wmsSellOutEmbryo1); +// }else { +// results="已经存在"; +// } + } + } + return results; + } @Override public List FinishedProductSalesReturn(WmsRuturnPutEmbryo wmsRuturnPutEmbryo) { DynamicDataSourceContextHolder.push("ds_" + wmsRuturnPutEmbryo.getFactoryCode()); @@ -1146,67 +1206,7 @@ public class WmsProductPutServiceImpl implements IWmsProductPutService { return wmsRuturnPutEmbryoMapper.selectWmsRuturnPutEmbryoList(wmsRuturnPutEmbryo); } - @Override - public String finishedProductSalesReturnTD(WmsRuturnPutEmbryo wmsRuturnPutEmbryo) { - String results="提单成功";//退货单 - DynamicDataSourceContextHolder.push("ds_" + wmsRuturnPutEmbryo.getFactoryCode()); - Map objectMap=new HashMap<>(); - objectMap.put("S_MATNR",wmsRuturnPutEmbryo.getProductCode());//物料号, - objectMap.put("S_TDDAT",wmsRuturnPutEmbryo.getAttr1());//String 计划运输日期 - objectMap.put("S_VBELN",wmsRuturnPutEmbryo.getProductOrder());//成品销售退货单 - objectMap.put("S_AUART","ZRE");//销售退货凭证 - R result = remoteSapService.FPinventory(objectMap); - int code = result.getCode(); - String msg = result.getMsg(); - if(code==200){ - List> mapList= (List>) result.getData(); - for ( Map stringStringMap: mapList){ - String MAKTX=stringStringMap.get("MAKTX");//物料描述 - String MATNR=stringStringMap.get("MATNR");//物料号 - String KUNNR=stringStringMap.get("KUNNR");//送达方 - String VBELN=stringStringMap.get("VBELN");//交货单---一销售单对多交货单 - String VBELN_VA=stringStringMap.get("VBELN_VA");//销售单 - String MENGE=stringStringMap.get("MENGE");//数量 - String MEINS=stringStringMap.get("MEINS");//单位 - String TDDAT=stringStringMap.get("TDDAT");//计划日期 - String KUNNR_NM=stringStringMap.get("KUNNR_NM");//送达方描述 - String LIFNR=stringStringMap.get("LIFNR");//货运代理 - String LIFNR_NM=stringStringMap.get("LIFNR_NM");//货运代理描述 - String ZSAREA=stringStringMap.get("ZSAREA");//销售大区 - String BZTXT1=stringStringMap.get("BZTXT1");//销售大区描述 - WmsSellOutEmbryo wmsSellOutEmbryo1=new WmsSellOutEmbryo(); - wmsSellOutEmbryo1.setId(IdUtils.fastSimpleUUID()); - wmsSellOutEmbryo1.setDeliveryOrder(VBELN);//交货单号 - wmsSellOutEmbryo1.setAttr1(VBELN_VA); - wmsSellOutEmbryo1.setProductCode(MATNR); - wmsSellOutEmbryo1.setProductName(MAKTX); - wmsSellOutEmbryo1.setFactoryCode(wmsRuturnPutEmbryo.getFactoryCode()); - wmsSellOutEmbryo1.setOutQuantity(new BigDecimal("0")); - wmsSellOutEmbryo1.setAttr2(KUNNR); - wmsSellOutEmbryo1.setAttr3(KUNNR_NM); - wmsSellOutEmbryo1.setAttr4(LIFNR); - wmsSellOutEmbryo1.setAttr5(LIFNR_NM); - wmsSellOutEmbryo1.setAttr6(ZSAREA); - wmsSellOutEmbryo1.setAttr7(BZTXT1); - wmsSellOutEmbryo1.setAttr8(TDDAT); - wmsSellOutEmbryo1.setPlanQuantity(new BigDecimal(MENGE)); - wmsSellOutEmbryo1.setUnitOfMeasure(MEINS); - wmsSellOutEmbryo1.setStatus("0"); - wmsSellOutEmbryo1.setSapStatus("0"); - wmsSellOutEmbryo1.setActiveFlag("1"); - wmsSellOutEmbryo1.setCreateBy(wmsRuturnPutEmbryo.getCreateBy()); - wmsSellOutEmbryo1.setCreateTime(new Date()); - //判断有没有这个单子,。如果有的话,就跳过吧 - WmsSellOutEmbryo wmsSellOutEmbryo2= wmsSellOutEmbryoMapper.selectWmsSellOutEmbryoByOrderCodeAndProductCode(VBELN,MATNR); -// if (wmsSellOutEmbryo2==null){ -// wmsSellOutEmbryoMapper.insertWmsSellOutEmbryo(wmsSellOutEmbryo1); -// }else { -// results="已经存在"; -// } - } - } - return results; - } + //去除空格,截取规则,例子:20270106LJ20240107CBCD0J——》240107CBCD From 0cad2248e7210cb760e808d202a81f7a04da9c11 Mon Sep 17 00:00:00 2001 From: A0010407 Date: Wed, 12 Jun 2024 17:01:01 +0800 Subject: [PATCH 2/3] =?UTF-8?q?2024-06-12=20=E8=AE=BE=E5=A4=87-=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E9=A1=B9=E7=BB=B4=E6=8A=A4-=E5=AF=BC=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/EquCheckItemController.java | 85 ++++ .../domain/vo/EquCheckItemImportVO.java | 470 ++++++++++++++++++ .../mapper/EquCheckItemDetailMapper.java | 1 + .../op/device/mapper/EquCheckItemMapper.java | 4 + .../device/service/IEquCheckItemService.java | 3 + .../service/impl/EquCheckItemServiceImpl.java | 191 ++++++- .../device/EquCheckItemDetailMapper.xml | 6 + .../mapper/device/EquCheckItemMapper.xml | 5 + 8 files changed, 764 insertions(+), 1 deletion(-) create mode 100644 op-modules/op-device/src/main/java/com/op/device/domain/vo/EquCheckItemImportVO.java diff --git a/op-modules/op-device/src/main/java/com/op/device/controller/EquCheckItemController.java b/op-modules/op-device/src/main/java/com/op/device/controller/EquCheckItemController.java index db6dcd81..c28e48ac 100644 --- a/op-modules/op-device/src/main/java/com/op/device/controller/EquCheckItemController.java +++ b/op-modules/op-device/src/main/java/com/op/device/controller/EquCheckItemController.java @@ -1,12 +1,20 @@ package com.op.device.controller; +import java.io.IOException; +import java.util.ArrayList; import java.util.List; +import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; +import com.op.common.core.domain.ExcelCol; +import com.op.common.core.utils.poi.ExcelMapUtil; import com.op.device.domain.EquRepairOrder; +import com.op.device.domain.SparePartsLedger; import com.op.device.domain.WorkCenter; import com.op.device.domain.dto.EquCheckItemDTO; import com.op.device.domain.dto.SummaryReportDTO; +import com.op.device.domain.vo.EquCheckItemImportVO; +import org.apache.poi.xssf.streaming.SXSSFWorkbook; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -25,6 +33,7 @@ import com.op.common.core.web.controller.BaseController; import com.op.common.core.web.domain.AjaxResult; import com.op.common.core.utils.poi.ExcelUtil; import com.op.common.core.web.page.TableDataInfo; +import org.springframework.web.multipart.MultipartFile; /** * 检查项维护Controller @@ -149,4 +158,80 @@ public class EquCheckItemController extends BaseController { public AjaxResult selectMatchListByEquipmentCode(SummaryReportDTO summaryReportDTO) { return equCheckItemService.selectMatchListByEquipmentCode(summaryReportDTO); } + +// /** +// * 导出检查项汇总列表 +// */ +// @RequiresPermissions("device:summaryReport:export") +// @Log(title = "导出检查项汇总列表", businessType = BusinessType.EXPORT) +// @PostMapping("/summaryExport") +// public void summaryExport(HttpServletResponse response, EquCheckItem equCheckItem) { +// List list = equCheckItemService.selectEquCheckItemList(equCheckItem); +// ExcelUtil util = new ExcelUtil(EquCheckItem.class); +// util.exportExcel(response, list, "检查项维护数据"); +// } + + /** + * 导入检查项基本信息接口 + * + * @param file + * @return + * @throws Exception + */ + @Log(title = "导入检查项基本信息", businessType = BusinessType.IMPORT) + @PostMapping("/importFile") + @RequiresPermissions("device:item:import") + public AjaxResult importFile(MultipartFile file) throws Exception { + // 创建接收对象 + ExcelUtil util = new ExcelUtil<>(EquCheckItemImportVO.class); + // 接收表格信息 + List list = util.importExcel(file.getInputStream()); + return equCheckItemService.importFile(list); + } + + /** + * 生成设备信息模板 + * + * @param response + * @throws IOException + */ + @PostMapping("/importTemplate") + @Log(title = "生成检查项信息模板", businessType = BusinessType.EXPORT) + public void importTemplate(HttpServletResponse response) throws IOException { + + ArrayList excelCols = new ArrayList<>(); + excelCols.add(new ExcelCol("检查项编码(11位,年月日加流水号,例如:20240601001)", "itemCode", 20)); + excelCols.add(new ExcelCol("检查项详情编码(14位,检查项编码加流水号,例如:20240601001001)", "detailCode", 20)); + excelCols.add(new ExcelCol("部位(检查项名称)", "itemName", 20)); + excelCols.add(new ExcelCol("检查方法", "itemMethod", 20)); + excelCols.add(new ExcelCol("检查工具", "itemTools", 20)); + excelCols.add(new ExcelCol("周期(数字)", "itemLoop", 20)); + excelCols.add(new ExcelCol("周期类型(填:日、周、月、季、年)", "itemLoopType", 20)); +// excelCols.add(new ExcelCol("维护类型编码", "itemType", 20)); + excelCols.add(new ExcelCol("维护类型名称(填:保养、巡检、点检)", "itemTypeName", 20)); + excelCols.add(new ExcelCol("标准类型(填:定性或定量)", "standardType", 20)); + excelCols.add(new ExcelCol("标准名称", "standardName", 20)); + excelCols.add(new ExcelCol("上限", "detailUpLimit", 20)); + excelCols.add(new ExcelCol("下限", "detailDownLimit", 20)); + excelCols.add(new ExcelCol("单位", "detailUnit", 20)); + + String titleName = "检查项信息导入"; + SXSSFWorkbook workbook = null; + try { + //设置响应头 + response.setHeader("Content-disposition", + "attachment; filename=" + titleName); + response.setContentType("application/octet-stream;charset=UTF-8"); + ServletOutputStream outputStream = response.getOutputStream(); + //调用工具类 + workbook = ExcelMapUtil.initWorkbook(titleName, null, excelCols, null); + workbook.write(outputStream); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (workbook != null) { + workbook.dispose(); + } + } + } } diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/vo/EquCheckItemImportVO.java b/op-modules/op-device/src/main/java/com/op/device/domain/vo/EquCheckItemImportVO.java new file mode 100644 index 00000000..5f2bdaef --- /dev/null +++ b/op-modules/op-device/src/main/java/com/op/device/domain/vo/EquCheckItemImportVO.java @@ -0,0 +1,470 @@ +package com.op.device.domain.vo; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.op.common.core.annotation.Excel; +import com.op.common.core.web.domain.BaseEntity; + +/** + * 检查项维护导入对象 + */ +public class EquCheckItemImportVO extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String itemId; + + /** + * 检查项编码 + */ + @Excel(name = "检查项编码(11位,年月日加流水号,例如:20240601001)") + private String itemCode; + + /** + * 检查项名称 + */ + @Excel(name = "部位(检查项名称)") + private String itemName; + + /** + * 检查项方法 + */ + @Excel(name = "检查方法") + private String itemMethod; + + /** + * 维护类型编码 + */ + @Excel(name = "维护类型编码") + private String itemType; + + /** + * 维护类型名称 + */ + @Excel(name = "维护类型名称(填:保养、巡检、点检)") + private String itemTypeName; + + // 检查项工具 + @Excel(name = "检查工具") + private String itemTools; + + // 循环周期类型 + @Excel(name = "周期类型(填:日、周、月、季、年)") + private String itemLoopType; + + // 循环周期 + @Excel(name = "周期(数字)") + private String itemLoop; + + /** + * 检查项备注 + */ + @Excel(name = "检查项备注") + private String itemRemark; + + /** + * 工厂 + */ + @Excel(name = "工厂") + private String factoryCode; + + /** + * 备用字段1 + */ + private String attr1; + + /** + * 备用字段2 + */ + private String attr2; + + /** + * 备用字段3 + */ + private String attr3; + + /** + * 删除标识 + */ + private String delFlag; + + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date createTime; + + /** + * 创建人 + */ + @Excel(name = "创建人") + private String createBy; + + /** + * 更新时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date updateTime; + + /** + * 更新人 + */ + @Excel(name = "更新人") + private String updateBy; + + // 创建日期范围list + private List createTimeArray; + + // 更新日期范围list + private List updateTimeArray; + + // 更新日期开始 + private String updateTimeStart; + + // 更新日期结束 + private String updateTimeEnd; + + + + /////////////////////////////////////导入用 + /** + * 主键 + */ + private String detailId; + + /** + * 详情编码 + */ + @Excel(name = "检查项详情编码(14位,检查项编码加流水号,例如:20240601001001)") + private String detailCode; + + /** + * 主检查项编码 + */ + @Excel(name = "主检查项编码") + private String parentCode; + + //标准类型 + @Excel(name = "标准类型(填:定性或定量)") + private String standardType; + + //标准名称 + @Excel(name = "标准名称") + private String standardName; + + //上限 + @Excel(name = "上限") + private BigDecimal detailUpLimit; + + //下限 + @Excel(name = "下限") + private BigDecimal detailDownLimit; + + //单位 + @Excel(name = "单位") + private String detailUnit; + + public String getItemLoop() { + return itemLoop; + } + + public void setItemLoop(String itemLoop) { + this.itemLoop = itemLoop; + } + + public String getItemLoopType() { + return itemLoopType; + } + + public void setItemLoopType(String itemLoopType) { + this.itemLoopType = itemLoopType; + } + + public String getItemTools() { + return itemTools; + } + + public void setItemTools(String itemTools) { + this.itemTools = itemTools; + } + + public List getUpdateTimeArray() { + return updateTimeArray; + } + + public void setUpdateTimeArray(List updateTimeArray) { + this.updateTimeArray = updateTimeArray; + } + + public String getUpdateTimeStart() { + return updateTimeStart; + } + + public void setUpdateTimeStart(String updateTimeStart) { + this.updateTimeStart = updateTimeStart; + } + + public String getUpdateTimeEnd() { + return updateTimeEnd; + } + + public void setUpdateTimeEnd(String updateTimeEnd) { + this.updateTimeEnd = updateTimeEnd; + } + + // 创建日期开始 + private String createTimeStart; + + // 创建日期结束 + private String createTimeEnd; + + public String getCreateTimeStart() { + return createTimeStart; + } + + public void setCreateTimeStart(String createTimeStart) { + this.createTimeStart = createTimeStart; + } + + public String getCreateTimeEnd() { + return createTimeEnd; + } + + public void setCreateTimeEnd(String createTimeEnd) { + this.createTimeEnd = createTimeEnd; + } + + public List getCreateTimeArray() { + return createTimeArray; + } + + public void setCreateTimeArray(List createTimeArray) { + this.createTimeArray = createTimeArray; + } + + public void setItemId(String itemId) { + this.itemId = itemId; + } + + public String getItemId() { + return itemId; + } + + public void setItemCode(String itemCode) { + this.itemCode = itemCode; + } + + public String getItemCode() { + return itemCode; + } + + public void setItemName(String itemName) { + this.itemName = itemName; + } + + public String getItemName() { + return itemName; + } + + public void setItemMethod(String itemMethod) { + this.itemMethod = itemMethod; + } + + public String getItemMethod() { + return itemMethod; + } + + public void setItemType(String itemType) { + this.itemType = itemType; + } + + public String getItemType() { + return itemType; + } + + public void setItemTypeName(String itemTypeName) { + this.itemTypeName = itemTypeName; + } + + public String getItemTypeName() { + return itemTypeName; + } + + public void setItemRemark(String itemRemark) { + this.itemRemark = itemRemark; + } + + public String getItemRemark() { + return itemRemark; + } + + public void setFactoryCode(String factoryCode) { + this.factoryCode = factoryCode; + } + + public String getFactoryCode() { + return factoryCode; + } + + public void setAttr1(String attr1) { + this.attr1 = attr1; + } + + public String getAttr1() { + return attr1; + } + + public void setAttr2(String attr2) { + this.attr2 = attr2; + } + + public String getAttr2() { + return attr2; + } + + public void setAttr3(String attr3) { + this.attr3 = attr3; + } + + public String getAttr3() { + return attr3; + } + + public void setDelFlag(String delFlag) { + this.delFlag = delFlag; + } + + public String getDelFlag() { + return delFlag; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + public String getCreateBy() { + return createBy; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateBy(String updateBy) { + this.updateBy = updateBy; + } + + public String getUpdateBy() { + return updateBy; + } + + /////////导入用 + + public void setDetailId(String detailId) { + this.detailId = detailId; + } + + public String getDetailId() { + return detailId; + } + + public String getDetailCode() { + return detailCode; + } + + public void setDetailCode(String detailCode) { + this.detailCode = detailCode; + } + + public void setDetailUpLimit(BigDecimal detailUpLimit) { + this.detailUpLimit = detailUpLimit; + } + + public BigDecimal getDetailUpLimit() { + return detailUpLimit; + } + + public void setDetailDownLimit(BigDecimal detailDownLimit) { + this.detailDownLimit = detailDownLimit; + } + + public BigDecimal getDetailDownLimit() { + return detailDownLimit; + } + + public void setDetailUnit(String detailUnit) { + this.detailUnit = detailUnit; + } + + public String getDetailUnit() { + return detailUnit; + } + + public void setStandardType(String standardType) { + this.standardType = standardType; + } + + public String getStandardType() { + return standardType; + } + + public void setStandardName(String standardName) { + this.standardName = standardName; + } + + public String getStandardName() { + return standardName; + } + + public void setParentCode(String parentCode) { + this.parentCode = parentCode; + } + + public String getParentCode() { + return parentCode; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("itemId", getItemId()) + .append("itemCode", getItemCode()) + .append("itemName", getItemName()) + .append("itemMethod", getItemMethod()) + .append("itemType", getItemType()) + .append("itemTypeName", getItemTypeName()) + .append("itemRemark", getItemRemark()) + .append("factoryCode", getFactoryCode()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("delFlag", getDelFlag()) + .append("createTime", getCreateTime()) + .append("createBy", getCreateBy()) + .append("updateTime", getUpdateTime()) + .append("updateBy", getUpdateBy()) + .append("createTimeArray", getCreateTimeArray()) + .toString(); + } +} diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquCheckItemDetailMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquCheckItemDetailMapper.java index b66b58bd..2c418785 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/EquCheckItemDetailMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquCheckItemDetailMapper.java @@ -100,4 +100,5 @@ public interface EquCheckItemDetailMapper { */ List selectCheckItemDetailByItemCode(String itemCode); + EquCheckItemDetail selectExistByDetailCode(String detailCode); } diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquCheckItemMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquCheckItemMapper.java index 7530187a..7343d941 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/EquCheckItemMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquCheckItemMapper.java @@ -3,9 +3,11 @@ package com.op.device.mapper; import java.util.List; import com.op.device.domain.EquCheckItem; +import com.op.device.domain.EquCheckItemDetail; import com.op.device.domain.EquPlanDetail; import com.op.device.domain.WorkCenter; import com.op.device.domain.dto.SummaryReportDTO; +import com.op.device.domain.vo.EquCheckItemImportVO; import com.op.device.domain.vo.EquCheckItemVO; import org.apache.ibatis.annotations.Param; @@ -127,4 +129,6 @@ public interface EquCheckItemMapper { * @return */ List selectMatchListByEquipmentCode(SummaryReportDTO summaryReportDTO); + + EquCheckItem selectExistByItemCode(String itemCode); } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/IEquCheckItemService.java b/op-modules/op-device/src/main/java/com/op/device/service/IEquCheckItemService.java index a7c83f6e..7d5f4a3b 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/IEquCheckItemService.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/IEquCheckItemService.java @@ -7,6 +7,7 @@ import com.op.device.domain.EquCheckItem; import com.op.device.domain.EquRepairOrder; import com.op.device.domain.dto.EquCheckItemDTO; import com.op.device.domain.dto.SummaryReportDTO; +import com.op.device.domain.vo.EquCheckItemImportVO; import com.op.device.domain.vo.EquCheckItemVO; /** @@ -98,4 +99,6 @@ public interface IEquCheckItemService { * @return */ public AjaxResult selectMatchListByEquipmentCode(SummaryReportDTO summaryReportDTO); + + AjaxResult importFile(List list); } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java index fdbab580..63c3ce42 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java @@ -9,14 +9,19 @@ import java.util.List; import com.baomidou.dynamic.datasource.annotation.DS; import com.op.common.core.context.SecurityContextHolder; import com.op.common.core.utils.DateUtils; +import com.op.common.core.utils.StringUtils; import com.op.common.core.utils.uuid.IdUtils; import com.op.common.core.web.domain.AjaxResult; +import com.op.common.security.utils.SecurityUtils; import com.op.device.domain.*; import com.op.device.domain.dto.EquCheckItemDTO; import com.op.device.domain.dto.SummaryReportDTO; +import com.op.device.domain.vo.EquCheckItemImportVO; import com.op.device.domain.vo.EquCheckItemVO; import com.op.device.mapper.EquCheckItemDetailMapper; import com.op.device.mapper.EquItemEquipmentMapper; +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; @@ -47,6 +52,7 @@ public class EquCheckItemServiceImpl implements IEquCheckItemService { @Autowired private EquItemEquipmentMapper equItemEquipmentMapper; + protected Logger logger = LoggerFactory.getLogger(getClass()); /** * 查询检查项维护 * @@ -357,7 +363,6 @@ public class EquCheckItemServiceImpl implements IEquCheckItemService { return success(workCenterList); } - /** * 点检、巡检、保养计划工单匹配检查项 * @@ -371,4 +376,188 @@ public class EquCheckItemServiceImpl implements IEquCheckItemService { List matchList = equCheckItemMapper.selectMatchListByEquipmentCode(summaryReportDTO); return success(matchList); } + + /** + * 处理设备基础信息 + * + * @param equCheckItemImportVO + * @return + */ + @Override + @DS("#header.poolName") + @Transactional + public AjaxResult importFile(List equCheckItemImportVO) { + EquCheckItem example = null; + // 数据校验 + AjaxResult checkResult = checkImportFile(equCheckItemImportVO); + + for (EquCheckItemImportVO table : equCheckItemImportVO) { + table.setItemId(IdUtils.fastSimpleUUID()); + table.setDetailId(IdUtils.fastSimpleUUID()); + table.setParentCode(table.getItemCode()); //父code + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String key = "#header.poolName"; + table.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_", "")); //工厂号 + table.setCreateBy(SecurityUtils.getUsername()); //创建人 + table.setCreateTime(DateUtils.getNowDate()); //创建时间 + table.setUpdateBy(SecurityUtils.getUsername()); //创建人 + table.setUpdateTime(DateUtils.getNowDate()); //创建时间 + table.setDelFlag("0"); //删除标志 + } + + // 如果数据校验成功 + if (checkResult.isSuccess()) { + String info = syncImportFunc(equCheckItemImportVO); + return success("信息导入完成。检查项表中检查编码作为主键,导入编码重复。其中导入失败检查项:" + info); + } + // 校验失败 + return checkResult; + } + + /** + * 校验导入检查项信息 + * + * @param equCheckItemImportVO + */ + public AjaxResult checkImportFile(List equCheckItemImportVO) { + + // 传入对象不能为空 + if (equCheckItemImportVO.size() == 0 || StringUtils.isNull(equCheckItemImportVO)) { + return error(500, "导入的检查项信息不能为空!信息导入失败!"); + } + + // 循环遍历校验数据是否为空 + for (EquCheckItemImportVO table : equCheckItemImportVO) { + // 检查项编码 + if (StringUtils.isEmpty(table.getItemCode()) || table.getItemCode() == null ||table.getItemCode().equals("")) { + return error(500, "检查项编码不能为空!信息导入失败!"); + } + //检查项详情编码 + if (StringUtils.isEmpty(table.getDetailCode()) || table.getDetailCode() == null ||table.getDetailCode().equals("")) { + return error(500, "检查项详情编码不能为空!信息导入失败!"); + } + // 部位 + if (StringUtils.isEmpty(table.getItemName()) || table.getItemName() == null||table.getItemName().equals("")) { + return error(500, "部位(检查项名称)不能为空!信息导入失败!"); + } + // 方法 + if (StringUtils.isEmpty(table.getItemMethod()) || table.getItemMethod() == null||table.getItemMethod().equals("")) { + return error(500, "方法不能为空!信息导入失败!"); + } + // 工具 + if (StringUtils.isEmpty(table.getItemTools()) || table.getItemTools() == null||table.getItemTools().equals("")) { + return error(500, "工具不能为空!信息导入失败!"); + } + // 周期 + if (StringUtils.isEmpty(table.getItemLoop()) || table.getItemLoop() == null||table.getItemLoop().equals("")) { + return error(500, "周期不能为空!信息导入失败!"); + } + // 周期类型 + if (StringUtils.isEmpty(table.getItemLoopType()) || table.getItemLoopType() == null ||table.getItemLoopType().equals("")) { + return error(500, "周期类型不能为空!信息导入失败!"); + }else{ + if(!(table.getItemLoopType().equals("日") || table.getItemLoopType().equals("周") || table.getItemLoopType().equals("月") || table.getItemLoopType().equals("季") || table.getItemLoopType().equals("年"))){ + return error(500, "周期类型录入格式错误!信息导入失败!"); + } + } +// // 维护类型编码 +// if (table.getItemType().isEmpty() || table.getItemType() == null) { +// return error(500, "维护类型编码不能为空!信息导入失败!"); +// }else{ +// +// } + // 维护类型名称 + if (StringUtils.isEmpty(table.getItemTypeName()) || table.getItemTypeName() == null ||table.getItemTypeName().equals("")) { + return error(500, "维护类型名称不能为空!信息导入失败!"); + }else{ + if(!(table.getItemTypeName().equals("点检") || table.getItemTypeName().equals("巡检") || table.getItemTypeName().equals("保养"))){ + return error(500, "维护类型名称格式录入错误!信息导入失败!"); + } + } + // 标准类型 + if (StringUtils.isEmpty(table.getStandardType()) || table.getStandardType() == null ||table.getStandardType().equals("")) { + return error(500, "标准类型不能为空!信息导入失败!"); + }else{ + if(!(table.getStandardType().equals("定性") || table.getStandardType().equals("定量"))){ + return error(500, "标准类型名称格式录入错误!信息导入失败!"); + } + } + // 标准名称 + if (StringUtils.isEmpty(table.getStandardName()) || table.getStandardName() == null ||table.getStandardName().equals("")) { + return error(500, "标准名称不能为空!信息导入失败!"); + } + //定量的判断 + if(table.getStandardType().equals("定量")){ + // 上限 + if (table.getDetailUpLimit() == null) { + return error(500, "定量的标准上限不能为空!信息导入失败!"); + } + // 下限 + if (table.getDetailDownLimit() == null) { + return error(500, "定量的标准下限不能为空!信息导入失败!"); + } + // 单位 + if (StringUtils.isEmpty(table.getDetailUnit()) || table.getDetailUnit() == null ||table.getDetailUnit().equals("")) { + return error(500, "定量的单位不能为空!信息导入失败!"); + } + } + } + return success(); + } + + public String syncImportFunc(List equCheckItemImportVO) { + String failCheckItem = ""; + for (EquCheckItemImportVO table : equCheckItemImportVO) { + String msg = syncFunc(table); + if (StringUtils.isNotBlank(msg)) { + failCheckItem += msg + ","; + } + } + return failCheckItem; + } + + @Transactional(rollbackFor = Exception.class) + public String syncFunc(EquCheckItemImportVO table) { + String failCheckItem = ""; + EquCheckItem itemExist = equCheckItemMapper.selectExistByItemCode(table.getItemCode()); + EquCheckItemDetail detailExist = equCheckItemDetailMapper.selectExistByDetailCode(table.getDetailCode()); + + //主对象 + EquCheckItem equCheckItem = new EquCheckItem(); + BeanUtils.copyProperties(table,equCheckItem); + if(equCheckItem.getItemTypeName().equals("点检")){ + equCheckItem.setItemType("spotInspection"); + }else if(equCheckItem.getItemTypeName().equals("巡检")){ + equCheckItem.setItemType("inspection"); + }else if(equCheckItem.getItemTypeName().equals("保养")){ + equCheckItem.setItemType("maintenance"); + } + equCheckItem.setItemLoop(Integer.valueOf(table.getItemLoop())); + + //详情对象 + EquCheckItemDetail equCheckItemDetail = new EquCheckItemDetail(); + BeanUtils.copyProperties(table,equCheckItemDetail); + if(equCheckItemDetail.getStandardType().equals("定性")){ + equCheckItemDetail.setStandardType("qualitative"); + }else if(equCheckItemDetail.getStandardType().equals("定量")){ + equCheckItemDetail.setStandardType("quantify"); + } + + //不存在就插入 + if (itemExist == null) { + equCheckItemMapper.insertEquCheckItem(equCheckItem); + logger.info("=======检查项[" + table.getItemCode() + "]=======导入成功"); + if(detailExist == null){ + equCheckItemDetailMapper.insertEquCheckItemDetail(equCheckItemDetail); + logger.info("=======检查项[" + table.getItemCode() +"]的["+ table.getDetailCode() + "]=======导入成功"); + }else{ + failCheckItem = '['+table.getItemCode() + "]的[" + table.getDetailCode() + "]"; + logger.info("=======检查项[" + table.getItemCode() +"]的["+ table.getDetailCode() + "]=======导入失败"); + } + } else { + failCheckItem = '['+table.getItemCode() + ']'; + logger.info("=======检查项[" + failCheckItem + "]=======导入失败"); + } + return failCheckItem; + } } diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemDetailMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemDetailMapper.xml index ce75595f..c6dab4d0 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemDetailMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemDetailMapper.xml @@ -164,4 +164,10 @@ where parent_code = ( select item_code from equ_check_item where item_id = #{itemId} ) + + diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemMapper.xml index fce75a5c..3c94ee81 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemMapper.xml @@ -226,4 +226,9 @@ and CONVERT(varchar,order_end,21) like concat('%',#{yearMouth}, '%') + + From 49bdabd42d9817b6b17db137945b7c51b114c615 Mon Sep 17 00:00:00 2001 From: A0010407 Date: Wed, 12 Jun 2024 17:23:59 +0800 Subject: [PATCH 3/3] =?UTF-8?q?2024-6-12=20=E8=AE=BE=E5=A4=87-=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E9=A1=B9=E5=AF=BC=E5=85=A5-=E5=BE=AA=E7=8E=AF?= =?UTF-8?q?=E5=91=A8=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/EquCheckItemServiceImpl.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java index 63c3ce42..65c98e71 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java @@ -532,6 +532,20 @@ public class EquCheckItemServiceImpl implements IEquCheckItemService { }else if(equCheckItem.getItemTypeName().equals("保养")){ equCheckItem.setItemType("maintenance"); } + + //周期类型 + if(equCheckItem.getItemLoopType().equals("日")){ + equCheckItem.setItemLoopType("day"); + }else if(equCheckItem.getItemLoopType().equals("周")){ + equCheckItem.setItemLoopType("week"); + }else if(equCheckItem.getItemTypeName().equals("月")){ + equCheckItem.setItemLoopType("month"); + }else if(equCheckItem.getItemLoopType().equals("季")){ + equCheckItem.setItemLoopType("season"); + }else if(equCheckItem.getItemTypeName().equals("年")){ + equCheckItem.setItemLoopType("year"); + } + equCheckItem.setItemLoop(Integer.valueOf(table.getItemLoop())); //详情对象