生产: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;
import java.math.BigDecimal;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel;
@ -9,7 +10,7 @@ import com.hw.common.core.web.domain.BaseEntity;
* mes_base_pallet_info
*
* @author Yinq
* @date 2024-01-26
* @date 2024-04-15
*/
public class MesBasePalletInfo extends BaseEntity
{
@ -18,10 +19,30 @@ public class MesBasePalletInfo extends BaseEntity
/** 托盘ID */
private Long palletInfoId;
/** RFID编码 */
@Excel(name = "RFID编码")
/** 托盘信息RFID编码,不能修改 */
@Excel(name = "托盘信息RFID编码,不能修改")
private String palletInfoCode;
/** 物料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;
@ -40,17 +61,67 @@ public class MesBasePalletInfo extends BaseEntity
{
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
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("palletInfoId", getPalletInfoId())
.append("palletInfoCode", getPalletInfoCode())
.append("remark", getRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
.append("palletInfoId", getPalletInfoId())
.append("palletInfoCode", getPalletInfoCode())
.append("materialId", getMaterialId())
.append("materialCode", getMaterialCode())
.append("materialName", getMaterialName())
.append("materialBarcode", getMaterialBarcode())
.append("remark", getRemark())
.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;
}

@ -58,4 +58,14 @@ public interface MesBasePalletInfoMapper
* @return
*/
public int deleteMesBasePalletInfoByPalletInfoIds(Long[] palletInfoIds);
/**
*
*
* @param palletInfoCode
* @return
*/
public MesBasePalletInfo selectMesBasePalletInfoByPalletInfoCode(String palletInfoCode);
}

@ -2,6 +2,8 @@ package com.hw.mes.service;
import java.util.List;
import com.hw.mes.domain.MesBasePalletInfo;
import com.hw.mes.domain.vo.MesPalletInfoBindVo;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
@ -58,4 +60,12 @@ public interface IMesBasePalletInfoService
* @return
*/
public int deleteMesBasePalletInfoByPalletInfoId(Long palletInfoId);
/**
*
* @param mesPalletInfoBindVo
* @return
*/
public int bindPalletInfo(MesPalletInfoBindVo mesPalletInfoBindVo);
}

@ -1,13 +1,20 @@
package com.hw.mes.service.impl;
import java.util.Date;
import java.util.List;
import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.DateUtils;
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.stereotype.Service;
import com.hw.mes.mapper.MesBasePalletInfoMapper;
import com.hw.mes.domain.MesBasePalletInfo;
import com.hw.mes.service.IMesBasePalletInfoService;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
@ -16,11 +23,13 @@ import com.hw.mes.service.IMesBasePalletInfoService;
* @date 2024-01-26
*/
@Service
public class MesBasePalletInfoServiceImpl implements IMesBasePalletInfoService
{
public class MesBasePalletInfoServiceImpl implements IMesBasePalletInfoService {
@Autowired
private MesBasePalletInfoMapper mesBasePalletInfoMapper;
@Autowired
private MesBaseBarcodeInfoMapper mesBaseBarcodeInfoMapper;
/**
*
*
@ -28,8 +37,7 @@ public class MesBasePalletInfoServiceImpl implements IMesBasePalletInfoService
* @return
*/
@Override
public MesBasePalletInfo selectMesBasePalletInfoByPalletInfoId(Long palletInfoId)
{
public MesBasePalletInfo selectMesBasePalletInfoByPalletInfoId(Long palletInfoId) {
return mesBasePalletInfoMapper.selectMesBasePalletInfoByPalletInfoId(palletInfoId);
}
@ -40,8 +48,7 @@ public class MesBasePalletInfoServiceImpl implements IMesBasePalletInfoService
* @return
*/
@Override
public List<MesBasePalletInfo> selectMesBasePalletInfoList(MesBasePalletInfo mesBasePalletInfo)
{
public List<MesBasePalletInfo> selectMesBasePalletInfoList(MesBasePalletInfo mesBasePalletInfo) {
return mesBasePalletInfoMapper.selectMesBasePalletInfoList(mesBasePalletInfo);
}
@ -52,8 +59,7 @@ public class MesBasePalletInfoServiceImpl implements IMesBasePalletInfoService
* @return
*/
@Override
public int insertMesBasePalletInfo(MesBasePalletInfo mesBasePalletInfo)
{
public int insertMesBasePalletInfo(MesBasePalletInfo mesBasePalletInfo) {
mesBasePalletInfo.setCreateTime(DateUtils.getNowDate());
mesBasePalletInfo.setCreateBy(SecurityUtils.getUsername());
return mesBasePalletInfoMapper.insertMesBasePalletInfo(mesBasePalletInfo);
@ -66,8 +72,7 @@ public class MesBasePalletInfoServiceImpl implements IMesBasePalletInfoService
* @return
*/
@Override
public int updateMesBasePalletInfo(MesBasePalletInfo mesBasePalletInfo)
{
public int updateMesBasePalletInfo(MesBasePalletInfo mesBasePalletInfo) {
mesBasePalletInfo.setUpdateTime(DateUtils.getNowDate());
mesBasePalletInfo.setUpdateBy(SecurityUtils.getUsername());
return mesBasePalletInfoMapper.updateMesBasePalletInfo(mesBasePalletInfo);
@ -80,8 +85,7 @@ public class MesBasePalletInfoServiceImpl implements IMesBasePalletInfoService
* @return
*/
@Override
public int deleteMesBasePalletInfoByPalletInfoIds(Long[] palletInfoIds)
{
public int deleteMesBasePalletInfoByPalletInfoIds(Long[] palletInfoIds) {
return mesBasePalletInfoMapper.deleteMesBasePalletInfoByPalletInfoIds(palletInfoIds);
}
@ -92,8 +96,46 @@ public class MesBasePalletInfoServiceImpl implements IMesBasePalletInfoService
* @return
*/
@Override
public int deleteMesBasePalletInfoByPalletInfoId(Long palletInfoId)
{
public int deleteMesBasePalletInfoByPalletInfoId(Long 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">
<resultMap type="MesBasePalletInfo" id="MesBasePalletInfoResult">
<result property="palletInfoId" column="pallet_info_id"/>
<result property="palletInfoCode" column="pallet_info_code"/>
<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="palletInfoId" column="pallet_info_id" />
<result property="palletInfoCode" column="pallet_info_code" />
<result property="materialId" column="material_id" />
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
<result property="materialBarcode" column="material_barcode" />
<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>
<sql id="selectMesBasePalletInfoVo">
select pallet_info_id, pallet_info_code, remark, create_by, create_time, update_by, update_time
from mes_base_pallet_info
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
</sql>
<select id="selectMesBasePalletInfoList" parameterType="MesBasePalletInfo" resultMap="MesBasePalletInfoResult">
@ -31,24 +35,33 @@
where pallet_info_id = #{palletInfoId}
</select>
<insert id="insertMesBasePalletInfo" parameterType="MesBasePalletInfo" useGeneratedKeys="true"
keyProperty="palletInfoId">
<insert id="insertMesBasePalletInfo" parameterType="MesBasePalletInfo" useGeneratedKeys="true" keyProperty="palletInfoId">
insert into mes_base_pallet_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<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="createBy != null and createBy != ''">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="bindAmount != null">bind_amount,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<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="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="bindAmount != null">#{bindAmount},</if>
</trim>
</insert>
@ -56,11 +69,16 @@
update mes_base_pallet_info
<trim prefix="SET" suffixOverrides=",">
<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="createBy != null and createBy != ''">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="bindAmount != null">bind_amount = #{bindAmount},</if>
</trim>
where pallet_info_id = #{palletInfoId}
</update>
@ -77,4 +95,13 @@
#{palletInfoId}
</foreach>
</delete>
<select id="selectMesBasePalletInfoByPalletInfoCode" parameterType="String" resultMap="MesBasePalletInfoResult">
<include refid="selectMesBasePalletInfoVo"/>
where pallet_info_code = #{palletInfoCode}
</select>
</mapper>
Loading…
Cancel
Save