|
|
|
|
@ -868,7 +868,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private WmsRawOutstock agvRawOutstock(WmsAgvRawOutstockVo wmsAgvRawOutstockVo, WmsBaseLocation
|
|
|
|
|
oriBaseLocation, String moveMaterialBarcode, Long moveMaterialId,
|
|
|
|
|
oriBaseLocation, String moveMaterialBarcode, Long moveMaterialId,
|
|
|
|
|
String taskType, String userName, Date currentDate) {
|
|
|
|
|
WmsRawOutstock rawOutstock = new WmsRawOutstock();
|
|
|
|
|
rawOutstock.setWarehouseId(oriBaseLocation.getWarehouseId());
|
|
|
|
|
@ -899,7 +899,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private WmsRawInstock agvRawInstock(WmsAgvRawOutstockVo wmsAgvRawOutstockVo, WmsBaseLocation
|
|
|
|
|
targetBaseLocation, String moveMaterialBarcode, Long moveMaterialId,
|
|
|
|
|
targetBaseLocation, String moveMaterialBarcode, Long moveMaterialId,
|
|
|
|
|
String userName, Date currentDate) {
|
|
|
|
|
WmsRawInstock rawInstock = new WmsRawInstock();
|
|
|
|
|
rawInstock.setWarehouseId(wmsAgvRawOutstockVo.getWarehouseId());
|
|
|
|
|
@ -1447,16 +1447,18 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取原材料出库信息,join material和warehouse
|
|
|
|
|
*
|
|
|
|
|
* @param wmsRawOutstock
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public List<WmsRawOutstock> selectWmsRawOutstockJoinMaterialList(WmsRawOutstock wmsRawOutstock){
|
|
|
|
|
public List<WmsRawOutstock> selectWmsRawOutstockJoinMaterialList(WmsRawOutstock wmsRawOutstock) {
|
|
|
|
|
return wmsRawOutstockMapper.selectWmsRawOutstockJoinMaterialList(wmsRawOutstock);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 关联销售订单
|
|
|
|
|
*
|
|
|
|
|
* @param outstockRequestDTO
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@ -1495,7 +1497,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
|
|
|
|
|
wmsRawOutstock.setUpdateBy(userName);
|
|
|
|
|
wmsRawOutstock.setUpdateDate(currentDate);
|
|
|
|
|
Long rawOutstockId = wmsRawOutstockDetail.getRawOutstockId();
|
|
|
|
|
if (i == 0){
|
|
|
|
|
if (i == 0) {
|
|
|
|
|
wmsRawOutstockMapper.updateWmsRawOutstock(wmsRawOutstock);
|
|
|
|
|
} else {
|
|
|
|
|
wmsRawOutstock.setTaskCode(taskCode + "-" + i);
|
|
|
|
|
@ -1508,7 +1510,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
|
|
|
|
|
wmsRawOutstockDetail.setOutstockAmount(outstockAmount);
|
|
|
|
|
wmsRawOutstockDetail.setUpdateBy(userName);
|
|
|
|
|
wmsRawOutstockDetail.setUpdateDate(currentDate);
|
|
|
|
|
if (i == 0){
|
|
|
|
|
if (i == 0) {
|
|
|
|
|
wmsRawOutstockDetailMapper.updateWmsRawOutstockDetail(wmsRawOutstockDetail);
|
|
|
|
|
} else {
|
|
|
|
|
wmsRawOutstockDetailMapper.insertWmsRawOutstockDetail(wmsRawOutstockDetail);
|
|
|
|
|
@ -1518,4 +1520,60 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 取消原材料出库
|
|
|
|
|
*
|
|
|
|
|
* @param wmsRawOutstock
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public int cancelWmsRawOutstock(WmsRawOutstock wmsRawOutstock) {
|
|
|
|
|
String userName = SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname();
|
|
|
|
|
Date currentDate = new Date();
|
|
|
|
|
|
|
|
|
|
if (wmsRawOutstock.getAuditStatus().equals(WmsConstants.WMS_AUDIT_STATUS_FAIL)) {
|
|
|
|
|
throw new ServiceException("审核不通过状态的不允许取消");
|
|
|
|
|
}
|
|
|
|
|
if (wmsRawOutstock.getAuditStatus().equals(WmsConstants.WMS_AUDIT_STATUS_TOAUDIT)) {
|
|
|
|
|
throw new ServiceException("待审核状态的不允许取消");
|
|
|
|
|
}
|
|
|
|
|
if (wmsRawOutstock.getExecuteStatus().equals(WmsConstants.WMS_EXECUTE_STATUS_FINISH)) {
|
|
|
|
|
throw new ServiceException("执行完成的不允许取消");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BigDecimal originalOutstockAmount = wmsRawOutstock.getOutstockAmount();
|
|
|
|
|
BigDecimal realOutstockAmount = wmsRawOutstock.getRealOutstockAmount();
|
|
|
|
|
|
|
|
|
|
BigDecimal cancelAmount = originalOutstockAmount.subtract(realOutstockAmount);
|
|
|
|
|
if (cancelAmount.compareTo(BigDecimal.ZERO) <= 0) {
|
|
|
|
|
throw new ServiceException("出库数量已经等于申请数量,不需要取消!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
wmsRawOutstock.setOutstockAmount(wmsRawOutstock.getRealOutstockAmount());
|
|
|
|
|
wmsRawOutstock.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_FINISH);
|
|
|
|
|
wmsRawOutstock.setUpdateBy(userName);
|
|
|
|
|
wmsRawOutstock.setUpdateDate(currentDate);
|
|
|
|
|
String auditReason = wmsRawOutstock.getAuditReason()==null ? "":wmsRawOutstock.getAuditReason();
|
|
|
|
|
wmsRawOutstock.setAuditReason(auditReason + " 取消出库,原申请数量为" + originalOutstockAmount);
|
|
|
|
|
int updateCount = wmsRawOutstockMapper.updateWmsRawOutstock(wmsRawOutstock);
|
|
|
|
|
|
|
|
|
|
if (wmsRawOutstock.getStockTotalId() != null) {
|
|
|
|
|
WmsStockTotal wmsStockTotal = wmsStockTotalMapper.selectWmsStockTotalByStockTotalId(wmsRawOutstock.getStockTotalId());
|
|
|
|
|
if (wmsStockTotal != null) {
|
|
|
|
|
//更新占用数量
|
|
|
|
|
BigDecimal newOccupyAmount = wmsStockTotal.getOccupyAmount().subtract(cancelAmount);
|
|
|
|
|
newOccupyAmount = newOccupyAmount.compareTo(BigDecimal.ZERO) >= 0 ? newOccupyAmount : BigDecimal.ZERO;
|
|
|
|
|
wmsStockTotal.setOccupyAmount(newOccupyAmount);
|
|
|
|
|
wmsStockTotal.setUpdateBy(userName);
|
|
|
|
|
wmsStockTotal.setUpdateDate(currentDate);
|
|
|
|
|
wmsStockTotalMapper.updateWmsStockTotal(wmsStockTotal);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return updateCount;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|