PDA接口:
移库增加agv库位的移库
盘库逻辑完善
出入库逻辑完善
成品出库申请针对合并的需要显示拆分后的信息
移库逻辑完善
master
xs 5 months ago
parent fb8b55a4c6
commit 2f59d481d7

@ -192,4 +192,13 @@ public interface RemoteMesService {
/**
*
*
* @param dateStr (yyyy-MM-dd)
* @param source
* @return
*/
@GetMapping("/saleOrder/getRelateProductsBySaleOrderId/{saleOrderId}")
public R<List<MesSaleOrderRelate>> getRelateProductsBySaleOrderId(@PathVariable("saleOrderId") Long saleOrderId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}

@ -105,6 +105,12 @@ public class RemoteMesFallbackFactory implements FallbackFactory<RemoteMesServic
public R<MesBaseBarcodeInfo> autoOutstockLastPurchaseOrders(String dateStr, String source) {
return R.fail("自动出库之前采购订单的物料信息失败:" + throwable.getMessage());
}
@Override
public R<List<MesSaleOrderRelate>> getRelateProductsBySaleOrderId(Long saleOrderId, String source) {
return R.fail("根据销售订单ID获取关联成品信息失败:" + throwable.getMessage());
}
};
}
}

@ -153,6 +153,8 @@ public class WmsConstants {
public static final String WMS_BASE_LOCATION_STATUS_MOVE_LOCK = "4";//移库锁定
public static final String WMS_BASE_LOCATION_STATUS_MERGE_LOCK = "5";//合库锁定
public static final String WMS_BASE_LOCATION_STATUS_OUT_STOCK = "6";//出库锁定
public static final String WMS_BASE_LOCATION_STATUS_RETURN_LOCK = "7";//退货锁定
public static final String WMS_BASE_LOCATION_STATUS_DEEP_ABNORMAL = "8";//深库位异常
public static final String WMS_BASE_LOCATION_STATUS_ABNORMAL = "9";//异常
@ -267,4 +269,17 @@ public class WmsConstants {
public static final String WMS_SAFE_FLAG_YES = "1";//安全库存,是
public static final String WMS_SAFE_FLAG_NO = "0";//安全库存,否
/**
*
*/
public static final Long WMS_BASE_LOCATION_LOC_DEEP_BACK = 1L;//深库位
public static final Long WMS_BASE_LOCATION_LOC_DEEP_FRONT = 2L;//浅库位
/**
*
*/
public static final String WMS_INVENTORY_CHECK_TYPE_MANUAL = "1";//人工
public static final String WMS_INVENTORY_CHECK_TYPE_WCS = "2";//WCS调度
public static final String WMS_INVENTORY_CHECK_TYPE_CTU = "3";//CTU
}

@ -6,6 +6,7 @@ import javax.servlet.http.HttpServletResponse;
import com.hw.common.core.domain.R;
import com.hw.common.security.annotation.InnerAuth;
import com.hw.mes.api.domain.MesBaseBarcodeInfo;
import com.hw.mes.api.domain.MesSaleOrderRelate;
import com.hw.mes.api.domain.vo.MesSaleOrderTransferVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -116,4 +117,14 @@ public class MesSaleOrderController extends BaseController {
}
}
/**
*
*/
@InnerAuth
@GetMapping(value = "/getRelateProductsBySaleOrderId/{saleOrderId}")
public R<List<MesSaleOrderRelate>> getRelateProductsBySaleOrderId(@PathVariable("saleOrderId") Long saleOrderId) {
List<MesSaleOrderRelate> list = mesSaleOrderService.getRelateProductsBySaleOrderId(saleOrderId);
return R.ok(list);
}
}

@ -85,4 +85,14 @@ public interface MesSaleOrderRelateMapper
* @return
*/
public MesSaleOrderRelate selectMesSaleOrderRelateByBindBarcode(String bindBarcode);
/**
* ,Join product
*
* @param mesSaleOrderRelate
* @return
*/
public List<MesSaleOrderRelate> selectMesSaleOrderRelateJoinProductList(MesSaleOrderRelate mesSaleOrderRelate);
}

@ -3,6 +3,7 @@ package com.hw.mes.service;
import java.util.List;
import com.hw.mes.api.domain.MesBaseBarcodeInfo;
import com.hw.mes.api.domain.MesSaleOrderRelate;
import com.hw.mes.api.domain.vo.MesSaleOrderTransferVo;
import com.hw.mes.domain.MesSaleOrder;
@ -76,4 +77,11 @@ public interface IMesSaleOrderService
* @return
*/
public boolean transferSaleOrders(MesSaleOrderTransferVo mesSaleOrderTransferVo);
/**
* relatesaleorderId
* @param saleOrderId
* @return
*/
public List<MesSaleOrderRelate> getRelateProductsBySaleOrderId(Long saleOrderId);
}

@ -8,9 +8,11 @@ import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.StringUtils;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.api.domain.MesBaseBarcodeInfo;
import com.hw.mes.api.domain.MesSaleOrderRelate;
import com.hw.mes.api.domain.vo.MesBaseBarcodeInfoTransferVo;
import com.hw.mes.api.domain.vo.MesSaleOrderTransferVo;
import com.hw.mes.mapper.MesBaseBarcodeInfoMapper;
import com.hw.mes.mapper.MesSaleOrderRelateMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.mes.mapper.MesSaleOrderMapper;
@ -32,6 +34,9 @@ public class MesSaleOrderServiceImpl implements IMesSaleOrderService {
@Autowired
private MesBaseBarcodeInfoMapper mesBaseBarcodeInfoMapper;
@Autowired
private MesSaleOrderRelateMapper mesSaleOrderRelateMapper;
/**
*
*
@ -165,4 +170,16 @@ public class MesSaleOrderServiceImpl implements IMesSaleOrderService {
return updateSize > 0;
}
/**
* relatesaleorderId
* @param saleOrderId
* @return
*/
@Override
public List<MesSaleOrderRelate> getRelateProductsBySaleOrderId(Long saleOrderId){
MesSaleOrderRelate querySaleOrderRelate = new MesSaleOrderRelate();
querySaleOrderRelate.setSaleOrderId(saleOrderId);
return mesSaleOrderRelateMapper.selectMesSaleOrderRelateJoinProductList(querySaleOrderRelate);
}
}

@ -21,6 +21,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
<result property="materialSpec" column="material_spec" />
<result property="productCode" column="product_code" />
<result property="productName" column="product_name" />
<result property="productSpec" column="product_spec" />
</resultMap>
<sql id="selectMesSaleOrderRelateVo">
@ -127,4 +131,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where bind_barcode= #{bindBarcode} limit 1
</select>
<select id="selectMesSaleOrderRelateJoinProductList" parameterType="MesSaleOrderRelate" resultMap="MesSaleOrderRelateResult">
select msor.sale_order_relate_id, msor.sale_order_id,msor.barcode_info, msor.order_bind_id,msor.relate_sale_order_id,msor.relate_sale_order_code,
msor.material_id, msor.relate_sale_order_amount,msor.purchase_order_id,msor.product_id,
mbmi.material_code as product_code,mbmi.material_name as product_name,mbmi.material_spec as product_spec
from mes_sale_order_relate msor
left join mes_base_material_info mbmi on msor.product_id=mbmi.material_id
<where>
<if test="barcodeInfo != null and barcodeInfo != '' "> and barcode_info = #{barcodeInfo}</if>
<if test="saleOrderId != null "> and sale_order_id = #{saleOrderId}</if>
<if test="relateSaleOrderId != null "> and relate_sale_order_id = #{relateSaleOrderId}</if>
<if test="purchaseOrderId != null "> and purchase_order_id = #{purchaseOrderId}</if>
<if test="relateSaleOrderAmount != null "> and relate_sale_order_amount = #{relateSaleOrderAmount}</if>
</where>
</select>
</mapper>

@ -205,6 +205,7 @@ public class WmsMobileController extends BaseController {
WmsRawReturn wmsRawReturn = new WmsRawReturn();
wmsRawReturn.setAuditStatus(WmsConstants.WMS_AUDIT_STATUS_PASS);
wmsRawReturn.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_NOT_FINISH);
wmsRawReturn.setOperationType(WmsConstants.WMS_OPERATION_TYPE_MANUAL);
List<WmsRawReturn> list = wmsRawReturnService.selectWmsRawReturnJoinList(wmsRawReturn);
return getDataTable(list);
}
@ -429,8 +430,6 @@ public class WmsMobileController extends BaseController {
}
//todo入库时校验warehousematerial,入库出库需要校验库位状态,是否是移库合库锁定等
/**
*
@ -492,6 +491,7 @@ public class WmsMobileController extends BaseController {
@GetMapping(value = "/getInventoryChecks")
public TableDataInfo getInventoryChecks(WmsInventoryCheck queryInventoryCheck) {
startPage();
queryInventoryCheck.setCheckType(WmsConstants.WMS_INVENTORY_CHECK_TYPE_MANUAL);
List<WmsInventoryCheck> inventoryChecks = wmsInventoryCheckService.selectWmsInventoryCheckJoinList(queryInventoryCheck);
return getDataTable(inventoryChecks);
}

@ -33,6 +33,9 @@ public class WmsInventoryCheck extends BaseEntity
@Excel(name = "盘点状态(0待盘点", readConverterExp = "暂=无此状态")
private String checkStatus;
/**盘点类型(1人工2调度,3,CTU)*/
private String checkType;
/** 盘点开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "盘点开始时间", width = 30, dateFormat = "yyyy-MM-dd")
@ -106,6 +109,15 @@ public class WmsInventoryCheck extends BaseEntity
{
return checkStatus;
}
public String getCheckType() {
return checkType;
}
public void setCheckType(String checkType) {
this.checkType = checkType;
}
public void setBeginTime(Date beginTime)
{
this.beginTime = beginTime;

@ -78,7 +78,7 @@ public class WmsInventoryCheckServiceImpl implements IWmsInventoryCheckService {
* @param wmsInventoryCheckVo VO
* @return
*/
@Transactional
@Transactional(rollbackFor = Exception.class)
@Override
public Long insertWmsInventoryCheck(WmsInventoryCheckVo wmsInventoryCheckVo) {
Long inventoryCheckId = wmsInventoryCheckVo.getInventoryCheckId();
@ -89,6 +89,18 @@ public class WmsInventoryCheckServiceImpl implements IWmsInventoryCheckService {
String userName = SecurityUtils.getUsername();
Date currentDate = new Date();
WmsBaseWarehouse baseWarehouse = wmsBaseWarehouseMapper.selectWmsBaseWarehouseByWarehouseId(warehouseId);
String warehouseInstockType = baseWarehouse.getWarehouseInstockType();
String warehouseType = baseWarehouse.getWarehouseType();
String inventoryCheckType = "";
if(warehouseType.equals(WmsConstants.WMS_WAREHOUSE_TYPE_NORMAL)){
inventoryCheckType = WmsConstants.WMS_INVENTORY_CHECK_TYPE_MANUAL;
}else if(warehouseType.equals(WmsConstants.WMS_WAREHOUSE_TYPE_AGV)){
inventoryCheckType = WmsConstants.WMS_INVENTORY_CHECK_TYPE_WCS;
}else{
throw new ServiceException("请选择人工仓库或agv仓库盘库");
}
if (inventoryCheckId == null || inventoryCheckId.equals(0L) || inventoryCheckId.equals(-1L)) {
WmsInventoryCheck queryInventoryCheck = new WmsInventoryCheck();
queryInventoryCheck.setWarehouseId(warehouseId);
@ -105,6 +117,7 @@ public class WmsInventoryCheckServiceImpl implements IWmsInventoryCheckService {
WmsInventoryCheck wmsInventoryCheck = new WmsInventoryCheck();
wmsInventoryCheck.setInventoryCheckCode(Seq.getId(Seq.wmsInventoryCheckSeqType, Seq.wmsInventoryCheckSeqCode));
wmsInventoryCheck.setWarehouseId(warehouseId);
wmsInventoryCheck.setCheckType(inventoryCheckType);
wmsInventoryCheck.setLocationAmount((long) locationAmount);
wmsInventoryCheck.setInventoryingAmount((long) locationCodes.size());
wmsInventoryCheck.setBeginTime(currentDate);
@ -122,8 +135,7 @@ public class WmsInventoryCheckServiceImpl implements IWmsInventoryCheckService {
wmsInventoryCheckMapper.updateWmsInventoryCheck(toUpdatedInventoryCheck);
}
WmsBaseWarehouse baseWarehouse = wmsBaseWarehouseMapper.selectWmsBaseWarehouseByWarehouseId(warehouseId);
String warehouseInstockType = baseWarehouse.getWarehouseInstockType();
List<WmsInventoryCheckDetail> wmsInventoryCheckDetails = new ArrayList<>();
for (String locationCode : locationCodes) {

@ -184,15 +184,41 @@ public class WmsMoveServiceImpl implements IWmsMoveService {
WmsBaseWarehouse baseWareHouse = wmsBaseWarehouseMapper.
selectWmsBaseWarehouseByWarehouseId(oriLocation.getWarehouseId());
if (!baseWareHouse.getWarehouseType().equals(WmsConstants.WMS_WAREHOUSE_TYPE_NORMAL)) {
throw new ServiceException("请选择人工仓库的库位进行移库");
}
//todo:判断有没有还没有完成从此原库位到目标库位的移库任务(预防还没修改库位状态生成此数据,连续点击问题,或者已经移库出库完成的情况不能将原库位再设置移库记录)
String warehouseInstockType = baseWareHouse.getWarehouseInstockType();
String warehouseType = baseWareHouse.getWarehouseType();
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
String warehouseInstockType = baseWareHouse.getWarehouseInstockType();
String moveWay = "", operationType = "";
if (warehouseType.equals(WmsConstants.WMS_WAREHOUSE_TYPE_WORKBIN_AGV)) {
throw new ServiceException("立库库位移库请在调度页面进行移库");
} else if (warehouseType.equals(WmsConstants.WMS_WAREHOUSE_TYPE_AGV)) {
moveWay = WmsConstants.WMS_MOVEMERGE_WAY_AGV;
operationType = WmsConstants.MWS_OPERATION_TYPE_DISPATCHD;
WmsMove queryMove = new WmsMove();
queryMove.setWarehouseId(oriLocation.getWarehouseId());
queryMove.setExecuteStatusStr(WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE + "," + WmsConstants.WMS_MOVE_EXECUTE_STATUS_EXECUTING + "," + WmsConstants.WMS_MOVE_EXECUTE_STATUS_OUTSTOCK_FINISH);
List<WmsMove> wmsMoveList = wmsMoveMapper.selectWmsMoveList(queryMove);
if (wmsMoveList != null && !wmsMoveList.isEmpty()) {
throw new ServiceException("有正在执行的移库任务");
}
} else {
moveWay = WmsConstants.WMS_MOVEMERGE_WAY_MANUAL;
operationType = WmsConstants.WMS_OPERATION_TYPE_MANUAL;
oriLocation.setLocationStatus(WmsConstants.WMS_BASE_LOCATION_STATUS_MOVE_LOCK);
oriLocation.setUpdateTime(currentDate);
oriLocation.setUpdateBy(userName);
wmsBaseLocationMapper.updateWmsBaseLocation(oriLocation);
targetLocation.setLocationStatus(WmsConstants.WMS_BASE_LOCATION_STATUS_MOVE_LOCK);
targetLocation.setUpdateTime(currentDate);
targetLocation.setUpdateBy(userName);
wmsBaseLocationMapper.updateWmsBaseLocation(targetLocation);
}
WmsMove wmsMove = new WmsMove();
String taskCode = Seq.getId(Seq.wmsMoveSeqType, Seq.wmsMoveSeqCode);
@ -201,8 +227,8 @@ public class WmsMoveServiceImpl implements IWmsMoveService {
wmsMove.setOriLocationCode(wmsMoveApplyVo.getOriLocationCode());
wmsMove.setTargetLocationCode(wmsMoveApplyVo.getTargetLocationCode());
wmsMove.setExecuteStatus(WmsConstants.WMS_MOVE_EXECUTE_STATUS_TOEXECUTE);
wmsMove.setOperationType(WmsConstants.WMS_OPERATION_TYPE_MANUAL);
wmsMove.setMoveWay(WmsConstants.WMS_MOVEMERGE_WAY_MANUAL);
wmsMove.setOperationType(operationType);
wmsMove.setMoveWay(moveWay);
wmsMove.setMoveType(wmsMoveApplyVo.getMoveType());
wmsMove.setAuditStatus(WmsConstants.WMS_AUDIT_STATUS_PASS);
wmsMove.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE);
@ -213,6 +239,8 @@ public class WmsMoveServiceImpl implements IWmsMoveService {
List<WmsMoveDetail> toInsertedMoveDetails = new ArrayList<>();
//判断库位状态,如果原库位和目标库位是深库位,需要判断浅库位状态,需要判断对应的浅库位有没有库存
if (warehouseInstockType.equals(WmsConstants.WMS_WAREHOUSE_INSTOCK_TYPE_RAW)) {//如果是原材料
WmsRawStock queryRawStock = new WmsRawStock();
queryRawStock.setLocationCode(oriLocationCode);
@ -268,21 +296,70 @@ public class WmsMoveServiceImpl implements IWmsMoveService {
toInsertedMoveDetails = getMoveDetailsByProductStocks(productStocks, wmsMove, userName, currentDate);
}
oriLocation.setLocationStatus(WmsConstants.WMS_BASE_LOCATION_STATUS_MOVE_LOCK);
oriLocation.setUpdateTime(currentDate);
oriLocation.setUpdateBy(userName);
wmsBaseLocationMapper.updateWmsBaseLocation(oriLocation);
if (warehouseType.equals(WmsConstants.WMS_WAREHOUSE_TYPE_NORMAL)) {
wmsMoveMapper.batchWmsMoveDetail(toInsertedMoveDetails);
} else if (warehouseType.equals(WmsConstants.WMS_WAREHOUSE_TYPE_AGV)) {
this.checkFrontLocationStock(oriLocation, warehouseInstockType, "1");
this.checkFrontLocationStock(targetLocation, warehouseInstockType, "2");
}
targetLocation.setLocationStatus(WmsConstants.WMS_BASE_LOCATION_STATUS_MOVE_LOCK);
targetLocation.setUpdateTime(currentDate);
targetLocation.setUpdateBy(userName);
wmsBaseLocationMapper.updateWmsBaseLocation(targetLocation);
int rows = wmsMoveMapper.batchWmsMoveDetail(toInsertedMoveDetails);
return 1;
}
return rows;
private void checkFrontLocationStock(WmsBaseLocation baseLocation, String warehouseInstockType, String moveType) {
if (baseLocation.getLocDeep() != null && baseLocation.getLocDeep().equals(WmsConstants.WMS_BASE_LOCATION_LOC_DEEP_BACK)) {
WmsBaseLocation queryBaseLocation = new WmsBaseLocation();
Long locRow = baseLocation.getLocRow();
Long frontRow;
if (locRow % 2 == 0) {
frontRow = locRow - 1;
} else {
frontRow = locRow + 1;
}
queryBaseLocation.setWarehouseId(baseLocation.getWarehouseId());
queryBaseLocation.setLocColumn(baseLocation.getLocColumn());
queryBaseLocation.setLayerNum(baseLocation.getLayerNum());
queryBaseLocation.setLocRow(frontRow);
queryBaseLocation.setLocDeep(WmsConstants.WMS_BASE_LOCATION_LOC_DEEP_FRONT);
List<WmsBaseLocation> baseLocationList = wmsBaseLocationMapper.selectWmsBaseLocationList(queryBaseLocation);
String locationName = "";
if (moveType.equals("1")) {
locationName = "原库位";
} else {
locationName = "目标库位";
}
if (baseLocationList == null || baseLocationList.isEmpty()) {
throw new ServiceException(locationName + "的浅库位未找到");
}
WmsBaseLocation frontLocation = baseLocationList.get(0);
if (!frontLocation.getLocationStatus().equals(WmsConstants.WMS_BASE_LOCATION_STATUS_NORMAL)) {
throw new ServiceException(locationName + "的浅库位状态为" + WmsConstants.LOCATION_STATUS_PROMPT_MAP.get(frontLocation.getLocationStatus()));
}
if (warehouseInstockType.equals(WmsConstants.WMS_WAREHOUSE_INSTOCK_TYPE_RAW)) {//如果是原材料
WmsRawStock queryRawStock = new WmsRawStock();
queryRawStock.setLocationCode(frontLocation.getLocationCode());
List<WmsRawStock> wmsRawStocks = wmsRawStockMapper.selectWmsRawStockInList(queryRawStock);
if (wmsRawStocks != null && !wmsRawStocks.isEmpty()) {
throw new ServiceException(locationName + "的浅库位有库存,无法申请移库");
}
} else {
WmsProductStock queryProductStock = new WmsProductStock();
queryProductStock.setLocationCode(frontLocation.getLocationCode());
List<WmsProductStock> productStocks = wmsProductStockMapper.selectWmsProductStockInList(queryProductStock);
if (productStocks != null && !productStocks.isEmpty()) {
throw new ServiceException(locationName + "的浅库位有库存,无法申请移库");
}
}
}
}
private List<WmsMoveDetail> getMoveDetailsByRawStocks(List<WmsRawStock> wmsRawStocks, WmsMove wmsMove,
String userName, Date currentDate) {
List<WmsMoveDetail> wmsMoveDetailList = new ArrayList<>();
@ -718,12 +795,31 @@ public class WmsMoveServiceImpl implements IWmsMoveService {
throw new ServiceException("没有此移库信息");
}
//根据物料ID找移库明细主要原因是移库入库的库位的物料条码跟之前的条码不一定一样物料条码都是贴在料框上的
WmsMoveDetail existedMoveDetail = wmsMoveDetailList.stream().filter(moveDetail ->
moveDetail.getMaterialBarcode().equals(materialBarcode)).findFirst().get();
moveDetail.getMaterialId().equals(baseBarcodeInfo.getMaterialId())).findFirst().get();
if (existedMoveDetail == null) {
throw new ServiceException("没有此移库信息");
}
String oriBarcodeInfoStr = existedMoveDetail.getMaterialBarcode();
R<MesBaseBarcodeInfo> oriBarcodeInfoR = remoteMesService.getBarcode(oriBarcodeInfoStr, SecurityConstants.INNER);
MesBaseBarcodeInfo oriBarcodeInfo = oriBarcodeInfoR.getData();
if (oriBarcodeInfo == null) {
throw new ServiceException("原物料条码有误");
}
Long targetPurchaseOrderId = baseBarcodeInfo.getPurchaseOrderId() == null ? 0L : baseBarcodeInfo.getPurchaseOrderId();
Long oriPurchaseOrderId = oriBarcodeInfo.getPurchaseOrderId() == null ? 0L : oriBarcodeInfo.getPurchaseOrderId();
if (!targetPurchaseOrderId.equals(oriPurchaseOrderId)) {
String targetPoNo = baseBarcodeInfo.getPoNo() == null ? "" : baseBarcodeInfo.getPoNo();
String oriPoNo = oriBarcodeInfo.getPoNo() == null ? "" : oriBarcodeInfo.getPoNo();
throw new ServiceException("原物料条码(" + oriPoNo + ")和此条码采购订单(" + targetPoNo + ")不一致");
}
String detailExecuteStatus = existedMoveDetail.getExecuteStatus();
if (detailExecuteStatus.equals(WmsConstants.WMS_MOVE_EXECUTE_STATUS_INSTOCK_FINISH)) {
@ -856,7 +952,6 @@ public class WmsMoveServiceImpl implements IWmsMoveService {
}
/**
* ,Join material
*

@ -163,6 +163,10 @@ public class WmsRawInstockServiceImpl implements IWmsRawInstockService {
throw new ServiceException("库位编码有误");
}
if(!baseLocation.getLocationStatus().equals(WmsConstants.WMS_BASE_LOCATION_STATUS_NORMAL)){
throw new ServiceException("不能入库,库位状态为:"+WmsConstants.LOCATION_STATUS_PROMPT_MAP.get(baseLocation.getLocationStatus()));
}
BigDecimal instockAmount = wmsRawInstockVo.getInstockAmount();
if (baseBarcodeInfo.getBatchFlag().equals(MesConstants.IS_BATCH)) {
if (instockAmount.compareTo(BigDecimal.ONE) < 0) {

@ -328,10 +328,25 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
throw new ServiceException("库位码有误");
}
if (!baseLocation.getLocationStatus().equals(WmsConstants.WMS_BASE_LOCATION_STATUS_NORMAL)) {
throw new ServiceException("不能出库,库位状态为:" + WmsConstants.LOCATION_STATUS_PROMPT_MAP.get(baseLocation.getLocationStatus()));
}
//判断是否有此出库任务,人工出库的同一个出库记录同一个库位、同一个物料对应一个明细agv的有可能是多个
WmsRawOutstock wmsRawOutstock;
if (rawOutstockId != null) {
wmsRawOutstock = wmsRawOutstockMapper.selectWmsRawOutstockByRawOutstockId(rawOutstockId);
if (!wmsRawOutstock.getWarehouseId().equals(baseLocation.getWarehouseId())) {
throw new ServiceException("扫描库位所在仓库与选择出库单不符合");
}
if (!wmsRawOutstock.getMaterialId().equals(baseBarcodeInfo.getMaterialId())) {
throw new ServiceException("扫描物料与选择出库单不符合");
}
if (wmsRawOutstock.getExecuteStatus().equals(WmsConstants.WMS_EXECUTE_STATUS_FINISH)) {
throw new ServiceException("此出库单已出库完成,不需要再出");
}
} else {
wmsRawOutstock = this.getWmsRawOutstock(baseLocation, baseBarcodeInfo);
}
@ -346,7 +361,6 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
throw new ServiceException("此物料已经出库,不能重复出库");
}
//todo 判断质检状态
// if (wmsRawOutstockDetail.getQualityStatus() != null
// && !wmsRawOutstockDetail.getQualityStatus().equals(WmsConstants.WMS_QUALITY_STATUS_PASS)) {
// throw new ServiceException("质检通过才能出库");
@ -466,6 +480,8 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
@Override
public List<WmsRawOutstock> selectAuditPassRawOutstocks(WmsRawOutstock wmsRawOutstock) {
wmsRawOutstock.setAuditStatus(WmsConstants.WMS_AUDIT_STATUS_PASS);
wmsRawOutstock.setExecuteStatusStr(WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE + "," + WmsConstants.WMS_EXECUTE_STATUS_EXECUTING);
wmsRawOutstock.setOperationType(WmsConstants.WMS_OPERATION_TYPE_MANUAL);
List<WmsRawOutstock> wmsRawOutstocks = wmsRawOutstockMapper.selectWmsRawOutstockJoinMaterialList(wmsRawOutstock);
return wmsRawOutstocks;
}
@ -1317,6 +1333,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
/**
* 退
*
* @param wmsReturnOutstockVo
* @return
*/
@ -1329,9 +1346,14 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
throw new ServiceException("库位编码错误");
}
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
WmsBaseWarehouse baseWarehouse = wmsBaseWarehouseMapper.selectWmsBaseWarehouseByWarehouseId(baseLocation.getWarehouseId());
if (!baseWarehouse.getWarehouseInstockType().equals(WmsConstants.WMS_WAREHOUSE_INSTOCK_TYPE_RAW)) {
throw new ServiceException("原材料仓库才能退货出库");
}
String warehouseType = baseWarehouse.getWarehouseType();
String executeStatus = "";
BigDecimal outstockAmount = BigDecimal.ZERO;
@ -1347,6 +1369,15 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
throw new ServiceException("此库位无库存信息");
}
if (baseLocation.getLocationStatus().equals(WmsConstants.WMS_BASE_LOCATION_STATUS_RETURN_LOCK)) {
throw new ServiceException("此库位已经申请退货出库");
}
baseLocation.setLocationStatus(WmsConstants.WMS_BASE_LOCATION_STATUS_RETURN_LOCK);
baseLocation.setUpdateBy(userName);
baseLocation.setUpdateTime(currentDate);
wmsBaseLocationMapper.updateWmsBaseLocation(baseLocation);
wmsRawStock = wmsRawStocks.get(0);
} else if (warehouseType.equals(WmsConstants.WMS_WAREHOUSE_TYPE_NORMAL)) {

@ -276,7 +276,6 @@ public class WmsRawReturnServiceImpl implements IWmsRawReturnService {
BigDecimal returnAmount = wmsRawReturnConfirmVo.getReturnAmount();
String locationCode = wmsRawReturnConfirmVo.getLocationCode();
//todo: 判断质检状态,超出库位数量限制,超期判断
// if (wmsRawReturnDetail.getQualityStatus() != null
// && !wmsRawReturnDetail.getQualityStatus().equals(WmsConstants.RAW_RETURN_DETAIL_QUALITY_STATUS_PASS)) {
// throw new ServiceException("质检通过才能出库");
@ -288,11 +287,11 @@ public class WmsRawReturnServiceImpl implements IWmsRawReturnService {
R<MesBaseBarcodeInfo> mesBaseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER);
if (mesBaseBarcodeInfoR == null) {
throw new ServiceException("物料码错误");
throw new ServiceException("物料码错误");
}
MesBaseBarcodeInfo mesBaseBarcodeInfo = mesBaseBarcodeInfoR.getData();
if (mesBaseBarcodeInfo == null) {
throw new ServiceException("物料码错误");
throw new ServiceException("物料码错误");
}
WmsRawReturn wmsRawReturn = wmsRawReturnMapper.selectOnlyWmsRawReturnByRawReturnId(rawReturnId);
if (!wmsRawReturn.getAuditStatus().equals(WmsConstants.WMS_AUDIT_STATUS_PASS)) {
@ -311,13 +310,10 @@ public class WmsRawReturnServiceImpl implements IWmsRawReturnService {
// }
// }
if (!wmsRawReturn.getMaterialBarcode().equals(materialBarcode)) {
throw new ServiceException("物料编码错误");
}
WmsBaseLocation baseLocation = wmsBaseLocationMapper.selectWmsBaseLocationByLocationCode(locationCode);
if (baseLocation == null) {
throw new ServiceException("库位编码有误");
throw new ServiceException("库位编码有误");
}
if (!baseLocation.getWarehouseId().equals(wmsRawReturn.getWarehouseId())) {
@ -397,7 +393,6 @@ public class WmsRawReturnServiceImpl implements IWmsRawReturnService {
wmsRawStock.setLastOutstockTime(mesBaseBarcodeInfo.getLastOutstockDate());
wmsRawStock.setSaleOrderId(mesBaseBarcodeInfo.getSaleOrderId());
wmsRawStock.setSafeFlag(mesBaseBarcodeInfo.getSafeFlag());
// wmsRawStock.setQualityStatus();//TODO:质检状态
wmsRawStock.setCompleteFlag(WmsConstants.WMS_RAW_STOCK_COMPLETE_FLAG_YES);
wmsRawStock.setTotalAmount(wmsRawReturnConfirmVo.getReturnAmount());
wmsRawStock.setCreateBy(userName);

@ -17,6 +17,7 @@ import com.hw.mes.api.RemoteMesService;
import com.hw.mes.api.domain.MesBaseBarcodeInfo;
import com.hw.mes.api.domain.MesBaseMaterialInfo;
import com.hw.mes.api.domain.MesBaseStationInfo;
import com.hw.mes.api.domain.MesSaleOrderRelate;
import com.hw.mes.api.domain.vo.MesBaseBarcodeInfoTransferVo;
import com.hw.mes.api.domain.vo.MesSaleOrderTransferVo;
import com.hw.wms.config.WmsConfig;
@ -225,9 +226,32 @@ public class WmsStockTotalServiceImpl implements IWmsStockTotalService {
}
for (WmsStockTotal stockTotal : stockTotalList) {
if (stockTotal.getProductId().equals(0L)) {
stockTotal.setMaterialCode("1111|222");
if (stockTotal.getMaterialClassfication() != null &&
stockTotal.getMaterialClassfication().equals(MesConstants.MES_MATERIAL_CLASSFICATION_VIRTUAL)) {
R<List<MesSaleOrderRelate>> saleOrderRelatesData = remoteMesService.getRelateProductsBySaleOrderId(stockTotal.getSaleOrderId(), SecurityConstants.INNER);
if (saleOrderRelatesData != null) {
StringBuilder productCodes = new StringBuilder();
StringBuilder productNames = new StringBuilder();
StringBuilder productSpecs = new StringBuilder();
List<MesSaleOrderRelate> saleOrderRelates = saleOrderRelatesData.getData();
if (saleOrderRelates != null) {
for (MesSaleOrderRelate mesSaleOrderRelate : saleOrderRelates) {
productCodes.append("|").append(mesSaleOrderRelate.getProductCode());
productNames.append("|").append(mesSaleOrderRelate.getProductName());
productSpecs.append("|").append(mesSaleOrderRelate.getProductSpec());
}
productCodes.replace(0,1,"");
productNames.replace(0, 1, "");
productSpecs.replace(0, 1, "");
stockTotal.setMaterialCode(productCodes.toString());
stockTotal.setMaterialName(productNames.toString());
stockTotal.setMaterialSpec(productSpecs.toString());
}
}
}
}
return stockTotalList;

@ -45,7 +45,7 @@
</resultMap>
<sql id="selectWmsBaseLocationVo">
select location_id, warehouse_id, location_code,container_code,agv_position_code, warehouse_floor,loc_row, layer_num, loc_column, active_flag, manual_flag, qty_limit, instock_flag, outstock_flag, location_status, batch_mix, create_by, create_time, update_by, update_time, remark, del_flag, shelf_order, check_order, pick_order, pick_flag, is_open_kn_flag, location_scrap_type, volume_limit, weight_limit, length, width, height from wms_base_location
select location_id, warehouse_id, location_code,container_code,agv_position_code, warehouse_floor,loc_row, layer_num, loc_column, active_flag, manual_flag, qty_limit, instock_flag, outstock_flag, location_status,loc_deep, batch_mix, create_by, create_time, update_by, update_time, remark, del_flag, shelf_order, check_order, pick_order, pick_flag, is_open_kn_flag, location_scrap_type, volume_limit, weight_limit, length, width, height from wms_base_location
</sql>
<select id="selectWmsBaseLocationList" parameterType="WmsBaseLocation" resultMap="WmsBaseLocationResult">

@ -9,6 +9,7 @@
<result property="inventoryCheckCode" column="inventory_check_code" />
<result property="warehouseId" column="warehouse_id" />
<result property="checkStatus" column="check_status" />
<result property="checkType" column="check_type" />
<result property="beginTime" column="begin_time" />
<result property="endTime" column="end_time" />
<result property="locationAmount" column="location_amount" />
@ -84,6 +85,7 @@
<if test="inventoryCheckCode != null">inventory_check_code,</if>
<if test="warehouseId != null">warehouse_id,</if>
<if test="checkStatus != null and checkStatus != ''">check_status,</if>
<if test="checkType != null and checkType != ''">check_type,</if>
<if test="beginTime != null">begin_time,</if>
<if test="endTime != null">end_time,</if>
<if test="locationAmount != null">location_amount,</if>
@ -99,6 +101,7 @@
<if test="inventoryCheckCode != null">#{inventoryCheckCode},</if>
<if test="warehouseId != null">#{warehouseId},</if>
<if test="checkStatus != null and checkStatus != ''">#{checkStatus},</if>
<if test="checkType != null and checkType != ''">#{checkType},</if>
<if test="beginTime != null">#{beginTime},</if>
<if test="endTime != null">#{endTime},</if>
<if test="locationAmount != null">#{locationAmount},</if>
@ -175,6 +178,7 @@
<if test="inventoryCheckCode != null and inventoryCheckCode != ''"> and wic.inventory_check_code = #{inventoryCheckCode}</if>
<if test="warehouseId != null "> and wic.warehouse_id = #{warehouseId}</if>
<if test="checkStatus != null and checkStatus != ''"> and wic.check_status = #{checkStatus}</if>
<if test="checkType != null and checkType != ''"> and wic.check_type = #{checkType}</if>
<if test="params.beginBeginTime != null and params.beginBeginTime != '' and params.endBeginTime != null and params.endBeginTime != ''">
and wic.begin_time between #{params.beginBeginTime} and #{params.endBeginTime}</if>

@ -81,6 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="auditReason != null and auditReason != ''"> and audit_reason = #{auditReason}</if>
<if test="auditStatus != null and auditStatus != ''"> and audit_status = #{auditStatus}</if>
<if test="executeStatus != null and executeStatus != ''"> and execute_status = #{executeStatus}</if>
<if test="executeStatusStr != null and executeStatusStr != ''"> and execute_status in (${executeStatusStr})</if>
<if test="applyBy != null and applyBy != ''"> and apply_by = #{applyBy}</if>
<if test="applyDate != null "> and apply_date = #{applyDate}</if>
<if test="auditBy != null and auditBy != ''"> and audit_by = #{auditBy}</if>

@ -306,6 +306,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="taskCode != null and taskCode != ''"> and wro.task_code = #{taskCode}</if>
<if test="auditStatus != null and auditStatus != ''"> and wro.audit_status = #{auditStatus}</if>
<if test="applyBy != null and applyBy != ''"> and wro.apply_by like concat('%', #{applyBy}, '%')</if>
<if test="executeStatusStr != null and executeStatusStr != ''"> and execute_status in (${executeStatusStr})</if>
<if test="operationType != null and operationType != ''"> and operation_type = #{operationType}</if>
</where>
order by wro.raw_outstock_id desc
</select>

@ -55,6 +55,7 @@
<result property="saleorderCode" column="saleorder_code"/>
<result property="orderAmount" column="order_amount"/>
<result property="applyAmount" column="apply_amount"/>
<result property="materialClassfication" column="material_classfication"/>
</resultMap>
@ -288,6 +289,7 @@
mbmi.material_code,
mbmi.material_name,
mbmi.material_spec,
mbmi.material_classfication,
wst.total_amount,
wst.frozen_amount,
wst.occupy_amount,

Loading…
Cancel
Save