生产:PDA接口托盘与物料绑定
master
xins 7 months ago
parent 0a91a2028e
commit 37bc38615b

@ -0,0 +1,36 @@
package com.hw.mes.controller;
import com.hw.common.core.web.controller.BaseController;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.common.log.annotation.Log;
import com.hw.common.log.enums.BusinessType;
import com.hw.mes.domain.vo.*;
import com.hw.mes.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* MESController
*
* @author xins
* @date 2024-04-15
*/
@RestController
@RequestMapping("/mobile")
public class MesMobileController extends BaseController {
@Autowired
private IMesBasePalletInfoService mesBasePalletInfoService;
/**
*
*/
@Log(title = "托盘信息", businessType = BusinessType.BIND)
@PostMapping(("/bindPalletInfo"))
public AjaxResult bindPalletInfo(@Validated @RequestBody MesPalletInfoBindVo mesPalletInfoBindVo) {
return success(mesBasePalletInfoService.bindPalletInfo(mesPalletInfoBindVo));
}
}

@ -1,5 +1,6 @@
package com.hw.mes.domain; package com.hw.mes.domain;
import java.math.BigDecimal;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel; import com.hw.common.core.annotation.Excel;
@ -7,9 +8,9 @@ import com.hw.common.core.web.domain.BaseEntity;
/** /**
* mes_base_pallet_info * mes_base_pallet_info
* *
* @author Yinq * @author Yinq
* @date 2024-01-26 * @date 2024-04-15
*/ */
public class MesBasePalletInfo extends BaseEntity public class MesBasePalletInfo extends BaseEntity
{ {
@ -18,39 +19,109 @@ public class MesBasePalletInfo extends BaseEntity
/** 托盘ID */ /** 托盘ID */
private Long palletInfoId; private Long palletInfoId;
/** RFID编码 */ /** 托盘信息RFID编码,不能修改 */
@Excel(name = "RFID编码") @Excel(name = "托盘信息RFID编码,不能修改")
private String palletInfoCode; private String palletInfoCode;
public void setPalletInfoId(Long palletInfoId) /** 物料ID关联物料信息主键 */
@Excel(name = "物料ID关联物料信息主键")
private Long materialId;
/** 物料编号 */
@Excel(name = "物料编号")
private String materialCode;
/** 物料名称 */
@Excel(name = "物料名称")
private String materialName;
/** 物料条码 */
@Excel(name = "物料条码")
private String materialBarcode;
/** 绑定数量 */
@Excel(name = "绑定数量")
private BigDecimal bindAmount;
public void setPalletInfoId(Long palletInfoId)
{ {
this.palletInfoId = palletInfoId; this.palletInfoId = palletInfoId;
} }
public Long getPalletInfoId() public Long getPalletInfoId()
{ {
return palletInfoId; return palletInfoId;
} }
public void setPalletInfoCode(String palletInfoCode) public void setPalletInfoCode(String palletInfoCode)
{ {
this.palletInfoCode = palletInfoCode; this.palletInfoCode = palletInfoCode;
} }
public String getPalletInfoCode() public String getPalletInfoCode()
{ {
return palletInfoCode; return palletInfoCode;
} }
public void setMaterialId(Long materialId)
{
this.materialId = materialId;
}
public Long getMaterialId()
{
return materialId;
}
public void setMaterialCode(String materialCode)
{
this.materialCode = materialCode;
}
public String getMaterialCode()
{
return materialCode;
}
public void setMaterialName(String materialName)
{
this.materialName = materialName;
}
public String getMaterialName()
{
return materialName;
}
public void setMaterialBarcode(String materialBarcode)
{
this.materialBarcode = materialBarcode;
}
public String getMaterialBarcode()
{
return materialBarcode;
}
public void setBindAmount(BigDecimal bindAmount)
{
this.bindAmount = bindAmount;
}
public BigDecimal getBindAmount()
{
return bindAmount;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("palletInfoId", getPalletInfoId()) .append("palletInfoId", getPalletInfoId())
.append("palletInfoCode", getPalletInfoCode()) .append("palletInfoCode", getPalletInfoCode())
.append("remark", getRemark()) .append("materialId", getMaterialId())
.append("createBy", getCreateBy()) .append("materialCode", getMaterialCode())
.append("createTime", getCreateTime()) .append("materialName", getMaterialName())
.append("updateBy", getUpdateBy()) .append("materialBarcode", getMaterialBarcode())
.append("updateTime", getUpdateTime()) .append("remark", getRemark())
.toString(); .append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("bindAmount", getBindAmount())
.toString();
} }
} }

@ -0,0 +1,25 @@
package com.hw.mes.domain.vo;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* @Description: VO
* @ClassName: MesPalletInfoBindVo
* @Author : xins
* @Date :2024-04-15 13:42
* @Version :1.0
*/
@Data
public class MesPalletInfoBindVo {
//物料条码
@NotBlank(message = "物料条码必须输入")
private String materialBarcode;
//托盘码
@NotBlank(message = "托盘码必须输入")
private String palletInfoCode;
}

@ -5,15 +5,15 @@ import com.hw.mes.domain.MesBasePalletInfo;
/** /**
* Mapper * Mapper
* *
* @author Yinq * @author Yinq
* @date 2024-01-26 * @date 2024-01-26
*/ */
public interface MesBasePalletInfoMapper public interface MesBasePalletInfoMapper
{ {
/** /**
* *
* *
* @param palletInfoId * @param palletInfoId
* @return * @return
*/ */
@ -21,7 +21,7 @@ public interface MesBasePalletInfoMapper
/** /**
* *
* *
* @param mesBasePalletInfo * @param mesBasePalletInfo
* @return * @return
*/ */
@ -29,7 +29,7 @@ public interface MesBasePalletInfoMapper
/** /**
* *
* *
* @param mesBasePalletInfo * @param mesBasePalletInfo
* @return * @return
*/ */
@ -37,7 +37,7 @@ public interface MesBasePalletInfoMapper
/** /**
* *
* *
* @param mesBasePalletInfo * @param mesBasePalletInfo
* @return * @return
*/ */
@ -45,7 +45,7 @@ public interface MesBasePalletInfoMapper
/** /**
* *
* *
* @param palletInfoId * @param palletInfoId
* @return * @return
*/ */
@ -53,9 +53,19 @@ public interface MesBasePalletInfoMapper
/** /**
* *
* *
* @param palletInfoIds * @param palletInfoIds
* @return * @return
*/ */
public int deleteMesBasePalletInfoByPalletInfoIds(Long[] palletInfoIds); public int deleteMesBasePalletInfoByPalletInfoIds(Long[] palletInfoIds);
/**
*
*
* @param palletInfoCode
* @return
*/
public MesBasePalletInfo selectMesBasePalletInfoByPalletInfoCode(String palletInfoCode);
} }

@ -2,18 +2,20 @@ package com.hw.mes.service;
import java.util.List; import java.util.List;
import com.hw.mes.domain.MesBasePalletInfo; import com.hw.mes.domain.MesBasePalletInfo;
import com.hw.mes.domain.vo.MesPalletInfoBindVo;
import org.springframework.transaction.annotation.Transactional;
/** /**
* Service * Service
* *
* @author Yinq * @author Yinq
* @date 2024-01-26 * @date 2024-01-26
*/ */
public interface IMesBasePalletInfoService public interface IMesBasePalletInfoService
{ {
/** /**
* *
* *
* @param palletInfoId * @param palletInfoId
* @return * @return
*/ */
@ -21,7 +23,7 @@ public interface IMesBasePalletInfoService
/** /**
* *
* *
* @param mesBasePalletInfo * @param mesBasePalletInfo
* @return * @return
*/ */
@ -29,7 +31,7 @@ public interface IMesBasePalletInfoService
/** /**
* *
* *
* @param mesBasePalletInfo * @param mesBasePalletInfo
* @return * @return
*/ */
@ -37,7 +39,7 @@ public interface IMesBasePalletInfoService
/** /**
* *
* *
* @param mesBasePalletInfo * @param mesBasePalletInfo
* @return * @return
*/ */
@ -45,7 +47,7 @@ public interface IMesBasePalletInfoService
/** /**
* *
* *
* @param palletInfoIds * @param palletInfoIds
* @return * @return
*/ */
@ -53,9 +55,17 @@ public interface IMesBasePalletInfoService
/** /**
* *
* *
* @param palletInfoId * @param palletInfoId
* @return * @return
*/ */
public int deleteMesBasePalletInfoByPalletInfoId(Long palletInfoId); public int deleteMesBasePalletInfoByPalletInfoId(Long palletInfoId);
/**
*
* @param mesPalletInfoBindVo
* @return
*/
public int bindPalletInfo(MesPalletInfoBindVo mesPalletInfoBindVo);
} }

@ -1,59 +1,65 @@
package com.hw.mes.service.impl; package com.hw.mes.service.impl;
import java.util.Date;
import java.util.List; import java.util.List;
import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.DateUtils; import com.hw.common.core.utils.DateUtils;
import com.hw.common.security.utils.SecurityUtils; import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.api.domain.MesBaseBarcodeInfo;
import com.hw.mes.domain.vo.MesPalletInfoBindVo;
import com.hw.mes.mapper.MesBaseBarcodeInfoMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.hw.mes.mapper.MesBasePalletInfoMapper; import com.hw.mes.mapper.MesBasePalletInfoMapper;
import com.hw.mes.domain.MesBasePalletInfo; import com.hw.mes.domain.MesBasePalletInfo;
import com.hw.mes.service.IMesBasePalletInfoService; import com.hw.mes.service.IMesBasePalletInfoService;
import org.springframework.transaction.annotation.Transactional;
/** /**
* Service * Service
* *
* @author Yinq * @author Yinq
* @date 2024-01-26 * @date 2024-01-26
*/ */
@Service @Service
public class MesBasePalletInfoServiceImpl implements IMesBasePalletInfoService public class MesBasePalletInfoServiceImpl implements IMesBasePalletInfoService {
{
@Autowired @Autowired
private MesBasePalletInfoMapper mesBasePalletInfoMapper; private MesBasePalletInfoMapper mesBasePalletInfoMapper;
@Autowired
private MesBaseBarcodeInfoMapper mesBaseBarcodeInfoMapper;
/** /**
* *
* *
* @param palletInfoId * @param palletInfoId
* @return * @return
*/ */
@Override @Override
public MesBasePalletInfo selectMesBasePalletInfoByPalletInfoId(Long palletInfoId) public MesBasePalletInfo selectMesBasePalletInfoByPalletInfoId(Long palletInfoId) {
{
return mesBasePalletInfoMapper.selectMesBasePalletInfoByPalletInfoId(palletInfoId); return mesBasePalletInfoMapper.selectMesBasePalletInfoByPalletInfoId(palletInfoId);
} }
/** /**
* *
* *
* @param mesBasePalletInfo * @param mesBasePalletInfo
* @return * @return
*/ */
@Override @Override
public List<MesBasePalletInfo> selectMesBasePalletInfoList(MesBasePalletInfo mesBasePalletInfo) public List<MesBasePalletInfo> selectMesBasePalletInfoList(MesBasePalletInfo mesBasePalletInfo) {
{
return mesBasePalletInfoMapper.selectMesBasePalletInfoList(mesBasePalletInfo); return mesBasePalletInfoMapper.selectMesBasePalletInfoList(mesBasePalletInfo);
} }
/** /**
* *
* *
* @param mesBasePalletInfo * @param mesBasePalletInfo
* @return * @return
*/ */
@Override @Override
public int insertMesBasePalletInfo(MesBasePalletInfo mesBasePalletInfo) public int insertMesBasePalletInfo(MesBasePalletInfo mesBasePalletInfo) {
{
mesBasePalletInfo.setCreateTime(DateUtils.getNowDate()); mesBasePalletInfo.setCreateTime(DateUtils.getNowDate());
mesBasePalletInfo.setCreateBy(SecurityUtils.getUsername()); mesBasePalletInfo.setCreateBy(SecurityUtils.getUsername());
return mesBasePalletInfoMapper.insertMesBasePalletInfo(mesBasePalletInfo); return mesBasePalletInfoMapper.insertMesBasePalletInfo(mesBasePalletInfo);
@ -61,13 +67,12 @@ public class MesBasePalletInfoServiceImpl implements IMesBasePalletInfoService
/** /**
* *
* *
* @param mesBasePalletInfo * @param mesBasePalletInfo
* @return * @return
*/ */
@Override @Override
public int updateMesBasePalletInfo(MesBasePalletInfo mesBasePalletInfo) public int updateMesBasePalletInfo(MesBasePalletInfo mesBasePalletInfo) {
{
mesBasePalletInfo.setUpdateTime(DateUtils.getNowDate()); mesBasePalletInfo.setUpdateTime(DateUtils.getNowDate());
mesBasePalletInfo.setUpdateBy(SecurityUtils.getUsername()); mesBasePalletInfo.setUpdateBy(SecurityUtils.getUsername());
return mesBasePalletInfoMapper.updateMesBasePalletInfo(mesBasePalletInfo); return mesBasePalletInfoMapper.updateMesBasePalletInfo(mesBasePalletInfo);
@ -75,25 +80,62 @@ public class MesBasePalletInfoServiceImpl implements IMesBasePalletInfoService
/** /**
* *
* *
* @param palletInfoIds * @param palletInfoIds
* @return * @return
*/ */
@Override @Override
public int deleteMesBasePalletInfoByPalletInfoIds(Long[] palletInfoIds) public int deleteMesBasePalletInfoByPalletInfoIds(Long[] palletInfoIds) {
{
return mesBasePalletInfoMapper.deleteMesBasePalletInfoByPalletInfoIds(palletInfoIds); return mesBasePalletInfoMapper.deleteMesBasePalletInfoByPalletInfoIds(palletInfoIds);
} }
/** /**
* *
* *
* @param palletInfoId * @param palletInfoId
* @return * @return
*/ */
@Override @Override
public int deleteMesBasePalletInfoByPalletInfoId(Long palletInfoId) public int deleteMesBasePalletInfoByPalletInfoId(Long palletInfoId) {
{
return mesBasePalletInfoMapper.deleteMesBasePalletInfoByPalletInfoId(palletInfoId); return mesBasePalletInfoMapper.deleteMesBasePalletInfoByPalletInfoId(palletInfoId);
} }
/**
*
* @param mesPalletInfoBindVo
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int bindPalletInfo(MesPalletInfoBindVo mesPalletInfoBindVo) {
String palletInfoCode = mesPalletInfoBindVo.getPalletInfoCode();
String materialBarcode = mesPalletInfoBindVo.getMaterialBarcode();
MesBaseBarcodeInfo mesBaseBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByBarcodeInfo(materialBarcode);
if (mesBaseBarcodeInfo == null) {
throw new ServiceException("物料条码有误");
}
MesBasePalletInfo mesBasePalletInfo = mesBasePalletInfoMapper.selectMesBasePalletInfoByPalletInfoCode(palletInfoCode);
if (mesBasePalletInfo == null) {
throw new ServiceException("托盘码有误");
}
String userName = SecurityUtils.getUsername();
Date currentDate = new Date();
mesBaseBarcodeInfo.setPalletInfoCode(palletInfoCode);
mesBaseBarcodeInfo.setUpdateBy(userName);
mesBaseBarcodeInfo.setUpdateTime(currentDate);
mesBaseBarcodeInfoMapper.updateMesBaseBarcodeInfo(mesBaseBarcodeInfo);
mesBasePalletInfo.setMaterialBarcode(materialBarcode);
mesBasePalletInfo.setMaterialId(mesBaseBarcodeInfo.getMaterialId());
mesBasePalletInfo.setMaterialName(mesBaseBarcodeInfo.getMaterialName());
mesBasePalletInfo.setUpdateBy(userName);
mesBasePalletInfo.setUpdateTime(currentDate);
return mesBasePalletInfoMapper.updateMesBasePalletInfo(mesBasePalletInfo);
}
} }

@ -5,18 +5,22 @@
<mapper namespace="com.hw.mes.mapper.MesBasePalletInfoMapper"> <mapper namespace="com.hw.mes.mapper.MesBasePalletInfoMapper">
<resultMap type="MesBasePalletInfo" id="MesBasePalletInfoResult"> <resultMap type="MesBasePalletInfo" id="MesBasePalletInfoResult">
<result property="palletInfoId" column="pallet_info_id"/> <result property="palletInfoId" column="pallet_info_id" />
<result property="palletInfoCode" column="pallet_info_code"/> <result property="palletInfoCode" column="pallet_info_code" />
<result property="remark" column="remark"/> <result property="materialId" column="material_id" />
<result property="createBy" column="create_by"/> <result property="materialCode" column="material_code" />
<result property="createTime" column="create_time"/> <result property="materialName" column="material_name" />
<result property="updateBy" column="update_by"/> <result property="materialBarcode" column="material_barcode" />
<result property="updateTime" column="update_time"/> <result property="remark" column="remark" />
<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="bindAmount" column="bind_amount" />
</resultMap> </resultMap>
<sql id="selectMesBasePalletInfoVo"> <sql id="selectMesBasePalletInfoVo">
select pallet_info_id, pallet_info_code, remark, create_by, create_time, update_by, update_time select pallet_info_id, pallet_info_code, material_id, material_code, material_name, material_barcode, remark, create_by, create_time, update_by, update_time, bind_amount from mes_base_pallet_info
from mes_base_pallet_info
</sql> </sql>
<select id="selectMesBasePalletInfoList" parameterType="MesBasePalletInfo" resultMap="MesBasePalletInfoResult"> <select id="selectMesBasePalletInfoList" parameterType="MesBasePalletInfo" resultMap="MesBasePalletInfoResult">
@ -31,24 +35,33 @@
where pallet_info_id = #{palletInfoId} where pallet_info_id = #{palletInfoId}
</select> </select>
<insert id="insertMesBasePalletInfo" parameterType="MesBasePalletInfo" useGeneratedKeys="true" <insert id="insertMesBasePalletInfo" parameterType="MesBasePalletInfo" useGeneratedKeys="true" keyProperty="palletInfoId">
keyProperty="palletInfoId">
insert into mes_base_pallet_info insert into mes_base_pallet_info
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="palletInfoCode != null and palletInfoCode != ''">pallet_info_code,</if> <if test="palletInfoCode != null and palletInfoCode != ''">pallet_info_code,</if>
<if test="materialId != null">material_id,</if>
<if test="materialCode != null">material_code,</if>
<if test="materialName != null">material_name,</if>
<if test="materialBarcode != null">material_barcode,</if>
<if test="remark != null">remark,</if> <if test="remark != null">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if> <if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if> <if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if> <if test="updateTime != null">update_time,</if>
<if test="bindAmount != null">bind_amount,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="palletInfoCode != null and palletInfoCode != ''">#{palletInfoCode},</if> <if test="palletInfoCode != null and palletInfoCode != ''">#{palletInfoCode},</if>
<if test="materialId != null">#{materialId},</if>
<if test="materialCode != null">#{materialCode},</if>
<if test="materialName != null">#{materialName},</if>
<if test="materialBarcode != null">#{materialBarcode},</if>
<if test="remark != null">#{remark},</if> <if test="remark != null">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if> <if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if> <if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if> <if test="updateTime != null">#{updateTime},</if>
<if test="bindAmount != null">#{bindAmount},</if>
</trim> </trim>
</insert> </insert>
@ -56,11 +69,16 @@
update mes_base_pallet_info update mes_base_pallet_info
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="palletInfoCode != null and palletInfoCode != ''">pallet_info_code = #{palletInfoCode},</if> <if test="palletInfoCode != null and palletInfoCode != ''">pallet_info_code = #{palletInfoCode},</if>
<if test="materialId != null">material_id = #{materialId},</if>
<if test="materialCode != null">material_code = #{materialCode},</if>
<if test="materialName != null">material_name = #{materialName},</if>
<if test="materialBarcode != null">material_barcode = #{materialBarcode},</if>
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if> <if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if> <if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if> <if test="updateTime != null">update_time = #{updateTime},</if>
<if test="bindAmount != null">bind_amount = #{bindAmount},</if>
</trim> </trim>
where pallet_info_id = #{palletInfoId} where pallet_info_id = #{palletInfoId}
</update> </update>
@ -77,4 +95,13 @@
#{palletInfoId} #{palletInfoId}
</foreach> </foreach>
</delete> </delete>
</mapper>
<select id="selectMesBasePalletInfoByPalletInfoCode" parameterType="String" resultMap="MesBasePalletInfoResult">
<include refid="selectMesBasePalletInfoVo"/>
where pallet_info_code = #{palletInfoCode}
</select>
</mapper>

Loading…
Cancel
Save