基础信息设备+设备优化

highway
A0010407 12 months ago
parent 685bdc34bf
commit 71c9cb591d

@ -1,6 +1,8 @@
package com.op.device.controller;
import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.domain.AjaxResult;
import com.op.common.core.web.page.TableDataInfo;
import com.op.common.security.annotation.RequiresPermissions;
import com.op.device.domain.*;
import com.op.device.domain.dto.PDADTO;
@ -9,6 +11,8 @@ import com.op.device.service.IEquRepairOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* PDAController
*
@ -17,7 +21,7 @@ import org.springframework.web.bind.annotation.*;
*/
@RestController
@RequestMapping("/devicePDA")
public class DevicePDAController {
public class DevicePDAController extends BaseController {
@Autowired
private IDevicePDAService devicePDAService;
@ -119,6 +123,16 @@ public class DevicePDAController {
return devicePDAService.selectEquEquipmentByEquEquipmentId(equipmentId);
}
/**
*
*/
@GetMapping("/getEquipmentList")
public TableDataInfo getEquipmentList(EquEquipment equEquipment) {
startPage();
List<EquEquipment> list = devicePDAService.selectEquEquipmentList(equEquipment);
return getDataTable(list);
}
/**
*
*/

@ -23,7 +23,7 @@ public class EquSpareApply extends BaseEntity {
private String applyId;
/** 出库单号 */
@Excel(name = "出库单号")
@Excel(name = "单号")
private String applyCode;
/** 备品备件编码 */
@ -159,13 +159,14 @@ public class EquSpareApply extends BaseEntity {
public String getApplyId() {
return applyId;
}
public void setApplyCode(String applyCode) {
this.applyCode = applyCode;
}
public String getApplyCode() {
return applyCode;
}
public void setSpareCode(String spareCode) {
this.spareCode = spareCode;
}

@ -4,11 +4,8 @@ import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.device.domain.EquOrder;
import com.op.device.domain.EquOrderStandard;
import com.op.device.domain.EquPlan;
import com.op.device.domain.dto.PDADTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* Mapper

@ -6,7 +6,7 @@ public interface EquipmentMapper {
/**
*
*
* @param equipmentId
* @param equipmentCode
* @return
*/
public Equipment selectEquipmentByEquipmentCode(String equipmentCode);

@ -4,6 +4,8 @@ import com.op.common.core.web.domain.AjaxResult;
import com.op.device.domain.*;
import com.op.device.domain.dto.PDADTO;
import java.util.List;
/**
* PDAService
*
@ -103,4 +105,7 @@ public interface IDevicePDAService {
* @return
*/
AjaxResult startMaintenanceTask(PDADTO pdadto);
//查询设备列表
List<EquEquipment> selectEquEquipmentList(EquEquipment equEquipment);
}

@ -63,6 +63,9 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
@Autowired
private EquFaultTypeMapper equFaultTypeMapper;
@Autowired
private SparePartsLedgerMapper sparePartsLedgerMapper;
/**
* list-
@ -653,12 +656,14 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
equOrderMapper.updateEquOrder(checkList);
}
//新建申领单 缺少code
//新建申领单
List<EquSpareApply> equSpareApplies = equRepairWorkOrder.getApplyList();
for(EquSpareApply equSpareApply:equSpareApplies){
//生成领料单code
String serialNum = String.format("%03d", equSpareApplyMapper.selectSerialNumber());
String code = DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equRepairWorkOrder.getWorkCode().substring(10);
equSpareApply.setApplyCode("A" + code );
//十五位单号
equSpareApply.setApplyCode("AW" + code + serialNum);
equSpareApply.setApplyId(IdUtils.fastSimpleUUID());
//备品备件规格型号!!!!!
// equSpareApply.setSpareModel(equSpareApply.getS);
@ -675,8 +680,13 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
equSpareApply.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_",""));
equSpareApplyMapper.insertEquSpareApply(equSpareApply);
// SparePartsLedger sparePartsLedger = new SparePartsLedger();
// sparePartsLedger.
//更新完备品申领单后,更新库存
SparePartsLedger sparePartsLedger = new SparePartsLedger();
sparePartsLedger.setStorageId(equSpareApply.getStorageId());
BigDecimal applyNum = equSpareApply.getSpareQuantity();
BigDecimal amount = equSpareApply.getAmount();
sparePartsLedger.setAmount(amount.subtract(applyNum));
sparePartsLedgerMapper.updateSparePartsLedger(sparePartsLedger);
}
//图片
@ -734,4 +744,17 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
//
// return treeAll;
// }
/**
*
*
* @param equEquipment
* @return
*/
@Override
@DS("#header.poolName")
public List<EquEquipment> selectEquEquipmentList(EquEquipment equEquipment) {
return equEquipmentMapper.selectEquEquipmentList(equEquipment);
}
}

@ -87,11 +87,16 @@ public class EquSpareApplyServiceImpl implements IEquSpareApplyService {
@DS("#header.poolName")
public AjaxResult insertEquSpareApply(EquSpareApply equSpareApply) {
try {
//equSpareApply.getSpareApplyLists().size() 是在申领备件的时候进行的操作
//equSpareApply.getSpareApplyLists().size() 是在维修申领备件的时候进行的操作 批量新增
if(equSpareApply.getSpareApplyLists().size() >= 1){
List<EquSpareApply> list = equSpareApply.getSpareApplyLists();
for(EquSpareApply applyList:list){
applyList.setApplyId(IdUtils.fastSimpleUUID());
//生成领料单code //申领单号
String serialNum = String.format("%03d", equSpareApplyMapper.selectSerialNumber());
String code = DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + applyList.getWorkCode().substring(2);
//申领单号
equSpareApply.setApplyCode("AW" + code + serialNum);
//领用时间
applyList.setApplyTime(DateUtils.getNowDate());
//申领人
@ -100,6 +105,7 @@ public class EquSpareApplyServiceImpl implements IEquSpareApplyService {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String key = "#header.poolName";
applyList.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_",""));
//创建人、创建时间
applyList.setCreateTime(DateUtils.getNowDate());
applyList.setCreateBy(SecurityUtils.getUsername());
equSpareApplyMapper.insertEquSpareApply(applyList);
@ -113,13 +119,36 @@ public class EquSpareApplyServiceImpl implements IEquSpareApplyService {
}
}else{
equSpareApply.setApplyId(IdUtils.fastSimpleUUID());
String serialNum = String.format("%03d", equSpareApplyMapper.selectSerialNumber());
if(equSpareApply.getWorkCode().length() == 12){
//生成领料单code 十五位单号
equSpareApply.setApplyCode("A" + equSpareApply.getWorkCode() + serialNum);
}else if(equSpareApply.getWorkCode().length() > 12){
equSpareApply.setApplyCode("AW" + equSpareApply.getWorkCode().substring(2) + serialNum);
}else{
//普通申领单
equSpareApply.setApplyCode("AN" + DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equSpareApply.getSpareUseEquipment() + serialNum);
}
//领用时间
equSpareApply.setApplyTime(DateUtils.getNowDate());
//申领人
equSpareApply.setApplyPeople(SecurityUtils.getUsername());
//工厂号
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String key = "#header.poolName";
equSpareApply.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_",""));
//创建人、创建时间
equSpareApply.setCreateTime(DateUtils.getNowDate());
equSpareApply.setCreateBy(SecurityUtils.getUsername());
equSpareApplyMapper.insertEquSpareApply(equSpareApply);
//更新完备品申领单后,更新库存
SparePartsLedger sparePartsLedger = new SparePartsLedger();
sparePartsLedger.setStorageId(equSpareApply.getStorageId());
BigDecimal applyNum = equSpareApply.getSpareQuantity();
BigDecimal amount = equSpareApply.getAmount();
sparePartsLedger.setAmount(amount.subtract(applyNum));
sparePartsLedgerMapper.updateSparePartsLedger(sparePartsLedger);
}
return success("新增申领记录成功!");
} catch (Exception e) {

@ -199,10 +199,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
<!--流水单号-->
<select id="selectWorkCodeSerialNumber" resultType="java.lang.Integer">
SELECT COUNT(work_id)+1 AS serialNum
FROM equ_outsource_work
where del_flag = '0'
WHERE CONVERT(date, GETDATE()) = CONVERT(date,create_time)
</select>
</mapper>

@ -261,11 +261,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
delete from equ_repair_order where order_code = #{repairCode} and del_flag = '0'
</delete>
<!--流水单号-->
<select id="selectOrderCodeSerialNumber" resultType="java.lang.Integer">
SELECT COUNT(order_id)+1 AS serialNum
FROM equ_repair_order
WHERE CONVERT(date, GETDATE()) = CONVERT(date,create_time)
and del_flag = '0'
</select>
<select id="getRepairPersonList" parameterType="EquTeamUser" resultType="com.op.device.domain.EquTeamUser">

@ -417,10 +417,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
<!--流水单号-->
<select id="selectWorkCodeSerialNumber" resultType="java.lang.Integer">
SELECT COUNT(work_id)+1 AS serialNum
FROM equ_repair_work_order
where del_flag = '0'
</select>
<select id="getMaintenancePersonList" parameterType="EquTeamUser" resultType="com.op.device.domain.EquTeamUser">

@ -28,7 +28,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="factoryCode" column="factory_code" />
</resultMap>
<sql id="selectEquSpareApplyVo">

@ -82,6 +82,12 @@
<groupId>com.op</groupId>
<artifactId>op-common-swagger</artifactId>
</dependency>
<dependency>
<groupId>com.op</groupId>
<artifactId>op-modules-device</artifactId>
<version>0.0.1</version>
<scope>compile</scope>
</dependency>
</dependencies>

@ -1,7 +1,17 @@
package com.op.wms.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.wms.domain.EquSpareEquipment;
import com.op.wms.domain.WmsSparePartsLedger;
import com.op.wms.service.IBaseEquipmentService;
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;
@ -15,11 +25,11 @@ import com.op.common.log.annotation.Log;
import com.op.common.log.enums.BusinessType;
import com.op.common.security.annotation.RequiresPermissions;
import com.op.wms.domain.BaseEquipment;
import com.op.wms.service.IBaseEquipmentService;
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
@ -111,4 +121,101 @@ public class BaseEquipmentController extends BaseController {
return getDataTable(list);
}
/**
*
*/
@GetMapping("/getSparePartsList")
public TableDataInfo getSparePartsList(BaseEquipment baseEquipment) {
List<WmsSparePartsLedger> list = baseEquipmentService.getSparePartsList(baseEquipment);
return getDataTable(list);
}
/**
*
*/
@GetMapping("/getRightSparePartsList")
public TableDataInfo getRightSparePartsList(BaseEquipment baseEquipment) {
List<EquSpareEquipment> list = baseEquipmentService.getRightSparePartsList(baseEquipment);
return getDataTable(list);
}
/**
*
*
* @param response
* @throws IOException
*/
@PostMapping("/importTemplate")
@Log(title = "生成设备基础信息模板", businessType = BusinessType.EXPORT)
public void importTemplate(HttpServletResponse response) throws IOException {
ArrayList<ExcelCol> excelCols = new ArrayList<>();
excelCols.add(new ExcelCol("设备编码","equipmentCode",20));
excelCols.add(new ExcelCol("设备名称","equipmentName",20));
excelCols.add(new ExcelCol("品牌","equipmentBrand",20));
excelCols.add(new ExcelCol("规格型号","equipmentSpec",20));
excelCols.add(new ExcelCol("设备类型编码","equipmentTypeCode",20));
excelCols.add(new ExcelCol("设备类型名称","equipmentTypeName",20));
excelCols.add(new ExcelCol("所属工作中心编码","workshopCode",20));
excelCols.add(new ExcelCol("所属工作中心名称","workshopName",20));
excelCols.add(new ExcelCol("工段","workshopSection",20));
excelCols.add(new ExcelCol("设备位置","equipmentLocation",20));
excelCols.add(new ExcelCol("工时单价","hourlyUnitPrice",20));
excelCols.add(new ExcelCol("生产厂商","manufacturer",20));
excelCols.add(new ExcelCol("供应商","supplier",20));
excelCols.add(new ExcelCol("使用寿命","useLife",20));
// excelCols.add(new ExcelCol("购买时间","buyTime",20));
excelCols.add(new ExcelCol("资产原值","assetOriginalValue",20));
excelCols.add(new ExcelCol("资产净值","netAssetValue",20));
excelCols.add(new ExcelCol("资产负责人","assetHead",20));
excelCols.add(new ExcelCol("固定资产编码","fixedAssetCode",20));
excelCols.add(new ExcelCol("部门","department",20));
excelCols.add(new ExcelCol("单台能力工时","unitWorkingHours",20));
excelCols.add(new ExcelCol("PLCIP","plcIp",20));
excelCols.add(new ExcelCol("PLC端口","plcPort",20));
excelCols.add(new ExcelCol("SAP资产号","sapAsset",20));
excelCols.add(new ExcelCol("设备负责人","equipmentHead",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, titleName, excelCols, null);
workbook.write(outputStream);
} catch (Exception e) {
e.printStackTrace();
}finally {
if (workbook!=null){
workbook.dispose();
}
}
}
/**
*
*
* @param file
* @return
* @throws Exception
*/
@Log(title = "导入设备基本信息", businessType = BusinessType.IMPORT)
@PostMapping("/importFile")
@RequiresPermissions("wms:equipment:import")
public AjaxResult importFile(MultipartFile file) throws Exception {
// 创建接收对象
ExcelUtil<BaseEquipment> util = new ExcelUtil<>(BaseEquipment.class);
// 接收表格信息
List<BaseEquipment> orderList = util.importExcel(file.getInputStream());
return baseEquipmentService.importFile(orderList);
}
}

@ -1,10 +1,13 @@
package com.op.wms.domain;
import com.op.common.core.domain.BaseFileData;
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;
import java.util.List;
/**
* base_equipment
*
@ -17,12 +20,12 @@ public class BaseEquipment extends BaseEntity {
/** 设备类型ID */
private Long equipmentId;
/** 设备类型编码 */
@Excel(name = "设备类型编码")
/** 设备编码 */
@Excel(name = "设备编码")
private String equipmentCode;
/** 设备类型名称 */
@Excel(name = "设备类型名称")
/** 设备名称 */
@Excel(name = "设备名称")
private String equipmentName;
/** 品牌 */
@ -146,6 +149,142 @@ public class BaseEquipment extends BaseEntity {
@Excel(name = "端口号")
private String plcPort;
/** SAP资产号 */
@Excel(name = "SAP资产号")
private String sapAsset;
/** 设备条码 */
@Excel(name = "设备条码")
private String equipmentBarcode;
/** 设备条码图片 */
@Excel(name = "设备条码图片")
private String equipmentBarcodeImage;
/** 生产厂商 */
@Excel(name = "生产厂商")
private String manufacturer;
/** 供应商 */
@Excel(name = "供应商")
private String supplier;
/** 使用寿命 */
@Excel(name = "使用寿命")
private String useLife;
/** 购买时间 */
@Excel(name = "购买时间", width = 30, dateFormat = "yyyy-MM-dd")
private String buyTime;
/** 资产原值 */
@Excel(name = "资产原值")
private String assetOriginalValue;
/** 资产净值 */
@Excel(name = "资产净值")
private String netAssetValue;
/** 资产负责人 */
@Excel(name = "资产负责人")
private String assetHead;
/** 固定资产编码 */
@Excel(name = "固定资产编码")
private String fixedAssetCode;
/** 部门 */
@Excel(name = "部门")
private String department;
/** 负责人工号 */
@Excel(name = "负责人工号")
private String equipmentHead;
/** 工厂号 */
@Excel(name = "工厂号")
private String factoryCode;
private String imageFileList;
private String barCodeFileList;
private String qrFileList;
private List<BaseFileData> qrFiles;
private List<BaseFileData> barCodeFiles;
private List<BaseFileData> imageFiles;
//右侧绑定备件
private List<String> rightData;
//返回已经绑定备件列表
private List<EquSpareEquipment> selectedData;
public void setSelectedData(List<EquSpareEquipment> selectedData) {
this.selectedData = selectedData;
}
public List<EquSpareEquipment> getSelectedData() {
return selectedData;
}
public String getImageFileList() {
return imageFileList;
}
public void setImageFileList(String imageFileList) {
this.imageFileList = imageFileList;
}
public String getBarCodeFileList() {
return barCodeFileList;
}
public void setBarCodeFileList(String barCodeFileList) {
this.barCodeFileList = barCodeFileList;
}
public String getQrFileList() {
return qrFileList;
}
public void setQrFileList(String qrFileList) {
this.qrFileList = qrFileList;
}
public List<BaseFileData> getQrFiles() {
return qrFiles;
}
public void setQrFiles(List<BaseFileData> qrFiles) {
this.qrFiles = qrFiles;
}
public void setBarCodeFiles(List<BaseFileData> barCodeFiles) {
this.barCodeFiles = barCodeFiles;
}
public List<BaseFileData> getBarCodeFiles() {
return barCodeFiles;
}
public void setImageFiles(List<BaseFileData> imageFiles) {
this.imageFiles = imageFiles;
}
public List<BaseFileData> getImageFiles() {
return imageFiles;
}
public void setEquipmentHead(String equipmentHead) {
this.equipmentHead = equipmentHead;
}
public String getEquipmentHead() {
return equipmentHead;
}
public void setPlcIp(String plcIp) {
this.plcIp = plcIp;
}
@ -378,6 +517,108 @@ public class BaseEquipment extends BaseEntity {
return hourlyUnitPrice;
}
public void setEquipmentBarcode(String equipmentBarcode) {
this.equipmentBarcode = equipmentBarcode;
}
public String getEquipmentBarcode() {
return equipmentBarcode;
}
public void setEquipmentBarcodeImage(String equipmentBarcodeImage) {
this.equipmentBarcodeImage = equipmentBarcodeImage;
}
public String getEquipmentBarcodeImage() {
return equipmentBarcodeImage;
}
public void setManufacturer(String manufacturer) {
this.manufacturer = manufacturer;
}
public String getManufacturer() {
return manufacturer;
}
public void setSupplier(String supplier) {
this.supplier = supplier;
}
public String getSupplier() {
return supplier;
}
public void setUseLife(String useLife) {
this.useLife = useLife;
}
public String getUseLife() {
return useLife;
}
public void setBuyTime(String buyTime) {
this.buyTime = buyTime;
}
public String getBuyTime() {
return buyTime;
}
public void setAssetOriginalValue(String assetOriginalValue) {
this.assetOriginalValue = assetOriginalValue;
}
public String getAssetOriginalValue() {
return assetOriginalValue;
}
public void setNetAssetValue(String netAssetValue) {
this.netAssetValue = netAssetValue;
}
public String getNetAssetValue() {
return netAssetValue;
}
public void setAssetHead(String assetHead) {
this.assetHead = assetHead;
}
public String getAssetHead() {
return assetHead;
}
public void setFixedAssetCode(String fixedAssetCode) {
this.fixedAssetCode = fixedAssetCode;
}
public String getFixedAssetCode() {
return fixedAssetCode;
}
public void setDepartment(String department) {
this.department = department;
}
public String getDepartment() {
return department;
}
public void setSapAsset(String sapAsset) {
this.sapAsset = sapAsset;
}
public String getSapAsset() {
return sapAsset;
}
//右侧的绑定备件
public void setRightData(List<String> rightData) {
this.rightData = rightData;
}
public List<String> getRightData() {
return rightData;
}
//工厂号
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getFactoryCode() {
return factoryCode;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -0,0 +1,169 @@
package com.op.wms.domain;
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;
import java.util.List;
/**
* equ_spare_equipment
*
* @author Open Platform
* @date 2023-10-24
*/
public class EquSpareEquipment extends BaseEntity {
private static final long serialVersionUID = 1L;
private String id;
/** 备件编码 */
@Excel(name = "备件编码")
private String spareCode;
/** 备件类型 */
@Excel(name = "备件类型")
private String spareType;
/** 备件名称 */
@Excel(name = "备件名称")
private String spareName;
/** 设备名称 */
@Excel(name = "设备名称")
private String equipmentName;
/** 设备编码 */
@Excel(name = "设备编码")
private String equipmentCode;
/** 备用字段1 */
@Excel(name = "备用字段1")
private String attr1;
/** 备用字段2 */
@Excel(name = "备用字段2")
private String attr2;
/** 备用字段3 */
@Excel(name = "备用字段3")
private String attr3;
/** 删除字段 */
private String delFlag;
/** 工厂号 */
@Excel(name = "工厂号")
private String factoryCode;
private List<String> rightData;
public void setRightData(List<String> rightData) {
this.rightData = rightData;
}
public List<String> getRightData() {
return rightData;
}
public void setId(String id) {
this.id = id;
}
public String getId() {
return id;
}
public void setSpareCode(String spareCode) {
this.spareCode = spareCode;
}
public String getSpareCode() {
return spareCode;
}
public void setSpareType(String spareType) {
this.spareType = spareType;
}
public String getSpareType() {
return spareType;
}
public void setSpareName(String spareName) {
this.spareName = spareName;
}
public String getSpareName() {
return spareName;
}
public void setEquipmentName(String equipmentName) {
this.equipmentName = equipmentName;
}
public String getEquipmentName() {
return equipmentName;
}
public void setEquipmentCode(String equipmentCode) {
this.equipmentCode = equipmentCode;
}
public String getEquipmentCode() {
return equipmentCode;
}
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 setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getFactoryCode() {
return factoryCode;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("spareCode", getSpareCode())
.append("spareType", getSpareType())
.append("spareName", getSpareName())
.append("equipmentName", getEquipmentName())
.append("equipmentCode", getEquipmentCode())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("factoryCode", getFactoryCode())
.toString();
}
}

@ -0,0 +1,569 @@
package com.op.wms.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;
/**
* wms_ods_mate_storage_news
*
* @author Open Platform
* @date 2023-10-13
*/
public class WmsSparePartsLedger extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 唯一序列 */
@Excel(name = "唯一序列")
private String storageId;
/** 仓库编码 */
@Excel(name = "仓库编码")
private String whCode;
/** 区域编号 */
@Excel(name = "区域编号")
private String regionCode;
/** 库区编码 */
@Excel(name = "库区编码")
private String waCode;
/** 库存类型BC包材 */
@Excel(name = "库存类型BC包材")
private String storageType;
/** 库位编码 */
@Excel(name = "库位编码")
private String wlCode;
/** 物料号 */
@Excel(name = "物料号")
private String materialCode;
/** 物料描述 */
@Excel(name = "物料描述")
private String materialDesc;
/** 总数量 */
@Excel(name = "总数量")
private BigDecimal amount;
/** 冻结数量(预留) */
@Excel(name = "冻结数量", readConverterExp = "预=留")
private BigDecimal storageAmount;
/** 占用数量 */
@Excel(name = "占用数量")
private BigDecimal occupyAmount;
/** LPN预留 */
@Excel(name = "LPN", readConverterExp = "预=留")
private String lpn;
/** 入库批次号(预留) */
@Excel(name = "入库批次号", readConverterExp = "预=留")
private String productBatch;
/** 入库时间x预留 */
@Excel(name = "入库时间x", readConverterExp = "预=留")
private Date receiveDate;
/** 生产时间(预留) */
@Excel(name = "生产时间", readConverterExp = "预=留")
private Date productDate;
/** 单位 */
@Excel(name = "单位")
private String userDefined1;
/** SAP库位 */
@Excel(name = "SAP库位")
private String userDefined2;
/** 备用3 */
@Excel(name = "备用3")
private String userDefined3;
/** 备用4 */
@Excel(name = "备用4")
private String userDefined4;
/** 备用5 */
@Excel(name = "备用5")
private String userDefined5;
/** 备用6 */
@Excel(name = "备用6")
private String userDefined6;
/** 备用7 */
@Excel(name = "备用7")
private String userDefined7;
/** 备用8 */
@Excel(name = "备用8")
private String userDefined8;
/** 备用9 */
@Excel(name = "备用9")
private String userDefined9;
/** 备用10 */
@Excel(name = "备用10")
private String userDefined10;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date gmtCreate;
/** 最后更新人 */
@Excel(name = "最后更新人")
private String lastModifiedBy;
/** 最后更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "最后更新时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date gmtModified;
/** 有效标记 */
@Excel(name = "有效标记")
private String activeFlag;
/** 工厂号 */
@Excel(name = "工厂号")
private String factoryCode;
/** SAP工厂号 */
@Excel(name = "SAP工厂号")
private String sapFactoryCode;
/** 库位名称 */
@Excel(name = "库位名称")
private String wlName;
/** 0存在 */
private String delFlag;
/** 使用寿命(备件用) */
@Excel(name = "使用寿命", readConverterExp = "备=件用")
private String spareUseLife;
/** 备件名称(备件用) */
@Excel(name = "备件名称", readConverterExp = "备=件用")
private String spareName;
/** 规格型号(备件用) */
@Excel(name = "规格型号", readConverterExp = "备=件用")
private String spareMode;
/** 生产厂商(备件用) */
@Excel(name = "生产厂商", readConverterExp = "备=件用")
private String spareManufacturer;
/** 供应商(备件用) */
@Excel(name = "供应商", readConverterExp = "备=件用")
private String spareSupplier;
/** 循环周期(备件用) */
@Excel(name = "循环周期", readConverterExp = "备=件用")
private String spareReplacementCycle;
/** 计量单位(备件用) */
@Excel(name = "计量单位", readConverterExp = "备=件用")
private String spareMeasurementUnit;
/** 换算单位(备件用) */
@Excel(name = "换算单位", readConverterExp = "备=件用")
private String spareConversionUnit;
/** 换算比例(备件用) */
@Excel(name = "换算比例", readConverterExp = "备=件用")
private String spareConversionRatio;
/** 库存上限(备件用) */
@Excel(name = "库存上限", readConverterExp = "备=件用")
private String spareInventoryFloor;
/** 库存下限(备件用) */
@Excel(name = "库存下限", readConverterExp = "备=件用")
private String spareInventoryUpper;
/** 备件类型 */
@Excel(name = "备件类型", readConverterExp = "备=件用")
private String spareType;
public void setSpareType(String spareType) {
this.spareType = spareType;
}
public String getSpareType() {
return spareType;
}
public void setStorageId(String storageId) {
this.storageId = storageId;
}
public String getStorageId() {
return storageId;
}
public void setWhCode(String whCode) {
this.whCode = whCode;
}
public String getWhCode() {
return whCode;
}
public void setRegionCode(String regionCode) {
this.regionCode = regionCode;
}
public String getRegionCode() {
return regionCode;
}
public void setWaCode(String waCode) {
this.waCode = waCode;
}
public String getWaCode() {
return waCode;
}
public void setStorageType(String storageType) {
this.storageType = storageType;
}
public String getStorageType() {
return storageType;
}
public void setWlCode(String wlCode) {
this.wlCode = wlCode;
}
public String getWlCode() {
return wlCode;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
public String getMaterialCode() {
return materialCode;
}
public void setMaterialDesc(String materialDesc) {
this.materialDesc = materialDesc;
}
public String getMaterialDesc() {
return materialDesc;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
public BigDecimal getAmount() {
return amount;
}
public void setStorageAmount(BigDecimal storageAmount) {
this.storageAmount = storageAmount;
}
public BigDecimal getStorageAmount() {
return storageAmount;
}
public void setOccupyAmount(BigDecimal occupyAmount) {
this.occupyAmount = occupyAmount;
}
public BigDecimal getOccupyAmount() {
return occupyAmount;
}
public void setLpn(String lpn) {
this.lpn = lpn;
}
public String getLpn() {
return lpn;
}
public void setProductBatch(String productBatch) {
this.productBatch = productBatch;
}
public String getProductBatch() {
return productBatch;
}
public void setReceiveDate(Date receiveDate) {
this.receiveDate = receiveDate;
}
public Date getReceiveDate() {
return receiveDate;
}
public void setProductDate(Date productDate) {
this.productDate = productDate;
}
public Date getProductDate() {
return productDate;
}
public void setUserDefined1(String userDefined1) {
this.userDefined1 = userDefined1;
}
public String getUserDefined1() {
return userDefined1;
}
public void setUserDefined2(String userDefined2) {
this.userDefined2 = userDefined2;
}
public String getUserDefined2() {
return userDefined2;
}
public void setUserDefined3(String userDefined3) {
this.userDefined3 = userDefined3;
}
public String getUserDefined3() {
return userDefined3;
}
public void setUserDefined4(String userDefined4) {
this.userDefined4 = userDefined4;
}
public String getUserDefined4() {
return userDefined4;
}
public void setUserDefined5(String userDefined5) {
this.userDefined5 = userDefined5;
}
public String getUserDefined5() {
return userDefined5;
}
public void setUserDefined6(String userDefined6) {
this.userDefined6 = userDefined6;
}
public String getUserDefined6() {
return userDefined6;
}
public void setUserDefined7(String userDefined7) {
this.userDefined7 = userDefined7;
}
public String getUserDefined7() {
return userDefined7;
}
public void setUserDefined8(String userDefined8) {
this.userDefined8 = userDefined8;
}
public String getUserDefined8() {
return userDefined8;
}
public void setUserDefined9(String userDefined9) {
this.userDefined9 = userDefined9;
}
public String getUserDefined9() {
return userDefined9;
}
public void setUserDefined10(String userDefined10) {
this.userDefined10 = userDefined10;
}
public String getUserDefined10() {
return userDefined10;
}
public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}
public Date getGmtCreate() {
return gmtCreate;
}
public void setLastModifiedBy(String lastModifiedBy) {
this.lastModifiedBy = lastModifiedBy;
}
public String getLastModifiedBy() {
return lastModifiedBy;
}
public void setGmtModified(Date gmtModified) {
this.gmtModified = gmtModified;
}
public Date getGmtModified() {
return gmtModified;
}
public void setActiveFlag(String activeFlag) {
this.activeFlag = activeFlag;
}
public String getActiveFlag() {
return activeFlag;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getFactoryCode() {
return factoryCode;
}
public void setSapFactoryCode(String sapFactoryCode) {
this.sapFactoryCode = sapFactoryCode;
}
public String getSapFactoryCode() {
return sapFactoryCode;
}
public void setWlName(String wlName) {
this.wlName = wlName;
}
public String getWlName() {
return wlName;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getDelFlag() {
return delFlag;
}
public void setSpareUseLife(String spareUseLife) {
this.spareUseLife = spareUseLife;
}
public String getSpareUseLife() {
return spareUseLife;
}
public void setSpareName(String spareName) {
this.spareName = spareName;
}
public String getSpareName() {
return spareName;
}
public void setSpareMode(String spareMode) {
this.spareMode = spareMode;
}
public String getSpareMode() {
return spareMode;
}
public void setSpareManufacturer(String spareManufacturer) {
this.spareManufacturer = spareManufacturer;
}
public String getSpareManufacturer() {
return spareManufacturer;
}
public void setSpareSupplier(String spareSupplier) {
this.spareSupplier = spareSupplier;
}
public String getSpareSupplier() {
return spareSupplier;
}
public void setSpareReplacementCycle(String spareReplacementCycle) {
this.spareReplacementCycle = spareReplacementCycle;
}
public String getSpareReplacementCycle() {
return spareReplacementCycle;
}
public void setSpareMeasurementUnit(String spareMeasurementUnit) {
this.spareMeasurementUnit = spareMeasurementUnit;
}
public String getSpareMeasurementUnit() {
return spareMeasurementUnit;
}
public void setSpareConversionUnit(String spareConversionUnit) {
this.spareConversionUnit = spareConversionUnit;
}
public String getSpareConversionUnit() {
return spareConversionUnit;
}
public void setSpareConversionRatio(String spareConversionRatio) {
this.spareConversionRatio = spareConversionRatio;
}
public String getSpareConversionRatio() {
return spareConversionRatio;
}
public void setSpareInventoryFloor(String spareInventoryFloor) {
this.spareInventoryFloor = spareInventoryFloor;
}
public String getSpareInventoryFloor() {
return spareInventoryFloor;
}
public void setSpareInventoryUpper(String spareInventoryUpper) {
this.spareInventoryUpper = spareInventoryUpper;
}
public String getSpareInventoryUpper() {
return spareInventoryUpper;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("storageId", getStorageId())
.append("whCode", getWhCode())
.append("regionCode", getRegionCode())
.append("waCode", getWaCode())
.append("storageType", getStorageType())
.append("wlCode", getWlCode())
.append("materialCode", getMaterialCode())
.append("materialDesc", getMaterialDesc())
.append("amount", getAmount())
.append("storageAmount", getStorageAmount())
.append("occupyAmount", getOccupyAmount())
.append("lpn", getLpn())
.append("productBatch", getProductBatch())
.append("receiveDate", getReceiveDate())
.append("productDate", getProductDate())
.append("userDefined1", getUserDefined1())
.append("userDefined2", getUserDefined2())
.append("userDefined3", getUserDefined3())
.append("userDefined4", getUserDefined4())
.append("userDefined5", getUserDefined5())
.append("userDefined6", getUserDefined6())
.append("userDefined7", getUserDefined7())
.append("userDefined8", getUserDefined8())
.append("userDefined9", getUserDefined9())
.append("userDefined10", getUserDefined10())
.append("createBy", getCreateBy())
.append("gmtCreate", getGmtCreate())
.append("lastModifiedBy", getLastModifiedBy())
.append("gmtModified", getGmtModified())
.append("activeFlag", getActiveFlag())
.append("factoryCode", getFactoryCode())
.append("sapFactoryCode", getSapFactoryCode())
.append("wlName", getWlName())
.append("delFlag", getDelFlag())
.append("spareUseLife", getSpareUseLife())
.append("spareName", getSpareName())
.append("spareMode", getSpareMode())
.append("spareManufacturer", getSpareManufacturer())
.append("spareSupplier", getSpareSupplier())
.append("spareReplacementCycle", getSpareReplacementCycle())
.append("spareMeasurementUnit", getSpareMeasurementUnit())
.append("spareConversionUnit", getSpareConversionUnit())
.append("spareConversionRatio", getSpareConversionRatio())
.append("spareInventoryFloor", getSpareInventoryFloor())
.append("spareInventoryUpper", getSpareInventoryUpper())
.toString();
}
}

@ -1,9 +1,14 @@
package com.op.wms.mapper;
import java.util.Date;
import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.domain.BaseFileData;
import com.op.wms.domain.BaseEquipment;
import com.op.wms.domain.EquSpareEquipment;
import com.op.wms.domain.WmsSparePartsLedger;
import org.apache.ibatis.annotations.Param;
/**
* Mapper
@ -73,4 +78,33 @@ public interface BaseEquipmentMapper {
//查询设备类型
List<BaseEquipment> getEquipmentTypeList(BaseEquipment baseEquipment);
Long getEquipmentId(String equipmentCode);
//查询备件
List<WmsSparePartsLedger> getSparePartsList(BaseEquipment baseEquipment);
//绑定备品备件
public int bindSpareParts(EquSpareEquipment equSpareEquipment);
//查询备件右侧
List<EquSpareEquipment> getRightSparePartsList(BaseEquipment baseEquipment);
//批量新增文件
Boolean insertBaseFileBatch(@Param("baseFiles") List<BaseFileData> baseFiles);
//批量删除文件
void deleteBaseFileBySourceId(String equipmentId);
//查询不同类型
List<BaseFileData> getImageFileBatch(@Param("sourceId")String sourceId, @Param("imageType")String imageType);
List<BaseFileData> getQrFileBatch(@Param("sourceId")String sourceId, @Param("imageType")String imageType);
List<BaseFileData> getBarcodeFileBatch(@Param("sourceId")String sourceId, @Param("imageType")String imageType);
//根据code删除
void deleteEquSpareEquipmentByCode(String equipmentCode);
//返回已经绑定备件列表
List<EquSpareEquipment> getSpareCodeList(EquSpareEquipment equSpareEquipment);
//设备
BaseEquipment selectExistByEquipmentCode(String equipmentCode);
}

@ -1,7 +1,11 @@
package com.op.wms.service;
import java.util.List;
import com.op.common.core.web.domain.AjaxResult;
import com.op.wms.domain.BaseEquipment;
import com.op.wms.domain.EquSpareEquipment;
import com.op.wms.domain.WmsSparePartsLedger;
/**
* Service
@ -63,4 +67,13 @@ public interface IBaseEquipmentService {
//查询设备类型
List<BaseEquipment> getEquipmentTypeList(BaseEquipment baseEquipment);
//查询设备备品备件
List<WmsSparePartsLedger> getSparePartsList(BaseEquipment baseEquipment);
//查询设备备品备件右侧列表
public List<EquSpareEquipment> getRightSparePartsList(BaseEquipment baseEquipment);
//导入设备基础数据文件
AjaxResult importFile(List<BaseEquipment> equipmentList);
}

@ -1,15 +1,36 @@
package com.op.wms.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.domain.BaseFileData;
import com.op.common.core.utils.DateUtils;
import com.op.wms.domain.BaseArea;
import com.op.common.core.utils.ServletUtils;
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.wms.domain.*;
import com.op.wms.service.IBaseEquipmentService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.op.wms.mapper.BaseEquipmentMapper;
import com.op.wms.domain.BaseEquipment;
import com.op.wms.service.IBaseEquipmentService;
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;
import javax.servlet.http.HttpServletRequest;
import static com.op.common.core.web.domain.AjaxResult.error;
import static com.op.common.core.web.domain.AjaxResult.success;
/**
* Service
@ -19,6 +40,7 @@ import com.op.wms.service.IBaseEquipmentService;
*/
@Service
public class BaseEquipmentServiceImpl implements IBaseEquipmentService {
protected Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private BaseEquipmentMapper baseEquipmentMapper;
@ -63,7 +85,26 @@ public class BaseEquipmentServiceImpl implements IBaseEquipmentService {
}
}
}
// }
String sourceId = equipmentId +"";
//获得设备图片
List<BaseFileData> imageFiles = baseEquipmentMapper.getImageFileBatch(sourceId,"2");
if (!CollectionUtils.isEmpty(imageFiles)) {
list.setImageFiles(imageFiles);
}
List<BaseFileData> qrFiles = baseEquipmentMapper.getQrFileBatch(sourceId,"1");
if (!CollectionUtils.isEmpty(qrFiles)) {
list.setQrFiles(qrFiles);
}
List<BaseFileData> barcodeFiles = baseEquipmentMapper.getBarcodeFileBatch(sourceId,"0");
if (!CollectionUtils.isEmpty(barcodeFiles)) {
list.setBarCodeFiles(barcodeFiles);
}
//查询备品备件列表
EquSpareEquipment equSpareEquipment = new EquSpareEquipment();
equSpareEquipment.setEquipmentCode(list.getEquipmentCode());
List<EquSpareEquipment> spareCodeList = baseEquipmentMapper.getSpareCodeList(equSpareEquipment);
list.setSelectedData(spareCodeList);
return list;
}
@ -88,12 +129,83 @@ public class BaseEquipmentServiceImpl implements IBaseEquipmentService {
@Override
@DS("#header.poolName")
public int insertBaseEquipment(BaseEquipment baseEquipment) {
baseEquipment.setCreateTime(DateUtils.getNowDate());
Date createTime = DateUtils.getNowDate();
baseEquipment.setCreateTime(createTime);
String equipmentTypeName = baseEquipmentMapper.getEquipmentTypeName(baseEquipment);
String workCenterName = baseEquipmentMapper.getWorkCenterName(baseEquipment);
baseEquipment.setWorkshopName(workCenterName);
baseEquipment.setEquipmentTypeName(equipmentTypeName);
return baseEquipmentMapper.insertBaseEquipment(baseEquipment);
Integer list = baseEquipmentMapper.insertBaseEquipment(baseEquipment);
Long equId = baseEquipmentMapper.getEquipmentId(baseEquipment.getEquipmentCode());
//上传设备图片
if (StringUtils.isNotEmpty(baseEquipment.getImageFileList())) {
String[] ids1 = baseEquipment.getImageFileList().split(",");
List<BaseFileData> files1 = new ArrayList<>();
BaseFileData file1 = null;
for (String id1 : ids1) {
file1 = new BaseFileData();
file1.setFileId(IdUtils.fastSimpleUUID());
file1.setFileName(id1.split("&fileName=")[1]);
file1.setFileAddress(id1);
file1.setSourceId(equId+"");
file1.setCreateBy(SecurityUtils.getUsername());
file1.setCreateTime(new Date());
file1.setImageType("2");
files1.add(file1);
}
baseEquipmentMapper.insertBaseFileBatch(files1);
}
//上传设备条码图片
if (StringUtils.isNotEmpty(baseEquipment.getBarCodeFileList())) {
String[] ids2 = baseEquipment.getBarCodeFileList().split(",");
List<BaseFileData> files2 = new ArrayList<>();
BaseFileData file2 = null;
for (String id2 : ids2) {
file2 = new BaseFileData();
file2.setFileId(IdUtils.fastSimpleUUID());
file2.setFileName(id2.split("&fileName=")[1]);
file2.setFileAddress(id2);
file2.setSourceId(equId+"");
file2.setCreateBy(SecurityUtils.getUsername());
file2.setCreateTime(new Date());
file2.setImageType("0");
files2.add(file2);
}
baseEquipmentMapper.insertBaseFileBatch(files2);
}
//上传设备二维码图片
if (StringUtils.isNotEmpty(baseEquipment.getQrFileList())) {
String[] ids3 = baseEquipment.getQrFileList().split(",");
List<BaseFileData> files3 = new ArrayList<>();
BaseFileData file3 = null;
for (String id3 : ids3) {
file3 = new BaseFileData();
file3.setFileId(IdUtils.fastSimpleUUID());
file3.setFileName(id3.split("&fileName=")[1]);
file3.setFileAddress(id3);
file3.setSourceId(equId+"");
file3.setCreateBy(SecurityUtils.getUsername());
file3.setCreateTime(new Date());
file3.setImageType("1");
files3.add(file3);
}
baseEquipmentMapper.insertBaseFileBatch(files3);
}
if(baseEquipment.getRightData().size() >0 ){
List<String> rightSparePartsCodeList = baseEquipment.getRightData();
for(String code :rightSparePartsCodeList){
EquSpareEquipment equSpareEquipment = new EquSpareEquipment();
equSpareEquipment.setSpareCode(code);
equSpareEquipment.setEquipmentCode(baseEquipment.getEquipmentCode());
equSpareEquipment.setCreateBy(SecurityUtils.getUsername());
equSpareEquipment.setCreateTime(DateUtils.getNowDate());
equSpareEquipment.setId(IdUtils.fastSimpleUUID());
equSpareEquipment.setEquipmentName(baseEquipment.getEquipmentName());
baseEquipmentMapper.bindSpareParts(equSpareEquipment);
}
}
return list;
}
/**
@ -105,12 +217,89 @@ public class BaseEquipmentServiceImpl implements IBaseEquipmentService {
@Override
@DS("#header.poolName")
public int updateBaseEquipment(BaseEquipment baseEquipment) {
baseEquipment.setUpdateTime(DateUtils.getNowDate());
String equipmentTypeName = baseEquipmentMapper.getEquipmentTypeName(baseEquipment);
String workCenterName = baseEquipmentMapper.getWorkCenterName(baseEquipment);
baseEquipment.setWorkshopName(workCenterName);
baseEquipment.setEquipmentTypeName(equipmentTypeName);
return baseEquipmentMapper.updateBaseEquipment(baseEquipment);
Integer list = baseEquipmentMapper.updateBaseEquipment(baseEquipment);
Long equId = baseEquipmentMapper.getEquipmentId(baseEquipment.getEquipmentCode());
baseEquipmentMapper.deleteBaseFileBySourceId(equId.toString());
//设备上传二维码照片
if (StringUtils.isNotEmpty(baseEquipment.getQrFileList())) {
String[] ids1 = baseEquipment.getQrFileList().split(",");
List<BaseFileData> files1 = new ArrayList<>();
BaseFileData file1 = null;
for (String id1 : ids1) {
file1 = new BaseFileData();
file1.setFileId(IdUtils.fastSimpleUUID());
file1.setFileAddress(id1);
file1.setFileName(id1.split("&fileName=")[1]);
file1.setSourceId(equId+"");
file1.setCreateBy(SecurityUtils.getUsername());
file1.setCreateTime(new Date());
file1.setImageType("1");
files1.add(file1);
}
baseEquipmentMapper.insertBaseFileBatch(files1);
}
//设备上传设备照片
if (StringUtils.isNotEmpty(baseEquipment.getImageFileList())) {
String[] ids2 = baseEquipment.getImageFileList().split(",");
List<BaseFileData> files2 = new ArrayList<>();
BaseFileData file2 = null;
for (String id2 : ids2) {
file2 = new BaseFileData();
file2.setFileId(IdUtils.fastSimpleUUID());
file2.setFileAddress(id2);
file2.setFileName(id2.split("&fileName=")[1]);
file2.setSourceId(equId+"");
file2.setCreateBy(SecurityUtils.getUsername());
file2.setImageType("2");
file2.setCreateTime(new Date());
files2.add(file2);
}
baseEquipmentMapper.insertBaseFileBatch(files2);
}
//设备上传设备条码照片
if (StringUtils.isNotEmpty(baseEquipment.getBarCodeFileList())) {
String[] ids3 = baseEquipment.getBarCodeFileList().split(",");
List<BaseFileData> files3 = new ArrayList<>();
BaseFileData file3 = null;
for (String id3 : ids3) {
file3 = new BaseFileData();
file3.setFileId(IdUtils.fastSimpleUUID());
file3.setFileAddress(id3);
file3.setFileName(id3.split("&fileName=")[1]);
file3.setSourceId(equId+"");
file3.setCreateBy(SecurityUtils.getUsername());
file3.setImageType("0");
file3.setCreateTime(new Date());
files3.add(file3);
}
baseEquipmentMapper.insertBaseFileBatch(files3);
}
//绑定
//先删除,后绑定
baseEquipmentMapper.deleteEquSpareEquipmentByCode(baseEquipment.getEquipmentCode());
if(baseEquipment.getRightData().size() > 0 ){
List<String> rightSparePartsCodeList = baseEquipment.getRightData();
for(String code :rightSparePartsCodeList){
EquSpareEquipment equSpareEquipment = new EquSpareEquipment();
equSpareEquipment.setSpareCode(code);
equSpareEquipment.setEquipmentCode(baseEquipment.getEquipmentCode());
equSpareEquipment.setCreateBy(SecurityUtils.getUsername());
equSpareEquipment.setCreateTime(DateUtils.getNowDate());
equSpareEquipment.setId(IdUtils.fastSimpleUUID());
equSpareEquipment.setEquipmentName(baseEquipment.getEquipmentName());
baseEquipmentMapper.bindSpareParts(equSpareEquipment);
}
}
return list;
}
/**
@ -177,4 +366,119 @@ public class BaseEquipmentServiceImpl implements IBaseEquipmentService {
public List<BaseEquipment> getEquipmentTypeList(BaseEquipment baseEquipment) {
return baseEquipmentMapper.getEquipmentTypeList(baseEquipment);
}
/**
*
*/
@Override
@DS("#header.poolName")
public List<WmsSparePartsLedger> getSparePartsList(BaseEquipment baseEquipment) {
return baseEquipmentMapper.getSparePartsList(baseEquipment);
}
/**
*
*/
@Override
@DS("#header.poolName")
public List<EquSpareEquipment> getRightSparePartsList(BaseEquipment baseEquipment){
return baseEquipmentMapper.getRightSparePartsList(baseEquipment);
}
/**
*
*
* @param baseEquipment
* @return
*/
@Override
@DS("#header.poolName")
@Transactional
public AjaxResult importFile(List<BaseEquipment> baseEquipment) {
BaseEquipment example = null;
for(BaseEquipment table:baseEquipment){
//工厂号
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());
//设备状态 1启用 0停用
table.setStatus("1");
}
// 数据校验
AjaxResult checkResult = checkImportFile(baseEquipment);
// 如果数据校验成功
if (checkResult.isSuccess()) {
String info = syncImportFunc(baseEquipment);
return success("信息导入完成。其中导入失败订单:"+info);
}
// 校验失败
return checkResult;
}
/**
*
*
* @param baseEquipment
*/
public AjaxResult checkImportFile(List<BaseEquipment> baseEquipment) {
// 传入对象不能为空
if (baseEquipment.size() == 0 || StringUtils.isNull(baseEquipment)) {
return error(500, "导入的设备信息不能为空!信息导入失败!");
}
// 循环遍历校验数据是否为空
for (BaseEquipment table : baseEquipment) {
// 设备编码
if (table.getEquipmentCode().isEmpty() || table.getEquipmentCode() == null) {
return error(500, "设备编码不能为空!信息导入失败!");
}
// 订单号
if (table.getEquipmentName().isEmpty() || table.getEquipmentName() == null) {
return error(500, "设备名称不能为空!信息导入失败!");
}
// 物料号
if (table.getEquipmentTypeCode().isEmpty() || table.getEquipmentTypeCode() == null) {
return error(500, "设备类型编码不能为空!信息导入失败!");
}
// 物料名称
if (table.getEquipmentTypeName().isEmpty() || table.getEquipmentTypeName() == null) {
return error(500, "设备类型名称不能为空!信息导入失败!");
}
//购买时间
}
return success();
}
public String syncImportFunc(List<BaseEquipment> baseEquipment){
String failEquipment = "";
for (BaseEquipment table:baseEquipment) {
String msg = syncFunc(table);
if(StringUtils.isNotBlank(msg)){
failEquipment += msg+",";
}
}
return failEquipment;
}
@Transactional(rollbackFor = Exception.class)
public String syncFunc(BaseEquipment table){
String failEquipment = "";
BaseEquipment equipmentExist = baseEquipmentMapper.selectExistByEquipmentCode(table.getEquipmentCode());
//不存在就插入
if (equipmentExist == null) {
baseEquipmentMapper.insertBaseEquipment(table);
logger.info("=======设备"+ table.getEquipmentCode() + "=======导入成功");
//存在,不允许插入
} else {
failEquipment = table.getEquipmentCode();
logger.info("=======设备"+ failEquipment + "=======导入失败");
}
return failEquipment;
}
}

@ -26,17 +26,141 @@
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="delFlag" column="del_flag" />
<result property="unitWorkingHours" column="unit_working_hours" />
<result property="workshopSection" column="workshop_section" />
<result property="equipmentLocation" column="equipment_location" />
<result property="hourlyUnitPrice" column="hourly_unit_price" />
<result property="delFlag" column="del_flag" />
<result property="plcIp" column="plc_ip" />
<result property="plcPort" column="plc_port" />
<result property="equipmentBarcode" column="equipment_barcode" />
<result property="equipmentBarcodeImage" column="equipment_barcode_image" />
<result property="manufacturer" column="manufacturer" />
<result property="supplier" column="supplier" />
<result property="useLife" column="use_life" />
<result property="buyTime" column="buy_time" />
<result property="assetOriginalValue" column="asset_original_value" />
<result property="netAssetValue" column="net_asset_value" />
<result property="assetHead" column="asset_head" />
<result property="fixedAssetCode" column="fixed_asset_code" />
<result property="department" column="department" />
<result property="sapAsset" column="sap_asset" />
<result property="equipmentHead" column="equipment_head" />
<result property="factoryCode" column="factory_code" />
</resultMap>
<resultMap type="WmsSparePartsLedger" id="WmsSparePartsLedgerResult">
<result property="materialCode" column="material_code" />
<result property="materialDesc" column="material_desc" />
<result property="amount" column="amount" />
<result property="storageType" column="storage_type" />
<result property="spareUseLife" column="spare_use_life" />
<result property="spareName" column="spare_name" />
<result property="spareMode" column="spare_mode" />
<result property="spareManufacturer" column="spare_manufacturer" />
<result property="spareSupplier" column="spare_supplier" />
<result property="spareReplacementCycle" column="spare_replacement_cycle" />
<result property="spareMeasurementUnit" column="spare_measurement_unit" />
<result property="spareConversionUnit" column="spare_conversion_unit" />
<result property="spareConversionRatio" column="spare_conversion_ratio" />
<result property="spareInventoryFloor" column="spare_inventory_floor" />
<result property="spareInventoryUpper" column="spare_inventory_upper" />
<result property="spareType" column="spare_type" />
<result property="createBy" column="create_by" />
<result property="gmtCreate" column="gmt_create" />
<result property="lastModifiedBy" column="last_modified_by" />
<result property="gmtModified" column="gmt_modified" />
<result property="activeFlag" column="active_flag" />
<result property="factoryCode" column="factory_code" />
<result property="sapFactoryCode" column="sap_factory_code" />
<result property="delFlag" column="del_flag" />
</resultMap>
<resultMap type="EquSpareEquipment" id="EquSpareEquipmentResult">
<result property="id" column="id" />
<result property="spareCode" column="spare_code" />
<result property="spareType" column="spare_type" />
<result property="spareName" column="spare_name" />
<result property="equipmentName" column="equipment_name" />
<result property="equipmentCode" column="equipment_code" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="factoryCode" column="factory_code" />
</resultMap>
<resultMap type="com.op.common.core.domain.BaseFileData" id="FileResult">
<result property="fileId" column="file_id" />
<result property="fileName" column="file_name" />
<result property="fileAddress" column="file_address" />
<result property="sourceId" column="source_id" />
<result property="remark" column="remark" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="attr4" column="attr4" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="imageType" column="image_type" />
</resultMap>
<sql id="selectBaseFileVo">
select file_id, file_name, file_address, source_id, remark, attr1,
attr2, attr3, attr4, create_by, create_time, update_by,
update_time,image_type from base_file
</sql>
<sql id="selectBaseEquipmentVo">
select equipment_id, equipment_code, equipment_name, equipment_brand, equipment_spec, equipment_type_id, equipment_type_code, equipment_type_name, workshop_id, workshop_code, workshop_name, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time, workshop_section, equipment_location, hourly_unit_price,unit_working_hours,del_flag,plc_ip,plc_port from base_equipment
select
equipment_id,
equipment_code,
equipment_name,
equipment_brand,
equipment_spec,
equipment_type_id,
equipment_type_code,
equipment_type_name,
workshop_id,
workshop_code,
workshop_name,
status,
remark,
attr1,
attr2,
attr3,
attr4,
create_by,
create_time,
update_by,
update_time,
workshop_section,
equipment_location,
hourly_unit_price,
unit_working_hours,
del_flag,
plc_ip,
plc_port,
sap_asset,
equipment_barcode,
equipment_barcode_image,
manufacturer,
supplier,
use_life,
buy_time,
asset_original_value,
net_asset_value,
asset_head,
fixed_asset_code,
department,
equipment_head
from base_equipment
</sql>
<select id="selectBaseEquipmentList" parameterType="BaseEquipment" resultMap="BaseEquipmentResult">
@ -63,6 +187,20 @@
<if test="hourlyUnitPrice != null and hourlyUnitPrice != ''"> and hourly_unit_price = #{hourlyUnitPrice}</if>
<if test="plcIp != null and plcIp != ''"> and plc_ip = #{plcIp}</if>
<if test="plcPort != null and plcPort != ''"> and plc_port = #{plcPort}</if>
<if test="equipmentHead != null and equipmentHead != ''"> and equipment_head = #{equipmentHead}</if>
<if test="equipmentBarcode != null and equipmentBarcode != ''"> and equipment_barcode = #{equipmentBarcode}</if>
<if test="equipmentBarcodeImage != null and equipmentBarcodeImage != ''"> and equipment_barcode_image = #{equipmentBarcodeImage}</if>
<if test="manufacturer != null and manufacturer != ''"> and manufacturer = #{manufacturer}</if>
<if test="supplier != null and supplier != ''"> and supplier = #{supplier}</if>
<if test="useLife != null and useLife != ''"> and use_life = #{useLife}</if>
<if test="buyTime != null "> and buy_time = #{buyTime}</if>
<if test="assetOriginalValue != null and assetOriginalValue != ''"> and asset_original_value = #{assetOriginalValue}</if>
<if test="netAssetValue != null and netAssetValue != ''"> and net_asset_value = #{netAssetValue}</if>
<if test="assetHead != null and assetHead != ''"> and asset_head = #{assetHead}</if>
<if test="fixedAssetCode != null and fixedAssetCode != ''"> and fixed_asset_code = #{fixedAssetCode}</if>
<if test="department != null and department != ''"> and department = #{department}</if>
<if test="sapAsset != null and sapAsset != ''"> and sap_asset = #{sapAsset}</if>
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
and del_flag ='0'
</where>
</select>
@ -102,6 +240,20 @@
<if test="hourlyUnitPrice != null and hourlyUnitPrice != ''">hourly_unit_price,</if>
<if test="plcIp != null and plcIp != ''">plc_ip,</if>
<if test="plcPort != null and plcPort != ''">plc_port,</if>
<if test="equipmentBarcode != null">equipment_barcode,</if>
<if test="equipmentBarcodeImage != null">equipment_barcode_image,</if>
<if test="manufacturer != null">manufacturer,</if>
<if test="supplier != null">supplier,</if>
<if test="useLife != null">use_life,</if>
<if test="buyTime != null">buy_time,</if>
<if test="assetOriginalValue != null">asset_original_value,</if>
<if test="netAssetValue != null">net_asset_value,</if>
<if test="assetHead != null">asset_head,</if>
<if test="fixedAssetCode != null">fixed_asset_code,</if>
<if test="department != null">department,</if>
<if test="sapAsset != null">sap_asset,</if>
<if test="equipmentHead != null">equipment_head,</if>
<if test="factoryCode != null">factory_code,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="equipmentCode != null and equipmentCode != ''">#{equipmentCode},</if>
@ -130,6 +282,20 @@
<if test="hourlyUnitPrice != null and hourlyUnitPrice != ''">#{hourlyUnitPrice},</if>
<if test="plcIp != null and plcIp != ''">#{plcIp},</if>
<if test="plcPort != null and plcPort != ''">#{plcPort},</if>
<if test="equipmentBarcode != null">#{equipmentBarcode},</if>
<if test="equipmentBarcodeImage != null">#{equipmentBarcodeImage},</if>
<if test="manufacturer != null">#{manufacturer},</if>
<if test="supplier != null">#{supplier},</if>
<if test="useLife != null">#{useLife},</if>
<if test="buyTime != null">#{buyTime},</if>
<if test="assetOriginalValue != null">#{assetOriginalValue},</if>
<if test="netAssetValue != null">#{netAssetValue},</if>
<if test="assetHead != null">#{assetHead},</if>
<if test="fixedAssetCode != null">#{fixedAssetCode},</if>
<if test="department != null">#{department},</if>
<if test="sapAsset != null">#{sapAsset},</if>
<if test="equipmentHead != null">#{equipmentHead},</if>
<if test="factoryCode != null">#{factoryCode},</if>
</trim>
</insert>
@ -162,6 +328,20 @@
<if test="hourlyUnitPrice != null and hourlyUnitPrice != ''">hourly_unit_price = #{hourlyUnitPrice},</if>
<if test="plcIp != null and plcIp != ''">plc_ip = #{plcIp},</if>
<if test="plcPort != null and plcPort != ''">plc_port = #{plcPort},</if>
<if test="equipmentBarcode != null">equipment_barcode = #{equipmentBarcode},</if>
<if test="equipmentBarcodeImage != null">equipment_barcode_image = #{equipmentBarcodeImage},</if>
<if test="manufacturer != null">manufacturer = #{manufacturer},</if>
<if test="supplier != null">supplier = #{supplier},</if>
<if test="useLife != null">use_life = #{useLife},</if>
<if test="buyTime != null">buy_time = #{buyTime},</if>
<if test="assetOriginalValue != null">asset_original_value = #{assetOriginalValue},</if>
<if test="netAssetValue != null">net_asset_value = #{netAssetValue},</if>
<if test="assetHead != null">asset_head = #{assetHead},</if>
<if test="fixedAssetCode != null">fixed_asset_code = #{fixedAssetCode},</if>
<if test="department != null">department = #{department},</if>
<if test="sapAsset != null">sap_asset = #{sapAsset},</if>
<if test="equipmentHead != null">equipment_head = #{equipmentHead},</if>
<if test="factoryCode != null">factory_code = #{factoryCode},</if>
</trim>
where equipment_id = #{equipmentId}
</update>
@ -223,4 +403,115 @@
group by equipment_type_code,equipment_type_name
</select>
<select id="getSparePartsList" parameterType="WmsSparePartsLedger" resultMap="WmsSparePartsLedgerResult">
select *
from wms_ods_mate_storage_news
where del_flag = '0'
</select>
<select id="getRightSparePartsList" parameterType="BaseEquipment" resultMap="EquSpareEquipmentResult">
select *
from equ_spare_equipment
where del_flag = '0'
and equipment_code = #{equipmentCode}
</select>
<select id="getEquipmentId" parameterType="String" resultType="Long">
select equipment_id
from base_equipment
where equipment_code = #{equipmentCode}
and del_flag = '0'
</select>
<insert id="bindSpareParts" parameterType="EquSpareEquipment">
insert into equ_spare_equipment
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="spareCode != null">spare_code,</if>
<if test="spareType != null">spare_type,</if>
<if test="spareName != null">spare_name,</if>
<if test="equipmentName != null">equipment_name,</if>
<if test="equipmentCode != null">equipment_code,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="factoryCode != null">factory_code,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="spareCode != null">#{spareCode},</if>
<if test="spareType != null">#{spareType},</if>
<if test="spareName != null">#{spareName},</if>
<if test="equipmentName != null">#{equipmentName},</if>
<if test="equipmentCode != null">#{equipmentCode},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="factoryCode != null">#{factoryCode},</if>
</trim>
</insert>
<insert id="insertBaseFileBatch">
INSERT INTO base_file(file_id, file_name, file_address, source_id, remark, create_by, create_time,image_type)
VALUES
<foreach collection="baseFiles" index="" item="baseFile" separator=",">
(
#{baseFile.fileId},
#{baseFile.fileName},
#{baseFile.fileAddress},
#{baseFile.sourceId},
#{baseFile.remark},
#{baseFile.createBy},
#{baseFile.createTime},
#{baseFile.imageType}
)
</foreach>
</insert>
<select id="getImageFileBatch" resultMap="FileResult">
<include refid="selectBaseFileVo"/>
where source_id = #{sourceId}
and image_type = #{imageType}
</select>
<select id="getQrFileBatch" resultMap="FileResult">
<include refid="selectBaseFileVo"/>
where source_id = #{sourceId}
and image_type = #{imageType}
</select>
<select id="getBarcodeFileBatch" resultMap="FileResult">
<include refid="selectBaseFileVo"/>
where source_id = #{sourceId}
and image_type = #{imageType}
</select>
<delete id="deleteBaseFileBySourceId">
delete from base_file where source_id = #{sourceId}
</delete>
<delete id="deleteEquSpareEquipmentByCode" parameterType="String">
delete from equ_spare_equipment where equipment_code = #{equipmentCode}
</delete>
<select id="getSpareCodeList" parameterType="com.op.wms.domain.EquSpareEquipment" resultType="com.op.wms.domain.EquSpareEquipment">
select
id,
spare_code AS spareCode,
spare_name AS spareName
from
equ_spare_equipment
where equipment_code = #{equipmentCode}
</select>
<select id="selectExistByEquipmentCode" parameterType="BaseEquipment" resultMap="BaseEquipmentResult">
<include refid="selectBaseEquipmentVo"/>
where equipment_code = #{equipmentCode}
and del_flag ='0'
</select>
</mapper>

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.op.wms.mapper.EquSpareEquipmentMapper">
<resultMap type="EquSpareEquipment" id="EquSpareEquipmentResult">
<result property="id" column="id" />
<result property="spareCode" column="spare_code" />
<result property="spareType" column="spare_type" />
<result property="spareName" column="spare_name" />
<result property="equipmentName" column="equipment_name" />
<result property="equipmentCode" column="equipment_code" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="factoryCode" column="factory_code" />
</resultMap>
<sql id="selectEquSpareEquipmentVo">
select id, spare_code, spare_type, spare_name, equipment_name, equipment_code, attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time, factory_code from equ_spare_equipment
</sql>
<select id="selectEquSpareEquipmentList" parameterType="EquSpareEquipment" resultMap="EquSpareEquipmentResult">
<include refid="selectEquSpareEquipmentVo"/>
<where>
<if test="spareCode != null and spareCode != ''"> and spare_code = #{spareCode}</if>
<if test="spareType != null and spareType != ''"> and spare_type = #{spareType}</if>
<if test="spareName != null and spareName != ''"> and spare_name like concat('%', #{spareName}, '%')</if>
<if test="equipmentName != null and equipmentName != ''"> and equipment_name like concat('%', #{equipmentName}, '%')</if>
<if test="equipmentCode != null and equipmentCode != ''"> and equipment_code = #{equipmentCode}</if>
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
<if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if>
<if test="attr3 != null and attr3 != ''"> and attr3 = #{attr3}</if>
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
</where>
</select>
<select id="selectEquSpareEquipmentById" parameterType="String" resultMap="EquSpareEquipmentResult">
<include refid="selectEquSpareEquipmentVo"/>
where id = #{id}
</select>
<insert id="insertEquSpareEquipment" parameterType="EquSpareEquipment">
insert into equ_spare_equipment
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="spareCode != null">spare_code,</if>
<if test="spareType != null">spare_type,</if>
<if test="spareName != null">spare_name,</if>
<if test="equipmentName != null">equipment_name,</if>
<if test="equipmentCode != null">equipment_code,</if>
<if test="attr1 != null">attr1,</if>
<if test="attr2 != null">attr2,</if>
<if test="attr3 != null">attr3,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="factoryCode != null">factory_code,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="spareCode != null">#{spareCode},</if>
<if test="spareType != null">#{spareType},</if>
<if test="spareName != null">#{spareName},</if>
<if test="equipmentName != null">#{equipmentName},</if>
<if test="equipmentCode != null">#{equipmentCode},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
<if test="attr3 != null">#{attr3},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="factoryCode != null">#{factoryCode},</if>
</trim>
</insert>
<update id="updateEquSpareEquipment" parameterType="EquSpareEquipment">
update equ_spare_equipment
<trim prefix="SET" suffixOverrides=",">
<if test="spareCode != null">spare_code = #{spareCode},</if>
<if test="spareType != null">spare_type = #{spareType},</if>
<if test="spareName != null">spare_name = #{spareName},</if>
<if test="equipmentName != null">equipment_name = #{equipmentName},</if>
<if test="equipmentCode != null">equipment_code = #{equipmentCode},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if>
<if test="attr3 != null">attr3 = #{attr3},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="factoryCode != null">factory_code = #{factoryCode},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEquSpareEquipmentById" parameterType="String">
delete from equ_spare_equipment where id = #{id}
</delete>
<delete id="deleteEquSpareEquipmentByIds" parameterType="String">
delete from equ_spare_equipment where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
Loading…
Cancel
Save