feat: 设备投料 条码查询,远程接口
This commit is contained in:
parent
a1809ef2a5
commit
8205714bba
@ -3,6 +3,10 @@ package com.foreverwin.nlv.wms.dto;
|
||||
import com.foreverwin.nlv.wms.entity.WmsInventory;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class wmsInventoryDto extends WmsInventory {
|
||||
private String item;
|
||||
@ -13,9 +17,15 @@ public class wmsInventoryDto extends WmsInventory {
|
||||
private String itemType;
|
||||
private String storageBinBo;
|
||||
private String operation;
|
||||
private String operationBo;
|
||||
private String shopOrder;
|
||||
private String resource;
|
||||
private String fifo;
|
||||
private String fifoMaterialLot;
|
||||
private String checkDateExp;
|
||||
private String wmsInventoryBo;
|
||||
private List<Map<String,Object>> outItemType;
|
||||
private String itemGroup;
|
||||
private String checkItemMaterialLot;
|
||||
private BigDecimal checkItemQtyOnHand;
|
||||
}
|
||||
|
||||
@ -159,6 +159,12 @@ public class WmsInventory extends Model<WmsInventory> {
|
||||
@TableField(exist = false)
|
||||
private String moveType;
|
||||
|
||||
/**
|
||||
* 质检等级
|
||||
*/
|
||||
@ApiModelProperty(value = "质检等级")
|
||||
private String inspectionLevel;
|
||||
|
||||
public static String genHandle(String site, String itemBo, String materialLot) {
|
||||
return HandleBoProcessor.genHandle(KW_WMS_INVENTORY_BO, site, itemBo, materialLot);
|
||||
}
|
||||
|
||||
@ -15,10 +15,10 @@ public interface RemoteWmsInventoryService {
|
||||
* 更新库存
|
||||
*/
|
||||
@PostMapping("/wmsInventory/updateInventory")
|
||||
R<Boolean> remoteInventory(@RequestBody WmsInventory wmsInventory, @RequestHeader(SecurityConstants.FROM) String from);
|
||||
R<Boolean> remoteInventory(@RequestBody WmsInventory wmsInventory);
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
@GetMapping("/wmsInventory/selectById")
|
||||
R<WmsInventory> selectById(String id,@RequestHeader(SecurityConstants.FROM) String from);
|
||||
@PostMapping("wmsInventory/api/selectById")
|
||||
R<WmsInventory> selectById(@RequestBody WmsInventory wmsInventory);
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.foreverwin.mom.common.core.util.R;
|
||||
import com.foreverwin.mom.common.log.annotation.SysLog;
|
||||
import com.foreverwin.mom.common.security.annotation.Inner;
|
||||
import com.foreverwin.nlv.wms.dto.wmsInventoryDto;
|
||||
import com.foreverwin.nlv.wms.entity.WmsInventory;
|
||||
import com.foreverwin.nlv.wms.service.WmsInventoryService;
|
||||
@ -96,11 +97,21 @@ public class WmsInventoryController {
|
||||
*/
|
||||
@ApiOperation(value = "设备投料条码号查询", notes = "设备投料条码号查询")
|
||||
@SysLog("设备投料条码号查询")
|
||||
@GetMapping("/selectByMaterialLot")
|
||||
public R selectByMaterialLot(wmsInventoryDto dto) {
|
||||
@PostMapping("/selectByMaterialLot")
|
||||
public R selectByMaterialLot(@RequestBody wmsInventoryDto dto) {
|
||||
return R.ok(wmsInventoryService.selectByMaterialLot(dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备投料条码号查询(校验物料组)
|
||||
*/
|
||||
@ApiOperation(value = "设备投料条码号校验物料组", notes = "设备投料条码号校验物料组")
|
||||
@SysLog("设备投料条码号校验物料组")
|
||||
@PostMapping("/checkItemGroup")
|
||||
public R checkItemGroup(@RequestBody wmsInventoryDto dto) {
|
||||
return R.ok(wmsInventoryService.checkItemGroup(dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*/
|
||||
@ -108,6 +119,7 @@ public class WmsInventoryController {
|
||||
@SysLog("更新")
|
||||
@PostMapping("/updateInventory")
|
||||
@GlobalTransactional
|
||||
@Inner(value = false)
|
||||
public R updateInventory(@RequestBody WmsInventory wmsInventory) {
|
||||
wmsInventoryService.updateInventory(wmsInventory);
|
||||
return R.ok();
|
||||
@ -118,9 +130,10 @@ public class WmsInventoryController {
|
||||
*/
|
||||
@ApiOperation(value = "查询", notes = "查询")
|
||||
@SysLog("查询")
|
||||
@GetMapping("/selectById")
|
||||
public R selectById(String id) {
|
||||
return R.ok(wmsInventoryService.getById(id));
|
||||
@PostMapping("/api/selectById")
|
||||
@Inner(value = false)
|
||||
public R selectById(@RequestBody WmsInventory wmsInventory) {
|
||||
return R.ok(wmsInventoryService.getById(wmsInventory.getHandle()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -37,6 +37,6 @@ public interface WmsInventoryService extends IService<WmsInventory> {
|
||||
void changePackageNumber(WmsInventory wmsInventory);
|
||||
|
||||
wmsInventoryDto selectByMaterialLot(wmsInventoryDto dto);
|
||||
|
||||
wmsInventoryDto checkItemGroup(wmsInventoryDto dto);
|
||||
void updateInventory(WmsInventory wmsInventory);
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ public class WmsInventoryLogServiceImpl extends ServiceImpl<WmsInventoryLogMappe
|
||||
wmsInventoryLog.setDateMfg(wmsInventory.getDateMfg());
|
||||
wmsInventoryLog.setDateExp(wmsInventory.getDateExp());
|
||||
wmsInventoryLog.setDateInventory(wmsInventory.getDateInventory());
|
||||
wmsInventoryLog.setCreator(SecurityUtils.getUserName());
|
||||
wmsInventoryLog.setCreator(wmsInventory.getCreator());
|
||||
wmsInventoryLog.setExt01(wmsInventory.getExt01());
|
||||
wmsInventoryLog.setExt02(wmsInventory.getExt02());
|
||||
wmsInventoryLog.setExt03(wmsInventory.getExt03());
|
||||
|
||||
@ -6,6 +6,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.foreverwin.iep.prd.dto.CustomFieldBoundDTO;
|
||||
import com.foreverwin.iep.prd.entity.CustomFieldDef;
|
||||
import com.foreverwin.iep.prd.entity.CustomFields;
|
||||
import com.foreverwin.iep.prd.entity.Item;
|
||||
import com.foreverwin.iep.prd.mapper.CustomFieldDefMapper;
|
||||
import com.foreverwin.iep.prd.mapper.CustomFieldsMapper;
|
||||
import com.foreverwin.iep.wms.dto.EqpFeedingDTO;
|
||||
import com.foreverwin.iep.wms.mapper.EqpFeedingMapper;
|
||||
import com.foreverwin.mom.common.core.exception.BusinessException;
|
||||
import com.foreverwin.mom.common.data.tenant.TenantContextHolder;
|
||||
import com.foreverwin.mom.common.security.util.SecurityUtils;
|
||||
@ -16,6 +24,7 @@ import com.foreverwin.nlv.wms.mapper.WmsInventoryLogMapper;
|
||||
import com.foreverwin.nlv.wms.mapper.WmsInventoryMapper;
|
||||
import com.foreverwin.nlv.wms.service.WmsInventoryLogService;
|
||||
import com.foreverwin.nlv.wms.service.WmsInventoryService;
|
||||
import com.foreverwin.nlv.wms.service.WmsItemService;
|
||||
import com.foreverwin.nlv.wms.util.StringUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@ -25,6 +34,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
@ -41,6 +51,10 @@ public class WmsInventoryServiceImpl extends ServiceImpl<WmsInventoryMapper, Wms
|
||||
private final WmsInventoryLogMapper wmsInventoryLogMapper;
|
||||
private final WmsInventoryMapper wmsInventoryMapper;
|
||||
private final WmsInventoryLogService wmsInventoryLogService;
|
||||
private final EqpFeedingMapper eqpFeedingMapper;
|
||||
private final WmsItemService wmsItemService;
|
||||
private final CustomFieldDefMapper customFieldDefMapper;
|
||||
private final CustomFieldsMapper customFieldsMapper;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
@ -196,7 +210,7 @@ public class WmsInventoryServiceImpl extends ServiceImpl<WmsInventoryMapper, Wms
|
||||
LocalDateTime dateMfg = list.get(0).getDateMfg();
|
||||
boolean before = dateMfg.isBefore(wmsInventory.getDateMfg());
|
||||
if (before) {
|
||||
wmsInventory.setFifo("N");
|
||||
wmsInventory.setFifo("N");//N表示返回前端有弹窗提示 先进先出
|
||||
wmsInventory.setFifoMaterialLot(list.get(0).getMaterialLot());
|
||||
}
|
||||
}
|
||||
@ -204,9 +218,68 @@ public class WmsInventoryServiceImpl extends ServiceImpl<WmsInventoryMapper, Wms
|
||||
return wmsInventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public wmsInventoryDto checkItemGroup(wmsInventoryDto dto) {
|
||||
String site = TenantContextHolder.getTenantId();
|
||||
dto.setSite(site);
|
||||
wmsInventoryDto wmsInventory = wmsInventoryMapper.selectByMaterialLot(dto);
|
||||
if (wmsInventory == null) {
|
||||
throw BusinessException.build("料件批号的物料不在当前工单的BOM中");
|
||||
}
|
||||
//校验扫描条码的物料在物料表中物料组是否在字典管理为OUT_ITEM_TYPE对应的值一致
|
||||
EqpFeedingDTO eqpFeedingDTO = new EqpFeedingDTO();
|
||||
eqpFeedingDTO.setSite(site);
|
||||
eqpFeedingDTO.setResource(dto.getResource());
|
||||
eqpFeedingDTO.setOperation(dto.getOperation());
|
||||
eqpFeedingDTO.setShopOrder(dto.getShopOrder());
|
||||
//eqpFeedingDTO.setMaterialLot(dto.getMaterialLot());
|
||||
List<EqpFeedingDTO> eqpFeedingDTOSList = eqpFeedingMapper.selectEqpFeedingList(eqpFeedingDTO);
|
||||
boolean isBreak = false;
|
||||
for (EqpFeedingDTO feeding : eqpFeedingDTOSList) {
|
||||
String item = feeding.getItemBo().split(",")[1];
|
||||
String itemGroup = selectItemCustomField(item);
|
||||
if (feeding.getQtyOnHand().compareTo(feeding.getOriginalQty()) < 0) {
|
||||
for (Map<String, Object> itemType : dto.getOutItemType()) {
|
||||
String value = (String) itemType.get("value");
|
||||
if (itemGroup.equals(value)) {
|
||||
isBreak = true;
|
||||
wmsInventory.setItemGroup("N");//N表示返回前端有弹窗提示 XX条码剩余量是xx,
|
||||
wmsInventory.setCheckItemQtyOnHand(feeding.getQtyOnHand());
|
||||
wmsInventory.setCheckItemMaterialLot(feeding.getMaterialLot());
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isBreak) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
throw BusinessException.build("设备["+dto.getResource()+"]工序["+dto.getOperation()+"]工单["+dto.getShopOrder()+"]物料已存在,不允许重复上料;请先进行下料操作");
|
||||
}
|
||||
}
|
||||
return wmsInventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateInventory(WmsInventory wmsInventory) {
|
||||
super.updateById(wmsInventory);
|
||||
wmsInventoryLogService.createInventoryLog(wmsInventory);
|
||||
}
|
||||
|
||||
//查询物料的自定义字段
|
||||
private String selectItemCustomField(String item){
|
||||
String itemGroup = null;
|
||||
Item itemServiceOne = wmsItemService.getOne(Wrappers.<Item>lambdaQuery().eq(Item::getItem, item)
|
||||
.eq(Item::getSite, TenantContextHolder.getTenantId())
|
||||
.eq(Item::getCurrentRevision, "Y"));
|
||||
if (itemServiceOne != null) {
|
||||
CustomFields customFields = customFieldsMapper.selectOne(Wrappers.<CustomFields>lambdaQuery()
|
||||
.eq(CustomFields::getFieldName, "ITEM_GROUP")
|
||||
.eq(CustomFields::getHandle, itemServiceOne.getHandle()));
|
||||
if (customFields != null) {
|
||||
itemGroup = customFields.getFieldValue();
|
||||
}
|
||||
}
|
||||
return itemGroup;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -40,11 +40,14 @@
|
||||
<result property="documentNo" column="DOCUMENT_NO"/>
|
||||
<result property="documentType" column="DOCUMENT_TYPE"/>
|
||||
<result property="packageNumber" column="PACKAGE_NUMBER"/>
|
||||
<result property="moveType" column="MOVE_TYPE"/>
|
||||
<result property="inspectionLevel" column="INSPECTION_LEVEL"/>
|
||||
</resultMap>
|
||||
<resultMap id="fullMap" type="com.foreverwin.nlv.wms.dto.wmsInventoryDto">
|
||||
<result property="shopOrder" column="SHOP_ORDER"/>
|
||||
<result property="resource" column="RESOURCE"/>
|
||||
<result property="operation" column="OPERATION"/>
|
||||
<result property="wmsInventoryBo" column="WMS_INVENTORY_BO"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="getWmsInventoryPage" resultMap="wmsInventoryMap">
|
||||
@ -175,7 +178,7 @@
|
||||
</select>
|
||||
|
||||
<select id="selectByMaterialLot" resultMap="fullMap">
|
||||
SELECT a.SHOP_ORDER ,op.OPERATION ,i.ITEM ,i.DESCRIPTION ITEM_DESC,wi.*
|
||||
SELECT a.SHOP_ORDER ,op.OPERATION ,i.ITEM ,i.DESCRIPTION ITEM_DESC,wi.*,wi.HANDLE WMS_INVENTORY_BO
|
||||
from SHOP_ORDER a
|
||||
join BOM b on a.PLANNED_BOM_BO = b.HANDLE
|
||||
join BOM_COMPONENT c on c.BOM_BO = b.HANDLE
|
||||
|
||||
Loading…
Reference in New Issue
Block a user