feat: 绑定解绑/上下架方法
This commit is contained in:
parent
1d272e3064
commit
dc8a1e815b
@ -1,16 +1,15 @@
|
||||
package com.foreverwin.mom.wms.dto;
|
||||
|
||||
import com.foreverwin.mom.wms.entity.CarrierMember;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class CarrierMemberDto extends CarrierMember {
|
||||
public class CarrierMemberDto {
|
||||
private String carrier;
|
||||
private BigDecimal inventoryQty;
|
||||
private String carrierOrInventory;
|
||||
private BigDecimal qtyOnHand;
|
||||
private String unitOfMeasure;
|
||||
private String item;
|
||||
private String description;
|
||||
private String box;
|
||||
@ -19,6 +18,7 @@ public class CarrierMemberDto extends CarrierMember {
|
||||
private String status;
|
||||
private String carrierType;
|
||||
private String erpStorageLocation;
|
||||
private String storageBin;
|
||||
private String wmsStorageBinBo;
|
||||
private String batchNo;
|
||||
private String qualityInspectionStatus;
|
||||
|
||||
@ -5,7 +5,7 @@ import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class DocumentScanCodeDTO {
|
||||
public class ScanCodeDTO {
|
||||
|
||||
private String inventoryId;
|
||||
|
||||
@ -881,8 +881,9 @@ public class DocumentController {
|
||||
return R.ok(documentService.getSubmitDocumentDetail(TenantContextHolder.getTenantId(), documentNo));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通过id查询明细", notes = "通过id查询明细")
|
||||
@ApiOperation(value = "单据扫码", notes = "单据扫码")
|
||||
@GetMapping("/scanCode")
|
||||
@SysLog("单据扫码")
|
||||
public R scanCode(String code) {
|
||||
String site = TenantContextHolder.getTenantId();
|
||||
String user = SecurityUtils.getUserName();
|
||||
@ -892,7 +893,7 @@ public class DocumentController {
|
||||
@ApiOperation(value = "单据拣货保存", notes = "单据拣货保存")
|
||||
@PostMapping("/picking/save")
|
||||
@SysLog("单据拣货保存")
|
||||
public R savePicking(@RequestBody ListWithStringDTO<DocumentScanCodeDTO> dto) {
|
||||
public R savePicking(@RequestBody ListWithStringDTO<ScanCodeDTO> dto) {
|
||||
String site = TenantContextHolder.getTenantStrId();
|
||||
String user = SecurityUtils.getUserName();
|
||||
documentService.savePicking(site, user, dto.getStr(), dto.getList());
|
||||
@ -902,7 +903,7 @@ public class DocumentController {
|
||||
@ApiOperation(value = "单据拣货保存(检验)", notes = "单据拣货保存(检验)")
|
||||
@PostMapping("/picking/save/checkingScanAll")
|
||||
@SysLog("单据拣货保存(检验)")
|
||||
public R savePickingCheckingScanAll(@RequestBody ListWithStringDTO<DocumentScanCodeDTO> dto) {
|
||||
public R savePickingCheckingScanAll(@RequestBody ListWithStringDTO<ScanCodeDTO> dto) {
|
||||
String site = TenantContextHolder.getTenantStrId();
|
||||
String user = SecurityUtils.getUserName();
|
||||
documentService.savePicking(site, user, dto.getStr(), dto.getList(), true);
|
||||
|
||||
@ -90,11 +90,11 @@ public class WmsCarrierMemberController {
|
||||
* @param carrier id
|
||||
* @return R
|
||||
*/
|
||||
/*@ApiOperation(value = "根据托号查询绑定列表", notes = "根据托号查询绑定列表")
|
||||
@ApiOperation(value = "根据托号查询绑定列表", notes = "根据托号查询绑定列表")
|
||||
@GetMapping("/getBindListByTray/{carrier}")
|
||||
public R getBindListByTrayN(@PathVariable("carrier") String carrier) {
|
||||
return R.ok(wmsCarrierMemberService.getBindList(carrier, true));
|
||||
}*/
|
||||
}
|
||||
|
||||
/**
|
||||
* 子条码
|
||||
@ -102,11 +102,11 @@ public class WmsCarrierMemberController {
|
||||
* @param carrierOrInventory id
|
||||
* @return R
|
||||
*/
|
||||
/*@ApiOperation(value = "通过id查询", notes = "通过id查询")
|
||||
@ApiOperation(value = "通过id查询", notes = "通过id查询")
|
||||
@GetMapping("/getItem/{carrierOrInventory}")
|
||||
public R getById(@PathVariable("carrierOrInventory") String carrierOrInventory) {
|
||||
return R.ok(wmsCarrierMemberService.getItem(carrierOrInventory));
|
||||
}*/
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增载具库存绑定表
|
||||
@ -117,7 +117,7 @@ public class WmsCarrierMemberController {
|
||||
@ApiOperation(value = "新增载具库存绑定表", notes = "新增载具库存绑定表")
|
||||
@SysLog("新增载具库存绑定表")
|
||||
@PostMapping("/bind")
|
||||
@PreAuthorize("@pms.hasPermission('wms_carrier_member_bind')")
|
||||
//@PreAuthorize("@pms.hasPermission('wms_carrier_member_bind')")
|
||||
public R bind(@RequestBody ListWithStringDTO<CarrierMemberDto> carrierMemberDto) {
|
||||
List<CarrierMemberDto> carrierMemberDtoList = carrierMemberDto.getList();
|
||||
wmsCarrierMemberService.bindBatch(carrierMemberDtoList.get(0).getCarrier(), carrierMemberDtoList.stream().map(CarrierMemberDto::getCarrierOrInventory).collect(Collectors.toList()), "Y", carrierMemberDto.getStr());
|
||||
@ -134,7 +134,7 @@ public class WmsCarrierMemberController {
|
||||
@ApiOperation(value = "解除载具库存绑定", notes = "解除载具库存绑定")
|
||||
@SysLog("解除载具库存绑定")
|
||||
@PostMapping("/unbind")
|
||||
@PreAuthorize("@pms.hasPermission('wms_carrier_member_unbind')")
|
||||
//@PreAuthorize("@pms.hasPermission('wms_carrier_member_unbind')")
|
||||
public R unbind(@RequestBody ListWithStringDTO<CarrierMemberDto> carrierMemberDto) {
|
||||
String user = SecurityUtils.getUserName();
|
||||
List<CarrierMemberDto> unbindList = carrierMemberDto.getList();
|
||||
@ -158,7 +158,6 @@ public class WmsCarrierMemberController {
|
||||
String user = SecurityUtils.getUserName();
|
||||
return R.ok(wmsCarrierMemberService.updateById(carrierMember));
|
||||
}*/
|
||||
|
||||
@ApiOperation(value = "托盘清单打印", notes = "托盘清单打印")
|
||||
@SysLog("托盘清单打印")
|
||||
@GetMapping("/print")
|
||||
@ -179,8 +178,6 @@ public class WmsCarrierMemberController {
|
||||
public R removeById(@PathVariable String handle) {
|
||||
return R.ok(wmsCarrierMemberService.removeById(handle));
|
||||
}*/
|
||||
|
||||
|
||||
@ApiOperation(value = "载具解绑确认", notes = "载具解绑确认")
|
||||
@SysLog("载具解绑确认")
|
||||
@PostMapping("/confirmUnBind")
|
||||
@ -201,4 +198,27 @@ public class WmsCarrierMemberController {
|
||||
}
|
||||
return R.ok(listWithStringDTO);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "绑定解绑扫码", notes = "绑定解绑扫码")
|
||||
@GetMapping("/scanCode")
|
||||
@SysLog("绑定解绑扫码")
|
||||
public R scanCode(String code) {
|
||||
String site = TenantContextHolder.getTenantId();
|
||||
String user = SecurityUtils.getUserName();
|
||||
return R.ok(wmsCarrierMemberService.scanCode(site, user, code));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询货格绑定的托", notes = "查询货格绑定的托")
|
||||
@SysLog("查询货格绑定的托")
|
||||
@GetMapping("/getStorageBinBindCount")
|
||||
public R getStorageBinBindList(String storageBin) {
|
||||
return R.ok(wmsCarrierMemberService.getStorageBinBindCount(TenantContextHolder.getTenantId(), storageBin));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询托绑定数量", notes = "查询托绑定数量")
|
||||
@SysLog("查询托绑定数量")
|
||||
@GetMapping("/getCarrierBindCount")
|
||||
public R getCarrierBindCount(String carrier) {
|
||||
return R.ok(wmsCarrierMemberService.getCarrierBindCount(TenantContextHolder.getTenantId(), carrier));
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,6 +7,8 @@ import com.foreverwin.mom.common.core.util.R;
|
||||
import com.foreverwin.mom.common.data.tenant.TenantContextHolder;
|
||||
import com.foreverwin.mom.common.excel.annotation.ResponseExcel;
|
||||
import com.foreverwin.mom.common.log.annotation.SysLog;
|
||||
import com.foreverwin.mom.common.security.util.SecurityUtils;
|
||||
import com.foreverwin.mom.wms.dto.ListWithStringDTO;
|
||||
import com.foreverwin.mom.wms.dto.StorageBinDto;
|
||||
import com.foreverwin.mom.wms.entity.StorageBin;
|
||||
import com.foreverwin.mom.wms.service.WmsStorageBinService;
|
||||
@ -145,10 +147,10 @@ public class WmsStorageBinController {
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "通过货格查询对应货架", notes = "通过货格查询对应货架")
|
||||
@ApiOperation(value = "通过货格查询对应仓库", notes = "通过货格查询对应仓库")
|
||||
@GetMapping("/getStorageLocationByStorageBin/{storageBin}")
|
||||
public R getStorageLocationByStorageBin(@PathVariable("storageBin") String storageBin) {
|
||||
return R.ok(storageBinService.getStorageLocationByStorageBin(storageBin));
|
||||
return R.ok(storageBinService.getStorageLocationByStorageBin(TenantContextHolder.getTenantId(), storageBin));
|
||||
}
|
||||
|
||||
@PutMapping("/updateBatchById")
|
||||
@ -156,4 +158,33 @@ public class WmsStorageBinController {
|
||||
return R.ok(storageBinService.updateBatchById(storageBins));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ApiOperation(value = "上下架扫码", notes = "上下架扫码")
|
||||
@GetMapping("/scanCode")
|
||||
@SysLog("上下架扫码")
|
||||
public R scanCode(String code) {
|
||||
String site = TenantContextHolder.getTenantId();
|
||||
String user = SecurityUtils.getUserName();
|
||||
return R.ok(storageBinService.scanCode(site, user, code));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "货格绑定", notes = "货格绑定")
|
||||
@SysLog("货格绑定")
|
||||
@PostMapping("/bind")
|
||||
public R bind(@RequestBody ListWithStringDTO<String> dto) {
|
||||
String site = TenantContextHolder.getTenantId();
|
||||
String user = SecurityUtils.getUserName();
|
||||
storageBinService.bind(site, user, dto.getStr(), dto.getList());
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "货格解绑", notes = "货格解绑")
|
||||
@SysLog("货格解绑")
|
||||
@PostMapping("/unBind")
|
||||
public R unBind(@RequestBody List<String> inventoryIdList) {
|
||||
String site = TenantContextHolder.getTenantId();
|
||||
String user = SecurityUtils.getUserName();
|
||||
storageBinService.unBind(site, user, inventoryIdList);
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
|
||||
@ -381,4 +381,5 @@ public class ZWmsInventoryController {
|
||||
inventoryService.inventoryStocktaking(site, userName, inventoryList);
|
||||
return R.ok();
|
||||
}
|
||||
//------------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
@ -302,7 +302,7 @@ public interface DocumentService extends IService<Document> {
|
||||
|
||||
List<DocumentDetailed> getSubmitDocumentDetail(String site, String documentNo);
|
||||
|
||||
List<DocumentScanCodeDTO> scanCode(String site, String user, String code);
|
||||
List<ScanCodeDTO> scanCode(String site, String user, String code);
|
||||
|
||||
/**
|
||||
* 保存拣货
|
||||
@ -311,7 +311,7 @@ public interface DocumentService extends IService<Document> {
|
||||
* @param documentNo
|
||||
* @param list
|
||||
*/
|
||||
void savePicking(String site, String user,String documentNo, List<DocumentScanCodeDTO> list);
|
||||
void savePicking(String site, String user,String documentNo, List<ScanCodeDTO> list);
|
||||
|
||||
/**
|
||||
* 保存拣货(带校验)
|
||||
@ -321,7 +321,7 @@ public interface DocumentService extends IService<Document> {
|
||||
* @param list
|
||||
* @param checkScanAll 是否校验托全扫描
|
||||
*/
|
||||
void savePicking(String site, String user,String documentNo, List<DocumentScanCodeDTO> list, boolean checkScanAll);
|
||||
void savePicking(String site, String user, String documentNo, List<ScanCodeDTO> list, boolean checkScanAll);
|
||||
|
||||
/**
|
||||
* 拣货清除
|
||||
|
||||
@ -122,4 +122,6 @@ public interface PickingService extends IService<Picking> {
|
||||
void noEntityPickingPostCancel(String site, String user, String documentNo);
|
||||
|
||||
void printTrayLabelA4(String documentNo, String printer, List<String> seqList);
|
||||
|
||||
void checkCodePicking(String site, String code);
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package com.foreverwin.mom.wms.service;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.foreverwin.mom.wms.dto.CarrierMemberDto;
|
||||
import com.foreverwin.mom.wms.dto.ListWithStringDTO;
|
||||
import com.foreverwin.mom.wms.dto.ScanCodeDTO;
|
||||
import com.foreverwin.mom.wms.entity.CarrierMember;
|
||||
import com.foreverwin.mom.wms.entity.Inventory;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -64,4 +65,10 @@ public interface WmsCarrierMemberService extends IService<CarrierMember> {
|
||||
ListWithStringDTO selectParentAndChild(String carrierBo);
|
||||
|
||||
boolean checkTrayOverdue(String site, String documentNo, String carrierBo);
|
||||
|
||||
List<ScanCodeDTO> scanCode(String site, String user, String code);
|
||||
|
||||
List<CarrierMemberDto> getStorageBinBindCount(String site, String storageBin);
|
||||
|
||||
List<CarrierMemberDto> getCarrierBindCount(String site, String storageBin);
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package com.foreverwin.mom.wms.service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.foreverwin.mom.wms.dto.ScanCodeDTO;
|
||||
import com.foreverwin.mom.wms.dto.StorageBinDto;
|
||||
import com.foreverwin.mom.wms.entity.StorageBin;
|
||||
import com.foreverwin.mom.wms.entity.StorageLocation;
|
||||
@ -19,6 +20,7 @@ import java.util.List;
|
||||
public interface WmsStorageBinService extends IService<StorageBin> {
|
||||
|
||||
IPage getStorageBinPage(Page page, StorageBinDto storageBinDto);
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
Boolean save(StorageBinDto storageBinDto);
|
||||
|
||||
@ -27,9 +29,16 @@ public interface WmsStorageBinService extends IService<StorageBin> {
|
||||
|
||||
StorageBin getByStorageLocation(String site, String storageLocation);
|
||||
|
||||
StorageLocation getStorageLocationByStorageBin(String storageBin);
|
||||
String getStorageLocationByStorageBin(String site, String storageBin);
|
||||
|
||||
StorageBinDto getByCode(String site, String storageBin);
|
||||
|
||||
String labelPrint(String site, List<StorageBin> printList, String printer);
|
||||
|
||||
List<ScanCodeDTO> scanCode(String site, String user, String code);
|
||||
|
||||
void bind(String site, String user, String storageBin, List<String> inventoryIdList);
|
||||
|
||||
void unBind(String site, String user, List<String> inventoryIdList);
|
||||
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.foreverwin.iep.common.base.FrontPage;
|
||||
import com.foreverwin.mom.wms.dto.InventoryDto;
|
||||
import com.foreverwin.mom.wms.dto.ScanCodeDTO;
|
||||
import com.foreverwin.mom.wms.entity.Inventory;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -90,4 +91,8 @@ public interface ZWmsInventoryService extends IService<Inventory> {
|
||||
InventoryDto selectForStocktaking(String site, String inventoryId);
|
||||
|
||||
void inventoryStocktaking(String site, String user, List<Inventory> inventoryList);
|
||||
|
||||
List<ScanCodeDTO> selectInvByCode(String site, String user, String code);
|
||||
|
||||
List<ScanCodeDTO> selectTrayInvByCode(String site, String user, String code);
|
||||
}
|
||||
|
||||
@ -6275,34 +6275,32 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
|
||||
.set(Picking::getPickingStatus, status).update();
|
||||
}
|
||||
|
||||
private void checkPickingTrayAllScan(String site, List<DocumentScanCodeDTO> list) {
|
||||
Map<String, List<String>> scanMap = new HashMap<>();
|
||||
list.stream().filter(o -> StrUtil.isNotBlank(o.getCarrier())).forEach(o -> scanMap.computeIfAbsent(Carrier.genHandle(site, o.getCarrier()), s -> new ArrayList<>()).add(Inventory.genHandle(site, o.getInventoryId())));
|
||||
scanMap.forEach((carrierBo, scanInvList) -> {
|
||||
boolean exists = wmsCarrierMemberService.lambdaQuery().eq(CarrierMember::getCarrierBo, carrierBo).notIn(CarrierMember::getCarrierOrInventoryBo, scanInvList).exists();
|
||||
if (exists) {
|
||||
throw BusinessException.build("托" + HandleBoProcessor.trimHandle(carrierBo) + "未全部扫码");
|
||||
}
|
||||
});
|
||||
}
|
||||
private void checkPickingTrayAllScan(String site, List<ScanCodeDTO> list) {
|
||||
Map<String, List<String>> scanMap = new HashMap<>();
|
||||
list.stream().filter(o -> StrUtil.isNotBlank(o.getCarrier())).forEach(o -> scanMap.computeIfAbsent(Carrier.genHandle(site, o.getCarrier()), s -> new ArrayList<>()).add(Inventory.genHandle(site, o.getInventoryId())));
|
||||
scanMap.forEach((carrierBo, scanInvList) -> {
|
||||
boolean exists = wmsCarrierMemberService.lambdaQuery().eq(CarrierMember::getCarrierBo, carrierBo).notIn(CarrierMember::getCarrierOrInventoryBo, scanInvList).exists();
|
||||
if (exists) {
|
||||
throw BusinessException.build("托" + HandleBoProcessor.trimHandle(carrierBo) + "未全部扫码");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DocumentScanCodeDTO> scanCode(String site, String user, String code) {
|
||||
pickingService.lambdaQuery().eq(Picking::getSite, site).and(qw -> qw.eq(Picking::getInventoryId, code).or().eq(Picking::getInventoryIdOrCarrier, code)).orderByDesc(Picking::getCreateDateTime).last("LIMIT 1").oneOpt().ifPresent(picking -> {
|
||||
throw BusinessException.build("条码" + code + "已被单据" + picking.getDocumentNo() + "拣货");
|
||||
});
|
||||
return baseMapper.selectInvByCode(Inventory.genHandle(site, code), Carrier.genHandle(site, code));
|
||||
}
|
||||
@Override
|
||||
public List<ScanCodeDTO> scanCode(String site, String user, String code) {
|
||||
pickingService.checkCodePicking(site, code);
|
||||
return inventoryService.selectInvByCode(site, user, code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void savePicking(String site, String user, String documentNo, List<DocumentScanCodeDTO> list) {
|
||||
savePicking(site, user, documentNo, list, false);
|
||||
}
|
||||
@Override
|
||||
public void savePicking(String site, String user, String documentNo, List<ScanCodeDTO> list) {
|
||||
savePicking(site, user, documentNo, list, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void savePicking(String site, String user, String documentNo, List<DocumentScanCodeDTO> list, boolean checkScanAll) {
|
||||
Document document = getDocument(site, documentNo);
|
||||
String documentBo = document.getHandle();
|
||||
@Override
|
||||
public void savePicking(String site, String user, String documentNo, List<ScanCodeDTO> list, boolean checkScanAll) {
|
||||
Document document = getDocument(site, documentNo);
|
||||
String documentBo = document.getHandle();
|
||||
|
||||
if (Constant.DOCUMENT_STATUS_SUBMIT.equals(document.getState()) || Constant.DOCUMENT_STATUS_PICKING.equals(document.getState())) {
|
||||
Map<String, Integer> seqMap = documentDetailedService.lambdaQuery().eq(DocumentDetailed::getDocumentBo, documentBo).select(DocumentDetailed::getItem, DocumentDetailed::getSeq).list().stream().collect(Collectors.toMap(DocumentDetailed::getItem, DocumentDetailed::getSeq, (s, s2) -> s));
|
||||
|
||||
@ -42,23 +42,8 @@ import java.util.Optional;
|
||||
public class PickingServiceImpl extends ServiceImpl<PickingMapper, Picking> implements PickingService {
|
||||
|
||||
private final PickingMapper pickingMapper;
|
||||
private final StorageBinBindInventoryService storageBinBindInventoryService;
|
||||
private final WmsCarrierMemberService wmsCarrierMemberService;
|
||||
private final DocumentMapper documentMapper;
|
||||
private final DocumentDetailedService documentDetailedService;
|
||||
private final DocumentSfcService documentSfcService;
|
||||
private final WmsStorageBinService storageBinService;
|
||||
private final ZWmsInventoryService inventoryService;
|
||||
private final WmsStorageLocationService storageLocationService;
|
||||
private final WmsCustomFieldsService customFieldsService;
|
||||
private final WmsItemService itemService;
|
||||
private final DnOrderService dnOrderService;
|
||||
private final DnOrderDetailService dnOrderDetailService;
|
||||
private final RemoteActivityOptionService activityOptionService;
|
||||
private final SalseBatchGenService salseBatchGenService;
|
||||
private final ZWmsInventoryLogService inventoryLogService;
|
||||
private final FalseWarehoursingService falseWarehoursingService;
|
||||
private final WmsCarrierService wmsCarrierService;
|
||||
|
||||
|
||||
@Override
|
||||
@ -1349,6 +1334,12 @@ public class PickingServiceImpl extends ServiceImpl<PickingMapper, Picking> impl
|
||||
// erpSd002RequestBodyDTO.setItem(documentDetailedList.stream().map(o -> InterfaceRequestUtils.createSd002Item(site, o.getSeq(), o.getItem(), BigDecimal.ZERO, o.getUnitOfMeasure(), o.getSourceWarehouse(), o.getBatch(), o.getSalesBatch())).collect(Collectors.toList()));
|
||||
// erpInterfanceService.wmsCallErp(InterfaceCodeConstant.SD_002, erpSd002RequestBodyDTO, null);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
@Override
|
||||
public void checkCodePicking(String site, String code) {
|
||||
lambdaQuery().eq(Picking::getSite, site).and(qw -> qw.eq(Picking::getInventoryId, code).or().eq(Picking::getGradeOneCarrier, code)).orderByDesc(Picking::getCreateDateTime).last("LIMIT 1").oneOpt().ifPresent(picking -> {
|
||||
throw BusinessException.build("条码" + code + "已被单据" + picking.getDocumentNo() + "拣货");
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -14,6 +14,7 @@ import com.foreverwin.mom.common.core.exception.BusinessException;
|
||||
import com.foreverwin.mom.common.core.util.R;
|
||||
import com.foreverwin.mom.common.data.tenant.TenantContextHolder;
|
||||
import com.foreverwin.mom.common.security.util.SecurityUtils;
|
||||
import com.foreverwin.mom.wms.dto.ScanCodeDTO;
|
||||
import com.foreverwin.mom.wms.util.StringUtils;
|
||||
import com.foreverwin.mom.wms.constant.Constant;
|
||||
import com.foreverwin.mom.wms.dto.CarrierMemberDto;
|
||||
@ -75,16 +76,11 @@ public class WmsCarrierMemberServiceImpl extends ServiceImpl<WmsCarrierMemberMap
|
||||
|
||||
private final WmsCarrierMemberMapper wmsCarrierMemberMapper;
|
||||
|
||||
private final RemoteActivityOptionService activityOptionService;
|
||||
private final WmsStorageBinService wmsStorageBinService;
|
||||
|
||||
private final WmsStorageBinService storageBinService;
|
||||
private final PickingService pickingService;
|
||||
|
||||
private StorageBinBindInventoryService storageBinBindInventoryService;
|
||||
|
||||
@Autowired
|
||||
public void setStorageBinBindInventoryService(@Lazy StorageBinBindInventoryService storageBinBindInventoryService) {
|
||||
this.storageBinBindInventoryService = storageBinBindInventoryService;
|
||||
}
|
||||
//private final RemoteActivityOptionService activityOptionService;
|
||||
|
||||
@Override
|
||||
public void bind(String carrier, String carrierOrInventory, String verifyParentIsBind) {
|
||||
@ -121,7 +117,7 @@ public class WmsCarrierMemberServiceImpl extends ServiceImpl<WmsCarrierMemberMap
|
||||
} else {
|
||||
/*Carrier CarrierById = wmsCarrierService.getById(Carrier.genHandle(site, carrierOrInventory));
|
||||
if (CarrierById == null) {*/
|
||||
throw BusinessException.build("不存在的条码" + carrierOrInventory);
|
||||
throw BusinessException.build("不存在的条码" + carrierOrInventory);
|
||||
/*} else {
|
||||
CarrierType sonCarrierType = wmsCarrierTypeService.getById(CarrierById.getCarrierTypeBo());
|
||||
Integer sonGrade = sonCarrierType.getGrade();
|
||||
@ -213,9 +209,9 @@ public class WmsCarrierMemberServiceImpl extends ServiceImpl<WmsCarrierMemberMap
|
||||
if ("N".equals(bindStorageBin)) {
|
||||
throw BusinessException.build("托盘号:" + carrier + "已绑定且不在默认货位");
|
||||
} else {*/
|
||||
String carrierOrInventoryBo;
|
||||
if (inventorySelect != null) {
|
||||
carrierOrInventoryBo = inventoryBo;
|
||||
String carrierOrInventoryBo;
|
||||
if (inventorySelect != null) {
|
||||
carrierOrInventoryBo = inventoryBo;
|
||||
/*LambdaQueryWrapper<CarrierMember> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CarrierMember::getCarrierOrInventoryBo, carrierBo);
|
||||
List<CarrierMember> list = this.list(queryWrapper);
|
||||
@ -228,10 +224,10 @@ public class WmsCarrierMemberServiceImpl extends ServiceImpl<WmsCarrierMemberMap
|
||||
.set(Inventory::getUpdateTime, LocalDateTime.now())
|
||||
.set(Inventory::getUpdater, user));
|
||||
}*/
|
||||
} else {
|
||||
} else {
|
||||
/*Carrier CarrierById = wmsCarrierService.getById(Carrier.genHandle(site, carrierOrInventory));
|
||||
if (CarrierById == null) {*/
|
||||
throw BusinessException.build("不存在的条码" + carrierOrInventory);
|
||||
throw BusinessException.build("不存在的条码" + carrierOrInventory);
|
||||
/*} else {
|
||||
carrierOrInventoryBo = CarrierById.getHandle();
|
||||
List<String> inventoryBoList = list(Wrappers.lambdaQuery(CarrierMember.class).eq(CarrierMember::getCarrierBo, carrierOrInventoryBo).select(CarrierMember::getCarrierOrInventoryBo))
|
||||
@ -242,11 +238,11 @@ public class WmsCarrierMemberServiceImpl extends ServiceImpl<WmsCarrierMemberMap
|
||||
.set(Inventory::getUpdateTime, LocalDateTime.now())
|
||||
.set(Inventory::getUpdater, user));
|
||||
}*/
|
||||
}
|
||||
CarrierMember carrierMember = getOne(Wrappers.lambdaQuery(CarrierMember.class).eq(CarrierMember::getCarrierBo, carrierBo).eq(CarrierMember::getCarrierOrInventoryBo, carrierOrInventoryBo));
|
||||
if (carrierMember == null) {
|
||||
throw BusinessException.build("载具" + carrier + "条码" + carrierOrInventory + "不存在绑定关系");
|
||||
} else {
|
||||
}
|
||||
CarrierMember carrierMember = getOne(Wrappers.lambdaQuery(CarrierMember.class).eq(CarrierMember::getCarrierBo, carrierBo).eq(CarrierMember::getCarrierOrInventoryBo, carrierOrInventoryBo));
|
||||
if (carrierMember == null) {
|
||||
throw BusinessException.build("载具" + carrier + "条码" + carrierOrInventory + "不存在绑定关系");
|
||||
} else {
|
||||
/*String newCarrierNo = null, storageBinBo = null;
|
||||
long count = count(Wrappers.lambdaQuery(CarrierMember.class).eq(CarrierMember::getCarrierBo, carrierBo));
|
||||
boolean allUnBind = count == 1;
|
||||
@ -264,7 +260,7 @@ public class WmsCarrierMemberServiceImpl extends ServiceImpl<WmsCarrierMemberMap
|
||||
storageBinBo = storageBin.getHandle();
|
||||
}
|
||||
}*/
|
||||
this.removeById(carrierMember.getHandle());
|
||||
this.removeById(carrierMember.getHandle());
|
||||
/*if (StrUtil.isNotBlank(newCarrierNo)) {
|
||||
if (StrUtil.isBlank(storageBinBo)) {
|
||||
throw BusinessException.build("未找到托条码" + carrier + "上架信息");
|
||||
@ -273,8 +269,8 @@ public class WmsCarrierMemberServiceImpl extends ServiceImpl<WmsCarrierMemberMap
|
||||
storageBinBindInventoryService.carrierBind(StringUtil.trimHandle(storageBinBo), newCarrierNo);
|
||||
}
|
||||
}*/
|
||||
wmsCarrierMemberLogService.saveLog(user, carrierBo, carrierOrInventoryBo, "N");
|
||||
}
|
||||
wmsCarrierMemberLogService.saveLog(user, carrierBo, carrierOrInventoryBo, "N");
|
||||
}
|
||||
//}
|
||||
}
|
||||
/*CarrierType byId = wmsCarrierTypeService.getById(carrierSelect.getCarrierTypeBo());
|
||||
@ -306,21 +302,21 @@ public class WmsCarrierMemberServiceImpl extends ServiceImpl<WmsCarrierMemberMap
|
||||
public List<CarrierMemberDto> getBindList(String carrier, boolean onlyTray) {
|
||||
String site = TenantContextHolder.getTenantId();
|
||||
String carrierBo = Carrier.genHandle(site, carrier);
|
||||
Carrier carrierSelect = wmsCarrierService.getById(carrierBo);
|
||||
if (carrierSelect == null) {
|
||||
boolean exists = wmsCarrierService.lambdaQuery().eq(Carrier::getHandle, carrierBo).exists();
|
||||
if (!exists) {
|
||||
throw BusinessException.build("载具不存在");
|
||||
} else {
|
||||
pickingService.lambdaQuery().eq(Picking::getGradeOneCarrier, carrier).oneOpt().ifPresent(picking -> {
|
||||
throw BusinessException.build("载具" + carrier + "已被单据" + picking.getDocumentNo() + "拣货");
|
||||
});
|
||||
List<CarrierMemberDto> bindInventoryList = wmsCarrierMemberMapper.getBindInventoryList(carrierBo);
|
||||
List<CarrierMemberDto> needUnBindStorageBinList = bindInventoryList.stream().filter(o -> StrUtil.isNotBlank(o.getWmsStorageBinBo())).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(needUnBindStorageBinList)) {
|
||||
throw BusinessException.build("条码[" + needUnBindStorageBinList.stream().map(CarrierMemberDto::getCarrierOrInventory).collect(Collectors.joining()) + "]已绑定货格,请先下架");
|
||||
} else {
|
||||
return bindInventoryList;
|
||||
}
|
||||
}
|
||||
/*String carrierTypeBo = carrierSelect.getCarrierTypeBo();
|
||||
CarrierType byId = wmsCarrierTypeService.getById(carrierTypeBo);
|
||||
if (byId.getGrade() == 2) {
|
||||
if (onlyTray) {
|
||||
throw BusinessException.build("只允许扫描托条码");
|
||||
} else {*/
|
||||
return wmsCarrierMemberMapper.getBindInventoryList(carrierBo);
|
||||
/*}
|
||||
/*} else {
|
||||
return wmsCarrierMemberMapper.getBindCarrierList(carrierBo);
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -390,10 +386,10 @@ public class WmsCarrierMemberServiceImpl extends ServiceImpl<WmsCarrierMemberMap
|
||||
}
|
||||
return carrierMemberDto;
|
||||
} else {
|
||||
Carrier CarrierById = wmsCarrierService.getById(Carrier.genHandle(site, carrierOrInventory));
|
||||
if (CarrierById == null) {
|
||||
throw BusinessException.build("不存在的条码" + carrierOrInventory);
|
||||
}
|
||||
/*Carrier CarrierById = wmsCarrierService.getById(Carrier.genHandle(site, carrierOrInventory));
|
||||
if (CarrierById == null) {*/
|
||||
throw BusinessException.build("不存在的条码" + carrierOrInventory);
|
||||
/*}
|
||||
LambdaQueryWrapper<CarrierMember> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CarrierMember::getCarrierOrInventoryBo, CarrierById.getHandle());
|
||||
List<CarrierMember> list = this.list(queryWrapper);
|
||||
@ -406,7 +402,7 @@ public class WmsCarrierMemberServiceImpl extends ServiceImpl<WmsCarrierMemberMap
|
||||
}
|
||||
CarrierMemberDto carrierMemberDto = bindList.get(0);
|
||||
carrierMemberDto.setCarrierOrInventory(carrierOrInventory);
|
||||
return carrierMemberDto;
|
||||
return carrierMemberDto;*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -776,7 +772,7 @@ public class WmsCarrierMemberServiceImpl extends ServiceImpl<WmsCarrierMemberMap
|
||||
if (carriersWitingBind.size() != carrierOrInventoryList.size()) {
|
||||
carrierOrInventoryList.removeAll(carriersWitingBind.stream().map(Carrier::getCarrier).collect(Collectors.toList()));
|
||||
*/
|
||||
throw BusinessException.build("条码[" + String.join(",", carrierOrInventoryList) + "]不存在");
|
||||
throw BusinessException.build("条码[" + String.join(",", carrierOrInventoryList) + "]不存在");
|
||||
/*} else {
|
||||
List<CarrierType> badCarrierTypes = wmsCarrierTypeService.list(Wrappers.lambdaQuery(CarrierType.class)
|
||||
.in(CarrierType::getHandle, carriersWitingBind.stream().map(Carrier::getCarrierTypeBo).collect(Collectors.toList())).le(CarrierType::getGrade, grade).select(CarrierType::getHandle));
|
||||
@ -830,7 +826,7 @@ public class WmsCarrierMemberServiceImpl extends ServiceImpl<WmsCarrierMemberMap
|
||||
carrierMember.setCarrierBo(carrierBo);
|
||||
carrierMember.setCreateTime(LocalDateTime.now());
|
||||
carrierMember.setCreator(user);
|
||||
carrierMember.setItem(HandleBoProcessor.trimHandle(inventoryMap.get(carrierOrInventoryBo).getItemBo()));
|
||||
carrierMember.setItem(HandleBoProcessor.trimHandle(inventoryMap.get(HandleBoProcessor.trimHandle(carrierOrInventoryBo)).getItemBo()));
|
||||
return carrierMember;
|
||||
}).collect(Collectors.toList()));
|
||||
wmsCarrierMemberLogService.saveBatch(carrierOrInventoryBoList.stream().map(carrierOrInventoryBo -> {
|
||||
@ -870,7 +866,7 @@ public class WmsCarrierMemberServiceImpl extends ServiceImpl<WmsCarrierMemberMap
|
||||
}
|
||||
}
|
||||
|
||||
@GlobalTransactional
|
||||
//@GlobalTransactional
|
||||
@Override
|
||||
public void unBindBatch(String user, String carrier, Collection<String> carrierOrInventoryList, String verifyParentIsBind, String activityId) {
|
||||
String site = TenantContextHolder.getTenantId();
|
||||
@ -884,13 +880,13 @@ public class WmsCarrierMemberServiceImpl extends ServiceImpl<WmsCarrierMemberMap
|
||||
if ("N".equals(bindStorageBin)) {
|
||||
throw BusinessException.build("托盘号:" + carrier + "已绑定且不在默认货位");
|
||||
} else {*/
|
||||
List<String> carrierOrInventoryBoList = carrierOrInventoryList.stream().map(o -> Inventory.genHandle(site, o)).collect(Collectors.toList());
|
||||
List<Inventory> inventoryList = inventoryService.listByIds(carrierOrInventoryBoList);
|
||||
if (CollectionUtil.isNotEmpty(inventoryList)) {
|
||||
if (inventoryList.size() != carrierOrInventoryList.size()) {
|
||||
carrierOrInventoryList.removeAll(inventoryList.stream().map(Inventory::getInventoryId).collect(Collectors.toList()));
|
||||
throw BusinessException.build("条码[" + String.join(",", carrierOrInventoryList) + "]不存在,或非库存条码");
|
||||
}/* else if ("Y".equals(verifyParentIsBind)) {
|
||||
List<String> carrierOrInventoryBoList = carrierOrInventoryList.stream().map(o -> Inventory.genHandle(site, o)).collect(Collectors.toList());
|
||||
List<Inventory> inventoryList = inventoryService.listByIds(carrierOrInventoryBoList);
|
||||
if (CollectionUtil.isNotEmpty(inventoryList)) {
|
||||
if (inventoryList.size() != carrierOrInventoryList.size()) {
|
||||
carrierOrInventoryList.removeAll(inventoryList.stream().map(Inventory::getInventoryId).collect(Collectors.toList()));
|
||||
throw BusinessException.build("条码[" + String.join(",", carrierOrInventoryList) + "]不存在,或非库存条码");
|
||||
}/* else if ("Y".equals(verifyParentIsBind)) {
|
||||
long count = count(Wrappers.lambdaQuery(CarrierMember.class).eq(CarrierMember::getCarrierOrInventoryBo, carrierBo));
|
||||
if (count > 0) {
|
||||
throw BusinessException.build("条码" + carrier + "已绑定托,请解绑后再进行箱卷解绑");
|
||||
@ -901,8 +897,8 @@ public class WmsCarrierMemberServiceImpl extends ServiceImpl<WmsCarrierMemberMap
|
||||
.set(Inventory::getErpStorageLocation, null)
|
||||
.set(Inventory::getUpdateTime, LocalDateTime.now())
|
||||
.set(Inventory::getUpdater, user));*/
|
||||
} else {
|
||||
throw BusinessException.build("条码[" + String.join(",", carrierOrInventoryList) + "]不存在");
|
||||
} else {
|
||||
throw BusinessException.build("条码[" + String.join(",", carrierOrInventoryList) + "]不存在");
|
||||
/*carrierOrInventoryBoList = carrierOrInventoryList.stream().map(o -> Carrier.genHandle(site, o)).collect(Collectors.toList());
|
||||
List<Carrier> carriersWitingBind = wmsCarrierService.listByIds(carrierOrInventoryBoList);
|
||||
if (carriersWitingBind.size() != carrierOrInventoryList.size()) {
|
||||
@ -917,14 +913,14 @@ public class WmsCarrierMemberServiceImpl extends ServiceImpl<WmsCarrierMemberMap
|
||||
.set(Inventory::getUpdateTime, LocalDateTime.now())
|
||||
.set(Inventory::getUpdater, user));
|
||||
}*/
|
||||
}
|
||||
List<CarrierMember> bindList = list(Wrappers.lambdaQuery(CarrierMember.class)
|
||||
.eq(CarrierMember::getCarrierBo, carrierBo)
|
||||
.in(CarrierMember::getCarrierOrInventoryBo, carrierOrInventoryBoList));
|
||||
if (bindList.size() != carrierOrInventoryBoList.size()) {
|
||||
carrierOrInventoryList.removeAll(bindList.stream().map(o -> StringUtil.trimHandle(o.getCarrierOrInventoryBo())).collect(Collectors.toList()));
|
||||
throw BusinessException.build("载具" + carrier + "与条码[" + String.join(",", carrierOrInventoryList) + "]不存在绑定关系");
|
||||
} else {
|
||||
}
|
||||
List<CarrierMember> bindList = list(Wrappers.lambdaQuery(CarrierMember.class)
|
||||
.eq(CarrierMember::getCarrierBo, carrierBo)
|
||||
.in(CarrierMember::getCarrierOrInventoryBo, carrierOrInventoryBoList));
|
||||
if (bindList.size() != carrierOrInventoryBoList.size()) {
|
||||
carrierOrInventoryList.removeAll(bindList.stream().map(o -> StringUtil.trimHandle(o.getCarrierOrInventoryBo())).collect(Collectors.toList()));
|
||||
throw BusinessException.build("载具" + carrier + "与条码[" + String.join(",", carrierOrInventoryList) + "]不存在绑定关系");
|
||||
} else {
|
||||
/*String newCarrierNo = null, storageBinBo = null;
|
||||
long count = count(Wrappers.lambdaQuery(CarrierMember.class).eq(CarrierMember::getCarrierBo, carrierBo));
|
||||
boolean allUnBind = count == bindList.size();
|
||||
@ -942,7 +938,7 @@ public class WmsCarrierMemberServiceImpl extends ServiceImpl<WmsCarrierMemberMap
|
||||
storageBinBo = storageBin.getHandle();
|
||||
}
|
||||
}*/
|
||||
removeBatchByIds(bindList.stream().map(CarrierMember::getHandle).collect(Collectors.toList()));
|
||||
removeBatchByIds(bindList.stream().map(CarrierMember::getHandle).collect(Collectors.toList()));
|
||||
/*if (StrUtil.isNotBlank(newCarrierNo)) {
|
||||
if (StrUtil.isBlank(storageBinBo)) {
|
||||
throw BusinessException.build("未找到托条码" + carrier + "上架信息");
|
||||
@ -951,16 +947,16 @@ public class WmsCarrierMemberServiceImpl extends ServiceImpl<WmsCarrierMemberMap
|
||||
storageBinBindInventoryService.carrierBind(StringUtil.trimHandle(storageBinBo), newCarrierNo);
|
||||
}
|
||||
}*/
|
||||
wmsCarrierMemberLogService.saveBatch(carrierOrInventoryBoList.stream().map(carrierOrInventoryBo -> {
|
||||
CarrierMemberLog carrierMemberLog = new CarrierMemberLog();
|
||||
carrierMemberLog.setCarrierOrInventoryBo(carrierOrInventoryBo);
|
||||
carrierMemberLog.setCarrierBo(carrierBo);
|
||||
carrierMemberLog.setStatus("N");
|
||||
carrierMemberLog.setCreateTime(LocalDateTime.now());
|
||||
carrierMemberLog.setCreator(user);
|
||||
return carrierMemberLog;
|
||||
}).collect(Collectors.toList()));
|
||||
}
|
||||
wmsCarrierMemberLogService.saveBatch(carrierOrInventoryBoList.stream().map(carrierOrInventoryBo -> {
|
||||
CarrierMemberLog carrierMemberLog = new CarrierMemberLog();
|
||||
carrierMemberLog.setCarrierOrInventoryBo(carrierOrInventoryBo);
|
||||
carrierMemberLog.setCarrierBo(carrierBo);
|
||||
carrierMemberLog.setStatus("N");
|
||||
carrierMemberLog.setCreateTime(LocalDateTime.now());
|
||||
carrierMemberLog.setCreator(user);
|
||||
return carrierMemberLog;
|
||||
}).collect(Collectors.toList()));
|
||||
}
|
||||
//}
|
||||
}
|
||||
/*CarrierType byId = wmsCarrierTypeService.getById(carrierSelect.getCarrierTypeBo());
|
||||
@ -974,7 +970,7 @@ public class WmsCarrierMemberServiceImpl extends ServiceImpl<WmsCarrierMemberMap
|
||||
|
||||
@Override
|
||||
public boolean confirmUnBind(String site, String activityId, String confirmId) {
|
||||
if (StrUtil.isNotBlank(activityId)) {
|
||||
/*if (StrUtil.isNotBlank(activityId)) {
|
||||
R<SysActivityOption> option = activityOptionService.getByActivityOption(activityId, Constant.ACTIVITY_OPTION_CONFIRM_ID, SecurityConstants.FROM_IN);
|
||||
if (option.getCode() != 0) {
|
||||
throw BusinessException.build(option.getMsg());
|
||||
@ -984,11 +980,11 @@ public class WmsCarrierMemberServiceImpl extends ServiceImpl<WmsCarrierMemberMap
|
||||
throw BusinessException.build("解绑密码错误");
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
return true;
|
||||
}
|
||||
|
||||
private String generateNewCarrierNo(String activityId) {
|
||||
/*private String generateNewCarrierNo(String activityId) {
|
||||
String newCarrierNo = null;
|
||||
if (StrUtil.isNotBlank(activityId)) {
|
||||
R<SysActivityOption> option = activityOptionService.getByActivityOption(activityId, Constant.ACTIVITY_OPTION_UNBIND_XNT, SecurityConstants.FROM_IN);
|
||||
@ -1002,32 +998,8 @@ public class WmsCarrierMemberServiceImpl extends ServiceImpl<WmsCarrierMemberMap
|
||||
}
|
||||
}
|
||||
return newCarrierNo;
|
||||
}
|
||||
}*/
|
||||
|
||||
private String removeParentBindMember(String user, String carrierBo) {
|
||||
String parentCarrierBo = getUpperCarrierBo(carrierBo);
|
||||
String parentCarrier = StringUtil.trimHandle(parentCarrierBo);
|
||||
if (parentCarrierBo.equals(carrierBo)) {
|
||||
return storageBinBindInventoryService.carrierUnbind(user, parentCarrier, false);
|
||||
} else {
|
||||
String storageBinBo = null;
|
||||
long count = count(Wrappers.lambdaQuery(CarrierMember.class).eq(CarrierMember::getCarrierBo, parentCarrierBo));
|
||||
if (count == 1) {
|
||||
storageBinBo = storageBinBindInventoryService.carrierUnbind(user, parentCarrier, false);
|
||||
}
|
||||
boolean del = removeById(CarrierMember.genHandle(parentCarrierBo, carrierBo));
|
||||
if (del) {
|
||||
CarrierMemberLog carrierMemberLog = new CarrierMemberLog();
|
||||
carrierMemberLog.setCarrierOrInventoryBo(carrierBo);
|
||||
carrierMemberLog.setCarrierBo(parentCarrierBo);
|
||||
carrierMemberLog.setStatus("N");
|
||||
carrierMemberLog.setCreateTime(LocalDateTime.now());
|
||||
carrierMemberLog.setCreator(user);
|
||||
wmsCarrierMemberLogService.save(carrierMemberLog);
|
||||
}
|
||||
return storageBinBo;
|
||||
}
|
||||
}
|
||||
|
||||
private void integrationTrayExtendFields(String carrierBo) {
|
||||
List<CarrierMemberDto> bindList = getBindCarrierList(carrierBo);
|
||||
@ -1036,7 +1008,6 @@ public class WmsCarrierMemberServiceImpl extends ServiceImpl<WmsCarrierMemberMap
|
||||
update(Wrappers.lambdaUpdate(CarrierMember.class)
|
||||
.eq(CarrierMember::getCarrierBo, carrierBo)
|
||||
.set(CarrierMember::getItem, carrierMemberDto.getItem())
|
||||
.set(CarrierMember::getEarliestProductionDate, carrierMemberDto.getEarliestProductionDate())
|
||||
.set(CarrierMember::getFrozenState, Constant.INVENTORY_STSTUS_1005.equals(carrierMemberDto.getStatus()) ? " Y" : null));
|
||||
}
|
||||
}
|
||||
@ -1059,4 +1030,38 @@ public class WmsCarrierMemberServiceImpl extends ServiceImpl<WmsCarrierMemberMap
|
||||
public boolean checkTrayOverdue(String site, String documentNo, String carrierBo) {
|
||||
return baseMapper.checkTrayOverdue(site, documentNo, carrierBo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ScanCodeDTO> scanCode(String site, String user, String code) {
|
||||
List<ScanCodeDTO> scanCodeDTOS = inventoryService.selectInvByCode(site, user, code);
|
||||
pickingService.checkCodePicking(site, code);
|
||||
if (CollectionUtil.isEmpty(scanCodeDTOS)) {
|
||||
throw BusinessException.build("条码不存在");
|
||||
} else {
|
||||
List<ScanCodeDTO> needUnBindStorageBinList = scanCodeDTOS.stream().filter(o -> StrUtil.isNotBlank(o.getWmsStorageBinBo())).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(needUnBindStorageBinList)) {
|
||||
throw BusinessException.build("条码[" + needUnBindStorageBinList.stream().map(ScanCodeDTO::getInventoryId).collect(Collectors.joining()) + "]已绑定货格,请先下架");
|
||||
}
|
||||
return scanCodeDTOS;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CarrierMemberDto> getStorageBinBindCount(String site, String storageBin) {
|
||||
boolean exists = wmsStorageBinService.lambdaQuery().eq(StorageBin::getHandle, StorageBin.genHandle(site, storageBin)).exists();
|
||||
if (!exists) {
|
||||
throw BusinessException.build("货位不存在");
|
||||
}
|
||||
return baseMapper.getBindCount(null, StorageBin.genHandle(site, storageBin));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CarrierMemberDto> getCarrierBindCount(String site, String carrier) {
|
||||
boolean exists = wmsCarrierService.lambdaQuery().eq(Carrier::getHandle, Carrier.genHandle(site, carrier)).exists();
|
||||
if (!exists) {
|
||||
throw BusinessException.build("载具不存在");
|
||||
} else {
|
||||
return baseMapper.getBindCount(Carrier.genHandle(site, carrier), null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
package com.foreverwin.mom.wms.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
|
||||
@ -10,14 +11,14 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.foreverwin.mom.common.core.exception.BusinessException;
|
||||
import com.foreverwin.mom.common.data.tenant.TenantContextHolder;
|
||||
import com.foreverwin.mom.common.security.util.SecurityUtils;
|
||||
import com.foreverwin.mom.wms.constant.Constant;
|
||||
import com.foreverwin.mom.wms.dto.ScanCodeDTO;
|
||||
import com.foreverwin.mom.wms.entity.*;
|
||||
import com.foreverwin.mom.wms.mapper.ZWmsStorageBinMapper;
|
||||
import com.foreverwin.mom.wms.dto.StorageBinDto;
|
||||
import com.foreverwin.mom.wms.entity.StorageBin;
|
||||
import com.foreverwin.mom.wms.entity.StorageBinBindInventory;
|
||||
import com.foreverwin.mom.wms.entity.StorageBinType;
|
||||
import com.foreverwin.mom.wms.entity.StorageLocation;
|
||||
import com.foreverwin.mom.wms.service.*;
|
||||
import com.foreverwin.mom.wms.util.RegexUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
@ -26,10 +27,8 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.sql.SQLIntegrityConstraintViolationException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 存储货格主数据
|
||||
@ -38,27 +37,33 @@ import java.util.Map;
|
||||
* @date 2022-10-25 13:17:12
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class WmsStorageBinServiceImpl extends ServiceImpl<ZWmsStorageBinMapper, StorageBin> implements WmsStorageBinService {
|
||||
|
||||
@Autowired
|
||||
private WmsStorageLocationService storageLocationService;
|
||||
private final WmsStorageLocationService storageLocationService;
|
||||
|
||||
private final StorageBinTypeService storageBinTypeService;
|
||||
|
||||
private final ZWmsStorageBinMapper storageBinMapper;
|
||||
|
||||
private final PickingService pickingService;
|
||||
|
||||
private final ZWmsInventoryLogService inventoryLogService;
|
||||
|
||||
private ZWmsInventoryService inventoryService;
|
||||
|
||||
@Autowired
|
||||
private StorageBinTypeService storageBinTypeService;
|
||||
|
||||
@Autowired
|
||||
private ZWmsStorageBinMapper storageBinMapper;
|
||||
|
||||
@Autowired
|
||||
@Lazy
|
||||
private StorageBinBindInventoryService storageBinBindInventoryService;
|
||||
public void setInventoryService(@Lazy ZWmsInventoryService inventoryService) {
|
||||
this.inventoryService = inventoryService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage getStorageBinPage(Page page, StorageBinDto storageBinDto) {
|
||||
String site = TenantContextHolder.getTenantId();
|
||||
storageBinDto.setSite(site);
|
||||
return storageBinMapper.getStorageBinPage(page,storageBinDto);
|
||||
return storageBinMapper.getStorageBinPage(page, storageBinDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean save(StorageBinDto storageBinDto) {
|
||||
//获取当前站点
|
||||
@ -67,25 +72,25 @@ public class WmsStorageBinServiceImpl extends ServiceImpl<ZWmsStorageBinMapper,
|
||||
String user = SecurityUtils.getUserName();
|
||||
//获取当前时间
|
||||
LocalDateTime localDateTime = LocalDateTime.now();
|
||||
if (StrUtil.isBlank(storageBinDto.getStorageBin())){
|
||||
if (StrUtil.isBlank(storageBinDto.getStorageBin())) {
|
||||
throw BusinessException.build("存储货格不能为空");
|
||||
}
|
||||
//名称中不可带中文
|
||||
if (RegexUtils.isContainsChinese(storageBinDto.getStorageBin())){
|
||||
if (RegexUtils.isContainsChinese(storageBinDto.getStorageBin())) {
|
||||
throw BusinessException.build("名称中不可带中文");
|
||||
}
|
||||
String handle = StorageBin.genHandle(site,storageBinDto.getStorageBin());
|
||||
String handle = StorageBin.genHandle(site, storageBinDto.getStorageBin());
|
||||
StorageBin storageBin = new StorageBin();
|
||||
|
||||
if(!StrUtil.isBlank(storageBinDto.getStorageLocation()) && StrUtil.isBlank(storageBinDto.getStorageLocationBo())){
|
||||
if (!StrUtil.isBlank(storageBinDto.getStorageLocation()) && StrUtil.isBlank(storageBinDto.getStorageLocationBo())) {
|
||||
String s = StorageLocation.genHandle(site, storageBinDto.getStorageLocation());
|
||||
StorageLocation byId = storageLocationService.getById(s);
|
||||
if (byId == null){
|
||||
if (byId == null) {
|
||||
throw BusinessException.build("不存在此存储位置");
|
||||
}
|
||||
storageBinDto.setStorageLocationBo(byId.getHandle());
|
||||
}
|
||||
BeanUtils.copyProperties(this.validate(storageBinDto,site),storageBin);
|
||||
BeanUtils.copyProperties(this.validate(storageBinDto, site), storageBin);
|
||||
storageBin.setHandle(handle);
|
||||
storageBin.setSite(site);
|
||||
storageBin.setCreateTime(localDateTime);
|
||||
@ -94,7 +99,7 @@ public class WmsStorageBinServiceImpl extends ServiceImpl<ZWmsStorageBinMapper,
|
||||
try {
|
||||
return super.save(storageBin);
|
||||
} catch (Exception e) {
|
||||
if(e instanceof SQLIntegrityConstraintViolationException || e instanceof DuplicateKeyException) {
|
||||
if (e instanceof SQLIntegrityConstraintViolationException || e instanceof DuplicateKeyException) {
|
||||
throw new MybatisPlusException("此存储位置已存在");
|
||||
} else {
|
||||
throw e;
|
||||
@ -109,105 +114,100 @@ public class WmsStorageBinServiceImpl extends ServiceImpl<ZWmsStorageBinMapper,
|
||||
LocalDateTime localDateTime = LocalDateTime.now();
|
||||
String handle = storageBinDto.getHandle();
|
||||
StorageBin byId = this.getById(handle);
|
||||
if(!StrUtil.isBlank(storageBinDto.getStorageLocation())){
|
||||
if (!StrUtil.isBlank(storageBinDto.getStorageLocation())) {
|
||||
String s = StorageLocation.genHandle(site, storageBinDto.getStorageLocation());
|
||||
StorageLocation storageLocation = storageLocationService.getById(s);
|
||||
if (storageLocation == null){
|
||||
if (storageLocation == null) {
|
||||
throw BusinessException.build("不存在此存储位置");
|
||||
} else if (!StorageLocation.STATUS_Y.equals(storageLocation.getStatus())){
|
||||
} else if (!StorageLocation.STATUS_Y.equals(storageLocation.getStatus())) {
|
||||
throw BusinessException.build(storageLocation.getStorageLocation() + "区域停用,货格不允许置为可用");
|
||||
}
|
||||
storageBinDto.setStorageLocationBo(storageLocation.getHandle());
|
||||
}else{
|
||||
} else {
|
||||
storageBinDto.setStorageLocationBo("");
|
||||
}
|
||||
|
||||
if(StorageBin.STATUS_N.equals(storageBinDto.getStatus())){
|
||||
long count = storageBinBindInventoryService.count(Wrappers.lambdaQuery(StorageBinBindInventory.class).eq(StorageBinBindInventory::getStorageBinBo, handle));
|
||||
if (count > 0) {
|
||||
if (StorageBin.STATUS_N.equals(storageBinDto.getStatus())) {
|
||||
boolean exists = inventoryService.lambdaQuery().eq(Inventory::getWmsStorageBinBo, handle).exists();
|
||||
if (exists) {
|
||||
throw BusinessException.build(byId.getStorageBin() + "货格存在货物,不可停用");
|
||||
}
|
||||
}
|
||||
BeanUtils.copyProperties(this.validate(storageBinDto,site),byId);
|
||||
BeanUtils.copyProperties(this.validate(storageBinDto, site), byId);
|
||||
byId.setUpdateTime(localDateTime);
|
||||
byId.setUpdater(user);
|
||||
return super.updateById(byId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String labelPrint(String site,List<StorageBin> printList, String printNumber) {
|
||||
public String labelPrint(String site, List<StorageBin> printList, String printNumber) {
|
||||
// PrintResult printResult = null;
|
||||
String user = SecurityUtils.getUserName();
|
||||
List<Map<String, Object>> mapList=new ArrayList<>();
|
||||
for (StorageBin printDto:printList){
|
||||
List<Map<String, Object>> mapList = new ArrayList<>();
|
||||
for (StorageBin printDto : printList) {
|
||||
String storageBin = printDto.getStorageBin();
|
||||
String handle = StorageBin.genHandle(site,storageBin);
|
||||
String handle = StorageBin.genHandle(site, storageBin);
|
||||
StorageBin byId = this.getById(handle);
|
||||
if (byId==null){
|
||||
throw BusinessException.build("存储货格"+ storageBin +"不存在");
|
||||
if (byId == null) {
|
||||
throw BusinessException.build("存储货格" + storageBin + "不存在");
|
||||
}
|
||||
Map<String,Object> dataMap = new HashMap();
|
||||
dataMap.put("storageNo",storageBin);
|
||||
dataMap.put("description",byId.getDescription());
|
||||
Map<String, Object> dataMap = new HashMap();
|
||||
dataMap.put("storageNo", storageBin);
|
||||
dataMap.put("description", byId.getDescription());
|
||||
mapList.add(dataMap);
|
||||
}
|
||||
// printResult= printService.doPrintForHorizon2(site, user, "", printList.get(0).getStorageBin(), 1, "", Constant.PRINT_SCENARIO_STORAGE_LOCATION, mapList, printNumber);
|
||||
|
||||
return "暂无打印";
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageBin getByStorageLocation(String site, String storageLocation) {
|
||||
String storageLocationBo = StorageLocation.genHandle(site, storageLocation);
|
||||
LambdaQueryWrapper<StorageBin> queryWrapper=new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(StorageBin::getStorageLocationBo,storageLocationBo);
|
||||
queryWrapper.eq(StorageBin::getIsDefault,"Y");
|
||||
queryWrapper.eq(StorageBin::getStatus,StorageBin.STATUS_Y);
|
||||
LambdaQueryWrapper<StorageBin> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(StorageBin::getStorageLocationBo, storageLocationBo);
|
||||
queryWrapper.eq(StorageBin::getIsDefault, "Y");
|
||||
queryWrapper.eq(StorageBin::getStatus, StorageBin.STATUS_Y);
|
||||
List<StorageBin> list = this.list(queryWrapper);
|
||||
if (!list.isEmpty()){
|
||||
if (!list.isEmpty()) {
|
||||
return list.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
//新增和更新时个别字段的验证
|
||||
private StorageBinDto validate(StorageBinDto storageBinDto, String site){
|
||||
private StorageBinDto validate(StorageBinDto storageBinDto, String site) {
|
||||
//判断是否选择存储货格类型
|
||||
if(StrUtil.isBlank(storageBinDto.getStorageBinType())){
|
||||
if (StrUtil.isBlank(storageBinDto.getStorageBinType())) {
|
||||
throw BusinessException.build("存储货格类型不能为空");
|
||||
}else {
|
||||
} else {
|
||||
String s = StorageBinType.genHandle(site, storageBinDto.getStorageBinType());
|
||||
StorageBinType byId = storageBinTypeService.getById(s);
|
||||
if (byId == null){
|
||||
if (byId == null) {
|
||||
throw BusinessException.build("不存在此存储货格类型");
|
||||
}
|
||||
storageBinDto.setStorageBinTypeBo(byId.getHandle());
|
||||
}
|
||||
|
||||
//判断是否为默认存储货格
|
||||
if ("Y".equals(storageBinDto.getIsDefault())){
|
||||
//判断选择的存储货格类型下是否已拥有默认货格
|
||||
LambdaQueryWrapper<StorageBin> queryWrapper = new LambdaQueryWrapper<StorageBin>().eq(StorageBin::getStorageLocationBo,storageBinDto.getStorageLocationBo())
|
||||
.eq(StorageBin::getIsDefault,"Y").eq(StorageBin::getSite,site);
|
||||
StorageBin one = this.getOne(queryWrapper,false);
|
||||
if (one != null && !one.getHandle().equals(storageBinDto.getHandle()) ){
|
||||
throw BusinessException.build("当前存储位置下已有默认存储货格");
|
||||
}
|
||||
if ("Y".equals(storageBinDto.getIsDefault())) {
|
||||
//判断选择的存储货格类型下是否已拥有默认货格
|
||||
LambdaQueryWrapper<StorageBin> queryWrapper = new LambdaQueryWrapper<StorageBin>().eq(StorageBin::getStorageLocationBo, storageBinDto.getStorageLocationBo())
|
||||
.eq(StorageBin::getIsDefault, "Y").eq(StorageBin::getSite, site);
|
||||
StorageBin one = this.getOne(queryWrapper, false);
|
||||
if (one != null && !one.getHandle().equals(storageBinDto.getHandle())) {
|
||||
throw BusinessException.build("当前存储位置下已有默认存储货格");
|
||||
}
|
||||
}
|
||||
return storageBinDto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageLocation getStorageLocationByStorageBin(String storageBin) {
|
||||
String site = TenantContextHolder.getTenantId();
|
||||
public String getStorageLocationByStorageBin(String site, String storageBin) {
|
||||
StorageBin byId = this.getById(StorageBin.genHandle(site, storageBin));
|
||||
if(byId != null){
|
||||
String storageLocationBo = byId.getStorageLocationBo();
|
||||
StorageLocation storageLocation = storageLocationService.getById(storageLocationBo);
|
||||
if (StorageLocation.STATUS_N.equals(storageLocation.getStatus())){
|
||||
throw BusinessException.build("存储位置已停用");
|
||||
} else {
|
||||
return storageLocation;
|
||||
}
|
||||
}else {
|
||||
if (byId != null) {
|
||||
return baseMapper.getStorageBinWarehouse(byId.getHandle());
|
||||
} else {
|
||||
throw BusinessException.build("存储货格" + storageBin + "不存在");
|
||||
}
|
||||
}
|
||||
@ -216,12 +216,12 @@ public class WmsStorageBinServiceImpl extends ServiceImpl<ZWmsStorageBinMapper,
|
||||
public StorageBinDto getByCode(String site, String storageBin) {
|
||||
StorageBinDto storageBinDto = new StorageBinDto();
|
||||
StorageBin byId = this.getById(StorageBin.genHandle(site, storageBin));
|
||||
if (byId==null){
|
||||
throw BusinessException.build("存储货格"+storageBin+"不存在");
|
||||
if (byId == null) {
|
||||
throw BusinessException.build("存储货格" + storageBin + "不存在");
|
||||
} else if (StorageBin.STATUS_N.equals(byId.getStatus())) {
|
||||
throw BusinessException.build("存储货格"+storageBin+"已停用");
|
||||
throw BusinessException.build("存储货格" + storageBin + "已停用");
|
||||
}
|
||||
BeanUtils.copyProperties(byId,storageBinDto);
|
||||
BeanUtils.copyProperties(byId, storageBinDto);
|
||||
StorageBinType storageBinType = storageBinTypeService.getById(byId.getStorageBinTypeBo());
|
||||
StorageLocation storageLocation = storageLocationService.getById(byId.getStorageLocationBo());
|
||||
storageBinDto.setStorageLocation(storageLocation.getStorageLocation());
|
||||
@ -230,4 +230,51 @@ public class WmsStorageBinServiceImpl extends ServiceImpl<ZWmsStorageBinMapper,
|
||||
storageBinDto.setMixItem(storageBinType.getMixItem());
|
||||
return storageBinDto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bind(String site, String user, String storageBin, List<String> inventoryIdList) {
|
||||
String storageBinBo = StorageBin.genHandle(site, storageBin);
|
||||
String erpStorageLocation = Optional.ofNullable(getStorageLocationByStorageBin(site, storageBin)).orElseThrow(() -> BusinessException.build("未找到货格对应的仓库"));
|
||||
List<String> inventoryBoList = inventoryIdList.stream().map(o -> Inventory.genHandle(site, o)).collect(Collectors.toList());
|
||||
List<Inventory> inventoryList = inventoryService.listByIds(inventoryBoList);
|
||||
inventoryList.stream().filter(o -> !erpStorageLocation.equals(o.getErpStorageLocation())).findFirst().ifPresent(inventory -> {
|
||||
throw BusinessException.build("条码" + inventory.getInventoryId() + "库存地点与货格不匹配");
|
||||
});
|
||||
if (CollectionUtil.isEmpty(inventoryList) || inventoryList.size() != inventoryIdList.size()) {
|
||||
inventoryIdList.removeAll(inventoryList.stream().map(Inventory::getInventoryId).collect(Collectors.toList()));
|
||||
throw BusinessException.build("库存[" + String.join(",", inventoryIdList) + "]不存在");
|
||||
}
|
||||
inventoryService.lambdaUpdate().in(Inventory::getHandle, inventoryBoList)
|
||||
.set(Inventory::getWmsStorageBinBo, storageBinBo)
|
||||
.set(Inventory::getUpdateTime, LocalDateTime.now())
|
||||
.set(Inventory::getUpdater, user).update();
|
||||
inventoryLogService.saveBatch(inventoryList.stream().map(inventory -> inventoryLogService.buildLog(user, inventory.getInventoryId(), null, null, Constant.CHANGE_TYPE_UP_SHELF, inventory.getWmsStorageBinBo(), inventory.getQtyOnHand(), storageBinBo, null, null, null)).collect(Collectors.toList()));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unBind(String site, String user, List<String> inventoryIdList) {
|
||||
List<String> inventoryBoList = inventoryIdList.stream().map(o -> Inventory.genHandle(site, o)).collect(Collectors.toList());
|
||||
List<Inventory> inventoryList = inventoryService.listByIds(inventoryBoList);
|
||||
if (CollectionUtil.isEmpty(inventoryList) || inventoryList.size() != inventoryIdList.size()) {
|
||||
inventoryIdList.removeAll(inventoryList.stream().map(Inventory::getInventoryId).collect(Collectors.toList()));
|
||||
throw BusinessException.build("库存[" + String.join(",", inventoryIdList) + "]不存在");
|
||||
}
|
||||
inventoryService.lambdaUpdate().in(Inventory::getHandle, inventoryBoList)
|
||||
.set(Inventory::getWmsStorageBinBo, null)
|
||||
.set(Inventory::getUpdateTime, LocalDateTime.now())
|
||||
.set(Inventory::getUpdater, user).update();
|
||||
inventoryLogService.saveBatch(inventoryList.stream().map(inventory -> inventoryLogService.buildLog(user, inventory.getInventoryId(), null, null, Constant.CHANGE_TYPE_UP_SHELF, inventory.getWmsStorageBinBo(), inventory.getQtyOnHand(), null, null, null, null)).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ScanCodeDTO> scanCode(String site, String user, String code) {
|
||||
pickingService.checkCodePicking(site, code);
|
||||
List<ScanCodeDTO> scanCodeDTOS = inventoryService.selectTrayInvByCode(site, user, code);
|
||||
if (CollectionUtil.isEmpty(scanCodeDTOS)) {
|
||||
throw BusinessException.build("条码" + code + "无法识别");
|
||||
} else {
|
||||
return scanCodeDTOS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,6 +16,9 @@ import com.foreverwin.mom.wms.service.WmsStorageBinService;
|
||||
import com.foreverwin.mom.wms.service.WmsStorageLocationService;
|
||||
import com.foreverwin.mom.wms.util.StringUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.dao.DuplicateKeyException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -32,12 +35,17 @@ import java.util.Optional;
|
||||
* @date 2022-11-03 14:11:18
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
public class ZWmsInventoryLogServiceImpl extends ServiceImpl<ZWmsInventoryLogMapper, InventoryLog> implements ZWmsInventoryLogService {
|
||||
|
||||
final ZWmsInventoryLogMapper inventoryLogMapper;
|
||||
final WmsStorageBinService storageBinService;
|
||||
final WmsStorageLocationService storageLocationService;
|
||||
private final WmsStorageLocationService storageLocationService;
|
||||
|
||||
private WmsStorageBinService storageBinService;
|
||||
|
||||
@Autowired
|
||||
public void setStorageBinService(@Lazy WmsStorageBinService storageBinService) {
|
||||
this.storageBinService = storageBinService;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
@ -68,7 +76,7 @@ public class ZWmsInventoryLogServiceImpl extends ServiceImpl<ZWmsInventoryLogMap
|
||||
public void saveLog(String user, String inventoryId, String documentNo, String previousStatus, String changeType, String previousStorageBinBo, BigDecimal previousQty, String currentStorageBinBo, String comments, String reversalFlag) {
|
||||
String site = TenantContextHolder.getTenantId();
|
||||
String inventoryBo = Inventory.genHandle(site, inventoryId);
|
||||
Inventory inventory = inventoryLogMapper.getInventory(inventoryBo);
|
||||
Inventory inventory = baseMapper.getInventory(inventoryBo);
|
||||
InventoryLog inventoryLog = new InventoryLog();
|
||||
inventoryLog.setDocumentNo(documentNo);
|
||||
inventoryLog.setInventoryBo(inventoryBo);
|
||||
@ -121,7 +129,7 @@ public class ZWmsInventoryLogServiceImpl extends ServiceImpl<ZWmsInventoryLogMap
|
||||
public InventoryLog buildLog(String user, String inventoryId, String documentNo, String previousStatus, String changeType, String previousStorageBinBo, BigDecimal previousQty, String currentStorageBinBo, String comments, String reversalFlag, Inventory inventory) {
|
||||
String site = TenantContextHolder.getTenantId();
|
||||
String inventoryBo = Inventory.genHandle(site, inventoryId);
|
||||
inventory = Optional.ofNullable(inventory).orElseGet(() -> inventoryLogMapper.getInventory(inventoryBo));
|
||||
inventory = Optional.ofNullable(inventory).orElseGet(() -> baseMapper.getInventory(inventoryBo));
|
||||
InventoryLog inventoryLog = new InventoryLog();
|
||||
inventoryLog.setDocumentNo(documentNo);
|
||||
inventoryLog.setInventoryBo(inventoryBo);
|
||||
|
||||
@ -25,6 +25,8 @@ import com.foreverwin.iep.prd.feign.RemoteNextNumberService;
|
||||
import com.foreverwin.mom.wms.entity.Inventory;
|
||||
import com.foreverwin.mom.wms.entity.InventoryGroup;
|
||||
import com.foreverwin.mom.wms.entity.StorageBinBindInventory;
|
||||
import com.foreverwin.mom.wms.dto.ScanCodeDTO;
|
||||
import com.foreverwin.mom.wms.entity.*;
|
||||
import com.foreverwin.mom.wms.mapper.ZWmsInventoryMapper;
|
||||
import com.foreverwin.mom.wms.service.WmsCarrierMemberService;
|
||||
import com.foreverwin.mom.wms.service.InventoryGroupService;
|
||||
@ -32,6 +34,7 @@ import com.foreverwin.mom.wms.service.StorageBinBindInventoryService;
|
||||
import com.foreverwin.mom.wms.service.ZWmsInventoryLogService;
|
||||
import com.foreverwin.mom.wms.service.ZWmsInventoryService;
|
||||
import com.foreverwin.mom.wms.service.WmsItemService;
|
||||
import com.foreverwin.mom.wms.service.*;
|
||||
import com.foreverwin.mom.wms.util.StringUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@ -62,26 +65,21 @@ import java.util.stream.Collectors;
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class ZWmsInventoryServiceImpl extends ServiceImpl<ZWmsInventoryMapper, Inventory> implements ZWmsInventoryService {
|
||||
|
||||
private final ZWmsInventoryMapper inventoryMapper;
|
||||
private final ZWmsInventoryLogService inventoryLogService;
|
||||
private final WmsItemService itemService;
|
||||
|
||||
private final InventoryGroupService inventoryGroupService;
|
||||
|
||||
private StorageBinBindInventoryService storageBinBindInventoryService;
|
||||
private final RemoteNextNumberService remoteNextNumberService;
|
||||
private WmsCarrierMemberService wmsCarrierMemberService;
|
||||
|
||||
@Autowired
|
||||
public void setStorageBinBindInventoryService(@Lazy StorageBinBindInventoryService storageBinBindInventoryService) {
|
||||
this.storageBinBindInventoryService = storageBinBindInventoryService;
|
||||
}
|
||||
private final RemoteNextNumberService remoteNextNumberService;
|
||||
|
||||
@Autowired
|
||||
public void setWmsCarrierMemberService(@Lazy WmsCarrierMemberService wmsCarrierMemberService) {
|
||||
this.wmsCarrierMemberService = wmsCarrierMemberService;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Inventory getByCode(String site, String code) {
|
||||
|
||||
@ -129,17 +127,17 @@ private final RemoteNextNumberService remoteNextNumberService;
|
||||
|
||||
@Override
|
||||
public IPage getInventoryDtoPage(FrontPage page, Inventory inventory) {
|
||||
return inventoryMapper.getInventoryDtoPage(page, inventory);
|
||||
return baseMapper.getInventoryDtoPage(page, inventory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage getInventoryDtoPageByCarrier(FrontPage page, InventoryDto inventoryDto) {
|
||||
return inventoryMapper.getInventoryDtoPageByCarrier(page, inventoryDto);
|
||||
return baseMapper.getInventoryDtoPageByCarrier(page, inventoryDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InventoryDto getInventoryDto(String site, String inventoryId) {
|
||||
InventoryDto inventoryDto = inventoryMapper.getInventoryDto(Inventory.genHandle(site, inventoryId));
|
||||
InventoryDto inventoryDto = baseMapper.getInventoryDto(Inventory.genHandle(site, inventoryId));
|
||||
if (inventoryDto == null) {
|
||||
throw BusinessException.build("库存不存在");
|
||||
}
|
||||
@ -246,11 +244,12 @@ private final RemoteNextNumberService remoteNextNumberService;
|
||||
throw BusinessException.build("库存不存在");
|
||||
} else {
|
||||
//校验货格
|
||||
LambdaQueryWrapper<StorageBinBindInventory> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
/*LambdaQueryWrapper<StorageBinBindInventory> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(StorageBinBindInventory::getInventoryBo, parentInventory.getHandle());
|
||||
lambdaQueryWrapper.eq(StorageBinBindInventory::getStatus, "Y");
|
||||
List<StorageBinBindInventory> bindInventoryList = storageBinBindInventoryService.list(lambdaQueryWrapper);
|
||||
if (bindInventoryList.isEmpty()) {
|
||||
List<StorageBinBindInventory> bindInventoryList = storageBinBindInventoryService.list(lambdaQueryWrapper);*/
|
||||
String parentStorageBinBo = parentInventory.getWmsStorageBinBo();
|
||||
if (StrUtil.isBlank(parentStorageBinBo)) {
|
||||
throw BusinessException.build("条码" + parentInventory.getInventoryId() + "未绑定货格");
|
||||
} else {
|
||||
//校验数量
|
||||
@ -258,7 +257,6 @@ private final RemoteNextNumberService remoteNextNumberService;
|
||||
if (parentInventory.getQtyOnHand().compareTo(qty) < 0) {
|
||||
throw BusinessException.build("库存" + parentInventoryId + "数量" + parentInventory.getQtyOnHand().stripTrailingZeros().toPlainString() + "不满足拆批数量" + qty.stripTrailingZeros().toPlainString());
|
||||
} else {
|
||||
String parentStorageBinBo = bindInventoryList.get(0).getStorageBinBo();
|
||||
//生成新条码
|
||||
if (CollectionUtil.isEmpty(newInventoryIdList)) {
|
||||
newInventoryIdList = generatorDocumentNo("RAW_MATERIAL_ID", null,splitNum);
|
||||
@ -283,7 +281,10 @@ private final RemoteNextNumberService remoteNextNumberService;
|
||||
storageBinBo = StrUtil.blankToDefault(storageBinBo, parentStorageBinBo);
|
||||
|
||||
for (String inventoryId : newInventoryIdList) {
|
||||
storageBinBindInventoryService.inventoryBind(user, StringUtil.trimHandle(storageBinBo), inventoryId);
|
||||
lambdaUpdate().eq(Inventory::getHandle, Inventory.genHandle(site, inventoryId))
|
||||
.set(Inventory::getWmsStorageBinBo, storageBinBo)
|
||||
.set(Inventory::getUpdateTime, LocalDateTime.now())
|
||||
.set(Inventory::getUpdater, user).update();
|
||||
|
||||
inventoryLogService.saveLog(user, inventoryId, documentNo, null, StrUtil.isBlank(documentType) ? Constant.CHANGE_TYPE_SPLIT : documentType,
|
||||
null, null, storageBinBo);
|
||||
@ -294,7 +295,10 @@ private final RemoteNextNumberService remoteNextNumberService;
|
||||
//数量为0解绑父库存
|
||||
boolean parentIsEmpty = BigDecimal.ZERO.compareTo(subtract) == 0;
|
||||
if (parentIsEmpty) {
|
||||
storageBinBindInventoryService.inventoryUnbind(user, parentInventoryId);
|
||||
lambdaUpdate().eq(Inventory::getHandle, Inventory.genHandle(site, parentInventoryId))
|
||||
.set(Inventory::getWmsStorageBinBo, null)
|
||||
.set(Inventory::getUpdateTime, LocalDateTime.now())
|
||||
.set(Inventory::getUpdater, user).update();
|
||||
}
|
||||
//父库存日志
|
||||
inventoryLogService.saveLog(user, parentInventoryId, documentNo, parentInventory.getStatus(), Constant.CHANGE_TYPE_SPLIT,
|
||||
@ -330,30 +334,28 @@ private final RemoteNextNumberService remoteNextNumberService;
|
||||
throw BusinessException.build("库存[" + String.join(",", inventoryIdList) + "]不存在");
|
||||
} else {
|
||||
//查询并校验货格
|
||||
LambdaQueryWrapper<StorageBinBindInventory> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
/*LambdaQueryWrapper<StorageBinBindInventory> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(StorageBinBindInventory::getInventoryBo, inventoryBoList);
|
||||
lambdaQueryWrapper.eq(StorageBinBindInventory::getStatus, "Y");
|
||||
List<StorageBinBindInventory> bindInventoryList = storageBinBindInventoryService.list(lambdaQueryWrapper);
|
||||
if (CollectionUtil.isEmpty(bindInventoryList) || bindInventoryList.size() != inventoryIdList.size()) {
|
||||
inventoryIdList.removeAll(bindInventoryList.stream().map(o -> StringUtil.trimHandle(o.getInventoryBo())).collect(Collectors.toList()));
|
||||
throw BusinessException.build("库存[" + String.join(",", inventoryIdList) + "]未绑定货格");
|
||||
List<StorageBinBindInventory> bindInventoryList = storageBinBindInventoryService.list(lambdaQueryWrapper);*/
|
||||
List<Inventory> notBindList = lambdaQuery().in(Inventory::getHandle, inventoryBoList).isNull(Inventory::getWmsStorageBinBo).select(Inventory::getInventoryId).list();
|
||||
if (CollectionUtil.isNotEmpty(notBindList) ) {
|
||||
throw BusinessException.build("库存[" + notBindList.stream().map(Inventory::getInventoryId).collect(Collectors.joining(","))+ "]未绑定货格");
|
||||
} else {
|
||||
//扣除父库存数量并解绑
|
||||
Map<String, String> bindInventoryMap = bindInventoryList.stream().collect(Collectors.toMap(o -> StringUtil.trimHandle(o.getInventoryBo()), StorageBinBindInventory::getStorageBinBo));
|
||||
BigDecimal qty = BigDecimal.ZERO;
|
||||
|
||||
update(Wrappers.lambdaUpdate(Inventory.class).in(Inventory::getHandle, inventoryBoList)
|
||||
.set(Inventory::getWmsStorageBinBo, null)
|
||||
.set(Inventory::getQtyOnHand, BigDecimal.ZERO)
|
||||
.set(Inventory::getUpdater, user)
|
||||
.set(Inventory::getUpdateTime, LocalDateTime.now())
|
||||
.set(Inventory::getErpStorageLocation, null));
|
||||
storageBinBindInventoryService.inventoryUnbindBatch(user, inventoryIdList, false);
|
||||
.set(Inventory::getUpdateTime, LocalDateTime.now()));
|
||||
for (Inventory inventory : inventoryList) {
|
||||
String inventoryId = inventory.getInventoryId();
|
||||
BigDecimal qtyOnHand = inventory.getQtyOnHand();
|
||||
qty = qty.add(qtyOnHand);
|
||||
inventoryLogService.saveLog(user, inventoryId, null, inventory.getStatus(), Constant.CHANGE_TYPE_MERGE,
|
||||
bindInventoryMap.get(inventoryId), qtyOnHand, null);
|
||||
inventory.getWmsStorageBinBo(), qtyOnHand, null);
|
||||
}
|
||||
//创建新库存并绑定
|
||||
String inventoryId = generatorDocumentNo("RAW_MATERIAL_ID", null,1).get(0);
|
||||
@ -366,12 +368,10 @@ private final RemoteNextNumberService remoteNextNumberService;
|
||||
inventory.setOriginalQty(qty);
|
||||
inventory.setIsLot(null);
|
||||
inventory.setCreateTime(LocalDateTime.now());
|
||||
inventory.setWmsStorageBinBo(inventoryList.get(0).getWmsStorageBinBo());
|
||||
save(inventory);
|
||||
String storageBinBo = bindInventoryMap.get(inventoryIdList.get(0));
|
||||
|
||||
storageBinBindInventoryService.inventoryBind(user, StringUtil.trimHandle(storageBinBo), inventoryId);
|
||||
inventoryLogService.saveLog(user, inventoryId, null, null, Constant.CHANGE_TYPE_MERGE,
|
||||
null, null, storageBinBo);
|
||||
null, null, inventoryList.get(0).getWmsStorageBinBo());
|
||||
return inventoryId;
|
||||
}
|
||||
}
|
||||
@ -380,13 +380,13 @@ private final RemoteNextNumberService remoteNextNumberService;
|
||||
@Override
|
||||
public IPage fetchItemList(Page page, String item) {
|
||||
String site = TenantContextHolder.getTenantId();
|
||||
return inventoryMapper.getItemList(page, site, item);
|
||||
return baseMapper.getItemList(page, site, item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage fetchItemGroesList(Page page, String groes) {
|
||||
String site = TenantContextHolder.getTenantId();
|
||||
return inventoryMapper.getItemGroesList(page, site, groes);
|
||||
return baseMapper.getItemGroesList(page, site, groes);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -409,7 +409,7 @@ private final RemoteNextNumberService remoteNextNumberService;
|
||||
|
||||
@Override
|
||||
public InventoryDto selectForStocktaking(String site, String inventoryId) {
|
||||
String inventoryBo = Inventory.genHandle(site, inventoryId);
|
||||
/*String inventoryBo = Inventory.genHandle(site, inventoryId);
|
||||
InventoryDto inventory = Optional.ofNullable(getInventoryDto(site, inventoryId))
|
||||
.orElseThrow(() -> BusinessException.build("库存条码不存在"));
|
||||
long count = storageBinBindInventoryService.count(Wrappers.lambdaQuery(StorageBinBindInventory.class)
|
||||
@ -435,8 +435,8 @@ private final RemoteNextNumberService remoteNextNumberService;
|
||||
throw BusinessException.build("待检库存不允许调整库存");
|
||||
case Constant.INVENTORY_STSTUS_1005:
|
||||
throw BusinessException.build("冻结库存不允许调整库存");
|
||||
}
|
||||
return inventory;
|
||||
}*/
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -520,4 +520,14 @@ private final RemoteNextNumberService remoteNextNumberService;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ScanCodeDTO> selectInvByCode(String site, String user, String code) {
|
||||
return baseMapper.selectInvByCode(Inventory.genHandle(site, code), Carrier.genHandle(site, code));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ScanCodeDTO> selectTrayInvByCode(String site, String user, String code) {
|
||||
return baseMapper.selectTrayInvByCode(Inventory.genHandle(site, code), Carrier.genHandle(site, code));
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@ package com.foreverwin.mom.wms.mapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.foreverwin.mom.common.data.datascope.MomBaseMapper;
|
||||
import com.foreverwin.mom.wms.dto.DocumentScanCodeDTO;
|
||||
import com.foreverwin.mom.wms.dto.ScanCodeDTO;
|
||||
import com.foreverwin.mom.wms.dto.DocumentWithPoOrderDTO;
|
||||
import com.foreverwin.mom.wms.entity.Document;
|
||||
import com.foreverwin.mom.wms.entity.Inventory;
|
||||
@ -55,5 +55,4 @@ public interface DocumentMapper extends MomBaseMapper<Document> {
|
||||
|
||||
List<Map<String, Object>> getDataValueList(@Param("dataFieldBo") String dataFieldBo);
|
||||
//---------------------------------------------------------------------------------------------
|
||||
List<DocumentScanCodeDTO> selectInvByCode(@Param("inventoryBo")String inventoryBo, @Param("carrierBo")String carrierBo);
|
||||
}
|
||||
|
||||
@ -35,4 +35,6 @@ public interface WmsCarrierMemberMapper extends BaseMapper<CarrierMember> {
|
||||
List<InventoryDto> getInventoryByTrayBo(@Param("carrierBo")String carrierBoOfTray);
|
||||
|
||||
boolean checkTrayOverdue(@Param("site")String site,@Param("documentNo")String documentNo, @Param("carrierBo")String carrierBo);
|
||||
|
||||
List<CarrierMemberDto> getBindCount(@Param("carrierBo")String carrierBo, @Param("storageBinBo")String storageBinBo);
|
||||
}
|
||||
|
||||
@ -3,10 +3,7 @@ package com.foreverwin.mom.wms.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.foreverwin.iep.common.base.FrontPage;
|
||||
import com.foreverwin.mom.wms.dto.BarCodeQueryDto;
|
||||
import com.foreverwin.mom.wms.dto.FreezeDto;
|
||||
import com.foreverwin.mom.wms.dto.InventoryDto;
|
||||
import com.foreverwin.mom.wms.dto.ItemDto;
|
||||
import com.foreverwin.mom.wms.dto.*;
|
||||
import com.foreverwin.mom.wms.entity.Inventory;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@ -62,4 +59,9 @@ public interface ZWmsInventoryMapper extends BaseMapper<Inventory> {
|
||||
* 查询同步Erp库龄
|
||||
*/
|
||||
List<Inventory> selectInventoryAgeForErpJob();
|
||||
|
||||
List<ScanCodeDTO> selectInvByCode(@Param("inventoryBo")String inventoryBo, @Param("carrierBo")String carrierBo);
|
||||
|
||||
List<ScanCodeDTO> selectTrayInvByCode(@Param("inventoryBo")String inventoryBo, @Param("carrierBo")String carrierBo);
|
||||
|
||||
}
|
||||
|
||||
@ -18,4 +18,5 @@ public interface ZWmsStorageBinMapper extends MomBaseMapper<StorageBin> {
|
||||
|
||||
IPage<StorageBinDto> getStorageBinPage (IPage<StorageBinDto> page, @Param("dto") StorageBinDto storageBinDto);
|
||||
|
||||
String getStorageBinWarehouse(@Param("storageBinBo")String storageBinBo);
|
||||
}
|
||||
|
||||
@ -186,38 +186,4 @@
|
||||
ORDER BY A.CREATE_DATE DESC
|
||||
</select>
|
||||
<!-- -->
|
||||
<resultMap id="scanCodeResultMap" type="com.foreverwin.mom.wms.dto.DocumentScanCodeDTO">
|
||||
<result property="inventoryId" column="INVENTORY_ID"/>
|
||||
<result property="carrier" column="CARRIER"/>
|
||||
<result property="item" column="ITEM"/>
|
||||
<result property="qty" column="QTY_ON_HAND"/>
|
||||
<result property="originalQty" column="ORIGINAL_QTY"/>
|
||||
<result property="level" column="QUALITY_INSPECTION_STATUS"/>
|
||||
<result property="status" column="STATUS"/>
|
||||
<result property="batchNo" column="BATCH_NO"/>
|
||||
<result property="storageBin" column="STORAGE_BIN"/>
|
||||
<result property="erpStorageLocation" column="ERP_STORAGE_LOCATION"/>
|
||||
<result property="wmsStorageBinBo" column="WMS_STORAGE_BIN_BO"/>
|
||||
</resultMap>
|
||||
<select id="selectInvByCode" resultMap="scanCodeResultMap">
|
||||
SELECT WI.INVENTORY_ID
|
||||
, SUBSTRING_INDEX(WCM.CARRIER_BO, ',', -1) AS CARRIER
|
||||
, SUBSTRING_INDEX(SUBSTRING_INDEX(WCM.CARRIER_OR_INVENTORY_BO , ',', -3),',', 1) AS ITEM
|
||||
, WI.QTY_ON_HAND
|
||||
, WI.QUALITY_INSPECTION_STATUS
|
||||
, WI.STATUS
|
||||
, WI.BATCH_NO
|
||||
, WI.ORIGINAL_QTY
|
||||
, WI.ERP_STORAGE_LOCATION
|
||||
, WI.WMS_STORAGE_BIN_BO
|
||||
, SUBSTRING_INDEX(WI.WMS_STORAGE_BIN_BO, ',', -1) AS STORAGE_BIN
|
||||
FROM WMS_INVENTORY WI
|
||||
LEFT JOIN WMS_CARRIER_MEMBER WCM ON WCM.CARRIER_OR_INVENTORY_BO = WI.HANDLE
|
||||
<where>
|
||||
WI.HANDLE = #{inventoryBo} OR WCM.CARRIER_BO = #{carrierBo}
|
||||
<if test="status != null and status != ''">
|
||||
AND WI.STATUS = #{status}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -18,11 +18,14 @@
|
||||
<resultMap id="dtoResultMap" type="com.foreverwin.mom.wms.dto.CarrierMemberDto">
|
||||
<result property="carrier" column="CARRIER"/>
|
||||
<result property="qtyOnHand" column="QTY_ON_HAND"/>
|
||||
<result property="inventoryQty" column="INVENTORY_QTY"/>
|
||||
<result property="qualityInspectionStatus" column="QUALITY_INSPECTION_STATUS"/>
|
||||
<result property="status" column="STATUS"/>
|
||||
<result property="batchNo" column="BATCH_NO"/>
|
||||
<result property="erpStorageLocation" column="ERP_STORAGE_LOCATION"/>
|
||||
<result property="wmsStorageBinBo" column="WMS_STORAGE_BIN_BO"/>
|
||||
<result property="storageBin" column="STORAGE_BIN"/>
|
||||
<result property="carrierOrInventory" column="CARRIER_OR_INVENTORY"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="getBindInventoryList" resultMap="dtoResultMap">
|
||||
@ -33,6 +36,8 @@
|
||||
, WI.BATCH_NO
|
||||
, WI.ERP_STORAGE_LOCATION
|
||||
, WI.WMS_STORAGE_BIN_BO
|
||||
, WI.INVENTORY_ID AS CARRIER_OR_INVENTORY
|
||||
, SUBSTRING_INDEX(SUBSTRING_INDEX(WI.ITEM_BO , ',', -2),',', 1) AS ITEM
|
||||
FROM WMS_CARRIER_MEMBER WCM
|
||||
JOIN WMS_CARRIER WC ON WC.`HANDLE`=WCM.`CARRIER_BO`
|
||||
JOIN WMS_INVENTORY WI ON WI.`HANDLE`=WCM.`CARRIER_OR_INVENTORY_BO`
|
||||
@ -124,4 +129,20 @@
|
||||
LEFT JOIN MOMX_QMS.QMS_PRODUCT_VALIDITY QPV ON WDO.DELIVERY_PARTY = QPV.CUSTOMER_CODE AND CF2.FIELD_VALUE = QPV.GROES AND QPV.SITE = WDO.SITE
|
||||
WHERE WCM.CARRIER_BO = #{carrierBo}
|
||||
</select>
|
||||
|
||||
<select id="getBindCount" resultMap="dtoResultMap">
|
||||
SELECT SUBSTRING_INDEX(WCM.CARRIER_BO, ',', -1) AS CARRIER, COUNT(WI.INVENTORY_ID) AS INVENTORY_QTY
|
||||
, GROUP_CONCAT(SUBSTRING_INDEX(WI.WMS_STORAGE_BIN_BO, ',', -1)) AS STORAGE_BIN
|
||||
FROM WMS_CARRIER_MEMBER WCM
|
||||
INNER JOIN WMS_INVENTORY WI ON WCM.CARRIER_OR_INVENTORY_BO = WI.HANDLE
|
||||
<where>
|
||||
<if test="carrierBo!=null and carrierBo!='' ">
|
||||
AND WCM.CARRIER_BO = #{carrierBo}
|
||||
</if>
|
||||
<if test="storageBinBo!=null and storageBinBo!='' ">
|
||||
AND WI.WMS_STORAGE_BIN_BO = #{storageBinBo}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY WCM.CARRIER_BO
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -295,4 +295,56 @@
|
||||
GROUP BY ERP_STORAGE_LOCATION, ITEM, UNIT_OF_MEASURE, BATCH_NO, PRODUCTION_DATE, NOTE
|
||||
ORDER BY ERP_STORAGE_LOCATION ASC, ITEM ASC, PRODUCTION_DATE asc
|
||||
</select>
|
||||
<!-- -->
|
||||
<resultMap id="scanCodeResultMap" type="com.foreverwin.mom.wms.dto.ScanCodeDTO">
|
||||
<result property="inventoryId" column="INVENTORY_ID"/>
|
||||
<result property="carrier" column="CARRIER"/>
|
||||
<result property="item" column="ITEM"/>
|
||||
<result property="qty" column="QTY_ON_HAND"/>
|
||||
<result property="originalQty" column="ORIGINAL_QTY"/>
|
||||
<result property="level" column="QUALITY_INSPECTION_STATUS"/>
|
||||
<result property="status" column="STATUS"/>
|
||||
<result property="batchNo" column="BATCH_NO"/>
|
||||
<result property="storageBin" column="STORAGE_BIN"/>
|
||||
<result property="erpStorageLocation" column="ERP_STORAGE_LOCATION"/>
|
||||
<result property="wmsStorageBinBo" column="WMS_STORAGE_BIN_BO"/>
|
||||
</resultMap>
|
||||
<select id="selectInvByCode" resultMap="scanCodeResultMap">
|
||||
SELECT WI.INVENTORY_ID
|
||||
, SUBSTRING_INDEX(WCM.CARRIER_BO, ',', -1) AS CARRIER
|
||||
, SUBSTRING_INDEX(SUBSTRING_INDEX(WI.ITEM_BO , ',', -2),',', 1) AS ITEM
|
||||
, WI.QTY_ON_HAND
|
||||
, WI.QUALITY_INSPECTION_STATUS
|
||||
, WI.STATUS
|
||||
, WI.BATCH_NO
|
||||
, WI.ORIGINAL_QTY
|
||||
, WI.ERP_STORAGE_LOCATION
|
||||
, WI.WMS_STORAGE_BIN_BO
|
||||
, SUBSTRING_INDEX(WI.WMS_STORAGE_BIN_BO, ',', -1) AS STORAGE_BIN
|
||||
FROM WMS_INVENTORY WI
|
||||
LEFT JOIN WMS_CARRIER_MEMBER WCM ON WCM.CARRIER_OR_INVENTORY_BO = WI.HANDLE
|
||||
<where>
|
||||
WI.HANDLE = #{inventoryBo} OR WCM.CARRIER_BO = #{carrierBo}
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectTrayInvByCode" resultMap="scanCodeResultMap">
|
||||
SELECT WI.INVENTORY_ID, SUBSTRING_INDEX(WCM.CARRIER_BO , ',', -1) AS CARRIER
|
||||
, SUBSTRING_INDEX(SUBSTRING_INDEX(WI.ITEM_BO , ',', -2),',', 1) AS ITEM
|
||||
, WI.QTY_ON_HAND
|
||||
, WI.QUALITY_INSPECTION_STATUS
|
||||
, WI.STATUS
|
||||
, WI.BATCH_NO
|
||||
, WI.ERP_STORAGE_LOCATION
|
||||
, WI.WMS_STORAGE_BIN_BO
|
||||
, SUBSTRING_INDEX(WI.WMS_STORAGE_BIN_BO, ',', -1) AS STORAGE_BIN
|
||||
FROM WMS_INVENTORY WI
|
||||
LEFT JOIN WMS_CARRIER_MEMBER WCM ON WCM.CARRIER_OR_INVENTORY_BO = WI.HANDLE
|
||||
WHERE WI.HANDLE = #{inventoryBo} or WCM.`CARRIER_BO`= #{carrierBo} or WCM.`CARRIER_BO` = (
|
||||
SELECT WCM2.CARRIER_BO
|
||||
FROM WMS_CARRIER_MEMBER WCM2
|
||||
WHERE WCM2.CARRIER_OR_INVENTORY_BO = #{inventoryBo}
|
||||
LIMIT 1
|
||||
)
|
||||
ORDER BY WCM.`CREATE_TIME` desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -78,5 +78,11 @@
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getStorageBinWarehouse" resultType="java.lang.String">
|
||||
SELECT WW.WAREHOUSE
|
||||
FROM WMS_STORAGE_BIN WSB
|
||||
INNER JOIN WMS_STORAGE_LOCATION WSL ON WSL.HANDLE = WSB.STORAGE_LOCATION_BO
|
||||
INNER JOIN WMS_WAREHOUSE WW ON WW.HANDLE = WSL.WAREHOUSE_BO
|
||||
WHERE WSB.HANDLE = #{storageBinBo}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user