MES:
RFID手持绑定原材料条码增加仓库配置信息的校验
WMS:
原材料入库记录和原材料出库记录完善
PDA接口:
master
xs 2 weeks ago
parent 76da01f1ee
commit fb8b55a4c6

@ -8,6 +8,7 @@ import com.hw.wms.api.domain.WmsWarehouseMaterial;
import com.hw.wms.api.domain.vo.WmsAutoOutstockVo; import com.hw.wms.api.domain.vo.WmsAutoOutstockVo;
import com.hw.wms.api.domain.vo.WmsProductStockVo; import com.hw.wms.api.domain.vo.WmsProductStockVo;
import com.hw.wms.api.domain.vo.WmsRawStockVo; import com.hw.wms.api.domain.vo.WmsRawStockVo;
import com.hw.wms.api.domain.vo.WmsWarehouseMaterialExistVo;
import com.hw.wms.api.factory.RemoteWmsFallbackFactory; import com.hw.wms.api.factory.RemoteWmsFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -15,7 +16,6 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
@FeignClient(contextId = "remoteWmsService", value = ServiceNameConstants.WMS_SERVICE, fallbackFactory = RemoteWmsFallbackFactory.class) @FeignClient(contextId = "remoteWmsService", value = ServiceNameConstants.WMS_SERVICE, fallbackFactory = RemoteWmsFallbackFactory.class)
@ -75,4 +75,8 @@ public interface RemoteWmsService {
@PostMapping("/rawstock/autoOutstock") @PostMapping("/rawstock/autoOutstock")
public R<?> autoOutstock(@Validated @RequestBody WmsAutoOutstockVo wmsAutoOutstockVo, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); public R<?> autoOutstock(@Validated @RequestBody WmsAutoOutstockVo wmsAutoOutstockVo, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
@PostMapping("/wmswarehouse/isExistWarehouseMaterial")
public R<Boolean> isExistWarehouseMaterial(@Validated @RequestBody WmsWarehouseMaterial wmsWarehouseMaterial, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
} }

@ -0,0 +1,11 @@
package com.hw.wms.api.domain.vo;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
@Data
public class WmsWarehouseMaterialExistVo {
@NotEmpty(message="物料ID不能为空")
private Long materialId;
}

@ -7,6 +7,7 @@ import com.hw.wms.api.domain.WmsWarehouseMaterial;
import com.hw.wms.api.domain.vo.WmsAutoOutstockVo; import com.hw.wms.api.domain.vo.WmsAutoOutstockVo;
import com.hw.wms.api.domain.vo.WmsProductStockVo; import com.hw.wms.api.domain.vo.WmsProductStockVo;
import com.hw.wms.api.domain.vo.WmsRawStockVo; import com.hw.wms.api.domain.vo.WmsRawStockVo;
import com.hw.wms.api.domain.vo.WmsWarehouseMaterialExistVo;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory; import org.springframework.cloud.openfeign.FallbackFactory;
@ -71,6 +72,11 @@ public class RemoteWmsFallbackFactory implements FallbackFactory<RemoteWmsServic
return R.fail("自动出库失败:" + throwable.getMessage()); return R.fail("自动出库失败:" + throwable.getMessage());
} }
@Override
public R<Boolean> isExistWarehouseMaterial(WmsWarehouseMaterial wmsWarehouseMaterial, String source) {
return R.fail("获取是否绑定仓库信息失败:" + throwable.getMessage());
}
}; };
} }
} }

@ -193,6 +193,7 @@ public class WmsConstants {
public static final String WMS_RAW_OUTSTOCK_TASK_TYPE_PRODUCTION_INSTALL = "3";//组装出库 public static final String WMS_RAW_OUTSTOCK_TASK_TYPE_PRODUCTION_INSTALL = "3";//组装出库
public static final String WMS_RAW_OUTSTOCK_TASK_TYPE_AUTO_OUTSTOCK = "4";//自动出库 public static final String WMS_RAW_OUTSTOCK_TASK_TYPE_AUTO_OUTSTOCK = "4";//自动出库
public static final String WMS_RAW_OUTSTOCK_TASK_TYPE_RETURN_OUTSTOCK = "5";//退货出库
public static final String WMS_RAW_OUTSTOCK_TASK_TYPE_OTHER = "9";//其他 public static final String WMS_RAW_OUTSTOCK_TASK_TYPE_OTHER = "9";//其他

@ -2,14 +2,19 @@ package com.hw.mes.controller;
import com.hw.common.core.web.controller.BaseController; import com.hw.common.core.web.controller.BaseController;
import com.hw.common.core.web.domain.AjaxResult; import com.hw.common.core.web.domain.AjaxResult;
import com.hw.common.core.web.page.TableDataInfo;
import com.hw.common.log.annotation.Log; import com.hw.common.log.annotation.Log;
import com.hw.common.log.enums.BusinessType; import com.hw.common.log.enums.BusinessType;
import com.hw.common.security.annotation.RequiresPermissions;
import com.hw.mes.domain.MesBasePalletInfo;
import com.hw.mes.domain.vo.*; import com.hw.mes.domain.vo.*;
import com.hw.mes.service.*; import com.hw.mes.service.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
/** /**
* MESController * MESController
* *
@ -33,4 +38,13 @@ public class MesMobileController extends BaseController {
} }
/**
*
*/
@GetMapping("/getMesPalletInfos")
public TableDataInfo getMesPalletInfos(MesBasePalletInfo mesBasePalletInfo) {
startPage();
List<MesBasePalletInfo> list = mesBasePalletInfoService.selectMesBasePalletInfoList(mesBasePalletInfo);
return getDataTable(list);
}
} }

@ -10,16 +10,16 @@ import com.hw.common.core.domain.R;
import com.hw.common.core.exception.ServiceException; import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.DateUtils; import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.StringUtils; import com.hw.common.core.utils.StringUtils;
import com.hw.common.core.utils.poi.ExcelUtil;
import com.hw.common.security.utils.SecurityUtils; import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.api.domain.MesBaseBarcodeInfo; import com.hw.mes.api.domain.MesBaseBarcodeInfo;
import com.hw.mes.domain.vo.MesPalletInfoBindVo; import com.hw.mes.domain.vo.MesPalletInfoBindVo;
import com.hw.mes.mapper.MesBaseBarcodeInfoMapper; import com.hw.mes.mapper.MesBaseBarcodeInfoMapper;
import com.hw.printer.api.RemotePrinterService; import com.hw.printer.api.RemotePrinterService;
import com.hw.printer.api.domain.vo.PrintContentVo;
import com.hw.wms.api.RemoteWmsService; import com.hw.wms.api.RemoteWmsService;
import com.hw.wms.api.domain.WmsWarehouseMaterial;
import com.hw.wms.api.domain.vo.WmsProductStockVo; import com.hw.wms.api.domain.vo.WmsProductStockVo;
import com.hw.wms.api.domain.vo.WmsRawStockVo; import com.hw.wms.api.domain.vo.WmsRawStockVo;
import com.hw.wms.api.domain.vo.WmsWarehouseMaterialExistVo;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -172,6 +172,15 @@ public class MesBasePalletInfoServiceImpl implements IMesBasePalletInfoService {
throw new ServiceException("此物料条码存在原材料库存,不能绑定"); throw new ServiceException("此物料条码存在原材料库存,不能绑定");
} }
if(mesBaseBarcodeInfo.getBarcodeType().equals(MesConstants.MES_BARCODE_TYPE_RAW)){
WmsWarehouseMaterial wmsWarehouseMaterial = new WmsWarehouseMaterial();
wmsWarehouseMaterial.setStorageId(mesBaseBarcodeInfo.getMaterialId());
R<Boolean> isExistWarehouseMaterial = remoteWmsService.isExistWarehouseMaterial(wmsWarehouseMaterial, SecurityConstants.INNER);
if (!isExistWarehouseMaterial.getData()) {
throw new ServiceException("此物料还没有配置仓库信息");
}
}
String userName = SecurityUtils.getUsername(); String userName = SecurityUtils.getUsername();
Date currentDate = new Date(); Date currentDate = new Date();

@ -165,7 +165,6 @@ public class WmsBaseWarehouseController extends BaseController {
} }
@Log(title = "仓库管理", businessType = BusinessType.ALLOCATE) @Log(title = "仓库管理", businessType = BusinessType.ALLOCATE)
@PostMapping("/allocateVirtualMaterial") @PostMapping("/allocateVirtualMaterial")
@InnerAuth @InnerAuth
@ -175,6 +174,14 @@ public class WmsBaseWarehouseController extends BaseController {
} }
@PostMapping("/isExistWarehouseMaterial")
@InnerAuth
public R<Boolean> isExistWarehouseMaterial(@RequestBody WmsWarehouseMaterial wmsWarehouseMaterial) {
List<WmsWarehouseMaterial> wmsWarehouseMaterials = wmsWarehouseMaterialService.selectWmsWarehouseMaterialList(wmsWarehouseMaterial);
boolean isSuccess = wmsWarehouseMaterials != null && !wmsWarehouseMaterials.isEmpty();
return R.ok(isSuccess);
}
// /** // /**
// * 根据仓库分配可入库物料信息 // * 根据仓库分配可入库物料信息

@ -432,12 +432,6 @@ public class WmsMobileController extends BaseController {
//todo入库时校验warehousematerial,入库出库需要校验库位状态,是否是移库合库锁定等 //todo入库时校验warehousematerial,入库出库需要校验库位状态,是否是移库合库锁定等
/** /**
* *
*/ */
@ -491,7 +485,6 @@ public class WmsMobileController extends BaseController {
} }
/** /**
* *
*/ */
@ -550,6 +543,7 @@ public class WmsMobileController extends BaseController {
//TODO 盘点中的不能进行移库合库? //TODO 盘点中的不能进行移库合库?
/** /**
* *
*/ */
@ -560,7 +554,6 @@ public class WmsMobileController extends BaseController {
} }
/** /**
* *
*/ */
@ -569,4 +562,54 @@ public class WmsMobileController extends BaseController {
public AjaxResult completeInventoryCheck(@RequestBody WmsInventoryCheck wmsInventoryCheck) { public AjaxResult completeInventoryCheck(@RequestBody WmsInventoryCheck wmsInventoryCheck) {
return success(wmsInventoryCheckService.completeInventoryCheck(wmsInventoryCheck)); return success(wmsInventoryCheckService.completeInventoryCheck(wmsInventoryCheck));
} }
/**
* 退
*/
@Log(title = "退货出库", businessType = BusinessType.INSERT)
@PostMapping(("/returnOutstock"))
public AjaxResult returnOutstock(@RequestBody WmsReturnOutstockVo wmsReturnOutstockVo) {
return success(wmsRawOutstockService.returnOutstock(wmsReturnOutstockVo));
}
/**
* 退
*/
@GetMapping(value = "/getReturnRawOutstocks")
public TableDataInfo getReturnRawOutstocks(WmsRawOutstock wmsRawOutstock) {
startPage();
wmsRawOutstock.setTaskType(WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_RETURN_OUTSTOCK);
return getDataTable(wmsRawOutstockService.selectWmsRawOutstockList(wmsRawOutstock));
}
/**
*
*/
@Log(title = "库位", businessType = BusinessType.LOCK)
@PostMapping(("/lockLocation"))
public AjaxResult lockLocation(@RequestBody WmsLocationLockUnLockVo wmsLocationLockUnLockVo) {
return success(wmsBaseLocationService.lockWmsBaseLocationByLocationCode(wmsLocationLockUnLockVo.getLocationCode()));
}
/**
*
*/
@Log(title = "库位", businessType = BusinessType.UNLOCK)
@PostMapping(("/unlockLocation"))
public AjaxResult unlockLocation(@RequestBody WmsLocationLockUnLockVo wmsLocationLockUnLockVo) {
return success(wmsBaseLocationService.unlockWmsBaseLocationByLocationCode(wmsLocationLockUnLockVo.getLocationCode()));
}
@GetMapping(value = "/getLockLocations")
public AjaxResult getLockLocations(WmsBaseLocation wmsBaseLocation) {
Map<String, List<String>> locationMap = wmsBaseLocationService.getLocationCodesGroupByWarehouse(wmsBaseLocation);
System.out.println(locationMap);
return success(locationMap);
}
} }

@ -93,7 +93,7 @@ public class WmsRawInstock extends BaseEntity
private String applyBy; private String applyBy;
/** 入库时间 */ /** 入库时间 */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "入库时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "入库时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date applyDate; private Date applyDate;

@ -153,7 +153,7 @@ public class WmsRawOutstock extends BaseEntity {
/** /**
* *
*/ */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "申请时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "申请时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date applyDate; private Date applyDate;

@ -0,0 +1,21 @@
package com.hw.wms.domain.vo;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* @Description: VO
* @ClassName: WmsLocationLockUnLockVo
* @Author : xins
* @Date :2024-10-29
* @Version :1.0
*/
@Data
public class WmsLocationLockUnLockVo {
//库位码
@NotBlank(message="库位码必须输入")
private String locationCode;
}

@ -0,0 +1,28 @@
package com.hw.wms.domain.vo;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
/**
* @Description: 退VO
* @ClassName: WmsReturnOutstockVo
* @Author : xins
* @Date :2024-10-29
* @Version :1.0
*/
@Data
public class WmsReturnOutstockVo {
//库位码
@NotBlank(message="库位码必须输入")
private String locationCode;
//库位码
private String materialBarcode;
private BigDecimal returnAmount;
}

@ -1,6 +1,7 @@
package com.hw.wms.service; package com.hw.wms.service;
import java.util.List; import java.util.List;
import java.util.Map;
import com.hw.common.core.utils.DateUtils; import com.hw.common.core.utils.DateUtils;
import com.hw.wms.domain.WmsBaseLocation; import com.hw.wms.domain.WmsBaseLocation;
@ -77,6 +78,14 @@ public interface IWmsBaseLocationService
*/ */
public int lockWmsBaseLocation(Long locationId); public int lockWmsBaseLocation(Long locationId);
/**
*
*
* @param locationCode
* @return
*/
public int lockWmsBaseLocationByLocationCode(String locationCode);
/** /**
* *
* *
@ -85,6 +94,14 @@ public interface IWmsBaseLocationService
*/ */
public int unlockWmsBaseLocation(Long locationId); public int unlockWmsBaseLocation(Long locationId);
/**
*
*
* @param locationCode
* @return
*/
public int unlockWmsBaseLocationByLocationCode(String locationCode);
/** /**
* *
* *
@ -110,4 +127,10 @@ public interface IWmsBaseLocationService
*/ */
public int deleteWmsLocationBarcodeByLocationBarcodeIds(Long[] locationBarcodeIds); public int deleteWmsLocationBarcodeByLocationBarcodeIds(Long[] locationBarcodeIds);
/**
* group
* @param wmsBaseLocation
* @return
*/
public Map<String,List<String>> getLocationCodesGroupByWarehouse(WmsBaseLocation wmsBaseLocation);
} }

@ -155,5 +155,12 @@ public interface IWmsRawOutstockService
* @return * @return
*/ */
public WmsRawOutstock getNewestOutstockCabinet(WmsRawOutstock wmsRawOutstock); public WmsRawOutstock getNewestOutstockCabinet(WmsRawOutstock wmsRawOutstock);
/**
* 退
* @param wmsReturnOutstockVo
* @return
*/
public int returnOutstock(WmsReturnOutstockVo wmsReturnOutstockVo);
} }

@ -1,6 +1,7 @@
package com.hw.wms.service.impl; package com.hw.wms.service.impl;
import com.hw.common.core.constant.SecurityConstants; import com.hw.common.core.constant.SecurityConstants;
import com.hw.common.core.constant.WmsConstants;
import com.hw.common.core.enums.WmsLocationStatus; import com.hw.common.core.enums.WmsLocationStatus;
import com.hw.common.core.exception.ServiceException; import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.DateUtils; import com.hw.common.core.utils.DateUtils;
@ -19,10 +20,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.*;
import java.util.Date; import java.util.stream.Collectors;
import java.util.HashMap;
import java.util.List;
/** /**
* Service * Service
@ -128,6 +127,8 @@ public class WmsBaseLocationServiceImpl implements IWmsBaseLocationService {
} }
/** /**
* *
* *
@ -139,6 +140,24 @@ public class WmsBaseLocationServiceImpl implements IWmsBaseLocationService {
// wmsBaseLocation.setCreateTime(DateUtils.getNowDate()); // wmsBaseLocation.setCreateTime(DateUtils.getNowDate());
// return wmsBaseLocationMapper.insertWmsBaseLocation(wmsBaseLocation); // return wmsBaseLocationMapper.insertWmsBaseLocation(wmsBaseLocation);
WmsBaseLocation baseLocation = wmsBaseLocationMapper.selectWmsBaseLocationByLocationId(locationId); WmsBaseLocation baseLocation = wmsBaseLocationMapper.selectWmsBaseLocationByLocationId(locationId);
return this.lockLocation(baseLocation);
}
/**
*
*
* @param locationCode
* @return
*/
@Override
public int lockWmsBaseLocationByLocationCode(String locationCode) {
// wmsBaseLocation.setCreateTime(DateUtils.getNowDate());
// return wmsBaseLocationMapper.insertWmsBaseLocation(wmsBaseLocation);
WmsBaseLocation baseLocation = wmsBaseLocationMapper.selectWmsBaseLocationByLocationCode(locationCode);
return this.lockLocation(baseLocation);
}
public int lockLocation(WmsBaseLocation baseLocation){
String locationStatus = baseLocation.getLocationStatus(); String locationStatus = baseLocation.getLocationStatus();
if (locationStatus.equals(WmsLocationStatus.MANUALLOCK.getCode())) { if (locationStatus.equals(WmsLocationStatus.MANUALLOCK.getCode())) {
return 1; return 1;
@ -151,6 +170,7 @@ public class WmsBaseLocationServiceImpl implements IWmsBaseLocationService {
return wmsBaseLocationMapper.updateWmsBaseLocation(baseLocation); return wmsBaseLocationMapper.updateWmsBaseLocation(baseLocation);
} }
/** /**
* *
* *
@ -160,6 +180,22 @@ public class WmsBaseLocationServiceImpl implements IWmsBaseLocationService {
@Override @Override
public int unlockWmsBaseLocation(Long locationId) { public int unlockWmsBaseLocation(Long locationId) {
WmsBaseLocation baseLocation = wmsBaseLocationMapper.selectWmsBaseLocationByLocationId(locationId); WmsBaseLocation baseLocation = wmsBaseLocationMapper.selectWmsBaseLocationByLocationId(locationId);
return this.unlockLocation(baseLocation);
}
/**
*
*
* @param locationCode
* @return
*/
@Override
public int unlockWmsBaseLocationByLocationCode(String locationCode) {
WmsBaseLocation baseLocation = wmsBaseLocationMapper.selectWmsBaseLocationByLocationCode(locationCode);
return this.unlockLocation(baseLocation);
}
public int unlockLocation(WmsBaseLocation baseLocation) {
String locationStatus = baseLocation.getLocationStatus(); String locationStatus = baseLocation.getLocationStatus();
if (locationStatus.equals(WmsLocationStatus.NORMAL.getCode())) { if (locationStatus.equals(WmsLocationStatus.NORMAL.getCode())) {
return 1; return 1;
@ -247,4 +283,23 @@ public class WmsBaseLocationServiceImpl implements IWmsBaseLocationService {
public int deleteWmsLocationBarcodeByLocationBarcodeIds(Long[] locationBarcodeIds) { public int deleteWmsLocationBarcodeByLocationBarcodeIds(Long[] locationBarcodeIds) {
return wmsLocationBarcodeMapper.deleteWmsLocationBarcodeByLocationBarcodeIds(locationBarcodeIds); return wmsLocationBarcodeMapper.deleteWmsLocationBarcodeByLocationBarcodeIds(locationBarcodeIds);
} }
/**
* group
* @param wmsBaseLocation
* @return
*/
@Override
public Map<String,List<String>> getLocationCodesGroupByWarehouse(WmsBaseLocation wmsBaseLocation){
wmsBaseLocation.setLocationStatus(WmsConstants.WMS_BASE_LOCATION_STATUS_MANUAL_LOCK);
List<WmsBaseLocation> wmsBaseLocations = wmsBaseLocationMapper.selectWmsBaseLocationJoinList(wmsBaseLocation);
Map<String,List<String>> locationCodesByWarehouse = wmsBaseLocations.stream()
.collect(Collectors.groupingBy(
WmsBaseLocation::getWarehouseName,
Collectors.mapping(WmsBaseLocation::getLocationCode, Collectors.toList())
));
return locationCodesByWarehouse;
}
} }

@ -1313,4 +1313,98 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
wmsRawOutstock.setTaskType(WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_PRODUCTION_SPLIT); wmsRawOutstock.setTaskType(WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_PRODUCTION_SPLIT);
return wmsRawOutstockMapper.selectNewestWmsRawOutstock(wmsRawOutstock); return wmsRawOutstockMapper.selectNewestWmsRawOutstock(wmsRawOutstock);
} }
/**
* 退
* @param wmsReturnOutstockVo
* @return
*/
@Transactional(rollbackFor = Exception.class)
@Override
public int returnOutstock(WmsReturnOutstockVo wmsReturnOutstockVo) {
String locationCode = wmsReturnOutstockVo.getLocationCode();
WmsBaseLocation baseLocation = wmsBaseLocationMapper.selectWmsBaseLocationByLocationCode(locationCode);
if (baseLocation == null) {
throw new ServiceException("库位编码错误");
}
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
WmsBaseWarehouse baseWarehouse = wmsBaseWarehouseMapper.selectWmsBaseWarehouseByWarehouseId(baseLocation.getWarehouseId());
String warehouseType = baseWarehouse.getWarehouseType();
String executeStatus = "";
BigDecimal outstockAmount = BigDecimal.ZERO;
BigDecimal realOutstockAmount = BigDecimal.ZERO;
WmsRawStock wmsRawStock;
if (warehouseType.equals(WmsConstants.WMS_WAREHOUSE_TYPE_AGV)) {//AGV仓库
executeStatus = WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE;
outstockAmount = BigDecimal.ONE;
WmsRawStock queryRawStock = new WmsRawStock();
queryRawStock.setLocationCode(locationCode);
List<WmsRawStock> wmsRawStocks = wmsRawStockMapper.selectWmsRawStockInList(queryRawStock);
if (wmsRawStocks == null || wmsRawStocks.isEmpty()) {
throw new ServiceException("此库位无库存信息");
}
wmsRawStock = wmsRawStocks.get(0);
} else if (warehouseType.equals(WmsConstants.WMS_WAREHOUSE_TYPE_NORMAL)) {
executeStatus = WmsConstants.WMS_EXECUTE_STATUS_FINISH;
String materialBarcode = wmsReturnOutstockVo.getMaterialBarcode();
BigDecimal returnAmount = wmsReturnOutstockVo.getReturnAmount();
outstockAmount = returnAmount;
realOutstockAmount = returnAmount;
if (StringUtils.isEmpty(materialBarcode)) {
throw new ServiceException("请输入或扫描物料条码");
}
if (returnAmount == null) {
throw new ServiceException("请输入退货数量");
}
wmsRawStock = wmsRawStockMapper.selectRawStockByBarcode(materialBarcode);
if (wmsRawStock == null) {
throw new ServiceException("无库存信息");
}
BigDecimal totalAmount = wmsRawStock.getTotalAmount();
BigDecimal occupyAmount = wmsRawStock.getOccupyAmount() == null ? BigDecimal.ZERO : wmsRawStock.getOccupyAmount();
BigDecimal availableAmount = totalAmount.subtract(occupyAmount);
if (returnAmount.compareTo(availableAmount) > 0) {
throw new ServiceException("可用库存只有:" + availableAmount);
}
if (returnAmount.compareTo(totalAmount) == 0) {
wmsRawStockMapper.deleteWmsRawStockByRawStockId(wmsRawStock.getRawStockId());
} else {
wmsRawStock.setTotalAmount(totalAmount.subtract(returnAmount));
wmsRawStock.setUpdateBy(userName);
wmsRawStock.setUpdateDate(currentDate);
wmsRawStockMapper.updateWmsRawStock(wmsRawStock);
}
} else {
throw new ServiceException("仓库类型有误");
}
String operationType = WmsConstants.OPERATION_TYPE_MAP.get(warehouseType);
WmsRawOutstock wmsRawOutstock = new WmsRawOutstock();
wmsRawOutstock.setTaskCode(Seq.getId(Seq.rawOutstockSeqType, Seq.rawOutstockSeqCode));
wmsRawOutstock.setWarehouseId(baseWarehouse.getWarehouseId());
wmsRawOutstock.setLocationCode(locationCode);
wmsRawOutstock.setSaleOrderId(wmsRawStock.getSaleOrderId());
wmsRawOutstock.setMaterialId(wmsRawStock.getMaterialId());
wmsRawOutstock.setMaterialBatch(wmsRawStock.getInstockBatch());
wmsRawOutstock.setOutstockAmount(outstockAmount);
wmsRawOutstock.setRealOutstockAmount(realOutstockAmount);
wmsRawOutstock.setOperationType(operationType);
wmsRawOutstock.setAuditStatus(WmsConstants.WMS_AUDIT_STATUS_PASS);
wmsRawOutstock.setExecuteStatus(executeStatus);
wmsRawOutstock.setTaskType(WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_RETURN_OUTSTOCK);
wmsRawOutstock.setApplyBy(userName);
wmsRawOutstock.setApplyDate(currentDate);
return wmsRawOutstockMapper.insertWmsRawOutstock(wmsRawOutstock);
}
} }

@ -203,6 +203,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where> </where>
order by wri.apply_date desc
</select> </select>
<select id="selectWmsRawInstockERPNotSynchronized" parameterType="WmsRawInstock" resultMap="WmsRawInstockResult"> <select id="selectWmsRawInstockERPNotSynchronized" parameterType="WmsRawInstock" resultMap="WmsRawInstockResult">
select wri.raw_instock_id, select wri.raw_instock_id,

@ -273,6 +273,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="taskType != null and taskType != ''"> and wro.task_type = #{taskType}</if> <if test="taskType != null and taskType != ''"> and wro.task_type = #{taskType}</if>
<if test="applyBy != null and applyBy != ''"> and wro.apply_by like concat('%', #{applyBy}, '%')</if> <if test="applyBy != null and applyBy != ''"> and wro.apply_by like concat('%', #{applyBy}, '%')</if>
</where> </where>
order by wro.apply_date desc
</select> </select>
<select id="selectWmsRawOutstockJoinList4Audit" parameterType="WmsRawOutstock" resultMap="WmsRawOutstockResult"> <select id="selectWmsRawOutstockJoinList4Audit" parameterType="WmsRawOutstock" resultMap="WmsRawOutstockResult">

Loading…
Cancel
Save