|
|
@ -146,7 +146,7 @@ public class WmsRawInstockServiceImpl implements IWmsRawInstockService {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public int insertWmsRawInstock(WmsRawInstockVo wmsRawInstockVo) {
|
|
|
|
public BigDecimal insertWmsRawInstock(WmsRawInstockVo wmsRawInstockVo) {
|
|
|
|
String materialBarcode = wmsRawInstockVo.getMaterialBarcode();
|
|
|
|
String materialBarcode = wmsRawInstockVo.getMaterialBarcode();
|
|
|
|
R<MesBaseBarcodeInfo> baseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER);
|
|
|
|
R<MesBaseBarcodeInfo> baseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER);
|
|
|
|
if (baseBarcodeInfoR == null) {
|
|
|
|
if (baseBarcodeInfoR == null) {
|
|
|
@ -206,9 +206,7 @@ public class WmsRawInstockServiceImpl implements IWmsRawInstockService {
|
|
|
|
int rows = wmsRawInstockMapper.insertWmsRawInstock(wmsRawInstock);
|
|
|
|
int rows = wmsRawInstockMapper.insertWmsRawInstock(wmsRawInstock);
|
|
|
|
|
|
|
|
|
|
|
|
//更新库位库存
|
|
|
|
//更新库位库存
|
|
|
|
updateRawStock(wmsRawInstock, wmsRawInstockVo, baseLocation, baseBarcodeInfo, userName, currentDate);
|
|
|
|
return updateRawStock(wmsRawInstock, wmsRawInstockVo, baseLocation, baseBarcodeInfo, userName, currentDate);
|
|
|
|
|
|
|
|
|
|
|
|
return rows;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -221,7 +219,7 @@ public class WmsRawInstockServiceImpl implements IWmsRawInstockService {
|
|
|
|
* @param userName
|
|
|
|
* @param userName
|
|
|
|
* @param currentDate
|
|
|
|
* @param currentDate
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void updateRawStock(WmsRawInstock wmsRawInstock, WmsRawInstockVo wmsRawInstockVo, WmsBaseLocation baseLocation
|
|
|
|
public BigDecimal updateRawStock(WmsRawInstock wmsRawInstock, WmsRawInstockVo wmsRawInstockVo, WmsBaseLocation baseLocation
|
|
|
|
, MesBaseBarcodeInfo baseBarcodeInfo, String userName, Date currentDate) {
|
|
|
|
, MesBaseBarcodeInfo baseBarcodeInfo, String userName, Date currentDate) {
|
|
|
|
String barcode = baseBarcodeInfo.getBarcodeInfo();
|
|
|
|
String barcode = baseBarcodeInfo.getBarcodeInfo();
|
|
|
|
String locationCode = wmsRawInstock.getLocationCode();
|
|
|
|
String locationCode = wmsRawInstock.getLocationCode();
|
|
|
@ -239,12 +237,14 @@ public class WmsRawInstockServiceImpl implements IWmsRawInstockService {
|
|
|
|
String batchFlag = baseBarcodeInfo.getBatchFlag();
|
|
|
|
String batchFlag = baseBarcodeInfo.getBatchFlag();
|
|
|
|
//如果是同一库位入同一批次,则更新数量
|
|
|
|
//如果是同一库位入同一批次,则更新数量
|
|
|
|
WmsRawStock wmsRawStock = wmsRawStockMapper.selectRawStockByBarcode(barcode);
|
|
|
|
WmsRawStock wmsRawStock = wmsRawStockMapper.selectRawStockByBarcode(barcode);
|
|
|
|
|
|
|
|
BigDecimal newTotalAmount = BigDecimal.ZERO;
|
|
|
|
if (wmsRawStock != null) {
|
|
|
|
if (wmsRawStock != null) {
|
|
|
|
// wmsRawStock.setQualityStatus(wmsRawInstockVo.getQualityStatus());
|
|
|
|
// wmsRawStock.setQualityStatus(wmsRawInstockVo.getQualityStatus());
|
|
|
|
if (!batchFlag.equals(MesConstants.IS_BATCH)) {
|
|
|
|
if (!batchFlag.equals(MesConstants.IS_BATCH)) {
|
|
|
|
throw new ServiceException("此物料条码已经入库");
|
|
|
|
throw new ServiceException("此物料条码已经入库");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
wmsRawStock.setTotalAmount(wmsRawStock.getTotalAmount().add(wmsRawInstockVo.getInstockAmount()));
|
|
|
|
newTotalAmount = wmsRawStock.getTotalAmount().add(wmsRawInstockVo.getInstockAmount());
|
|
|
|
|
|
|
|
wmsRawStock.setTotalAmount(newTotalAmount);
|
|
|
|
wmsRawStock.setUpdateBy(userName);
|
|
|
|
wmsRawStock.setUpdateBy(userName);
|
|
|
|
wmsRawStock.setUpdateDate(currentDate);
|
|
|
|
wmsRawStock.setUpdateDate(currentDate);
|
|
|
|
wmsRawStockMapper.updateWmsRawStock(wmsRawStock);
|
|
|
|
wmsRawStockMapper.updateWmsRawStock(wmsRawStock);
|
|
|
@ -258,7 +258,8 @@ public class WmsRawInstockServiceImpl implements IWmsRawInstockService {
|
|
|
|
wmsRawStock.setWarehouseFloor(baseLocation.getWarehouseFloor());
|
|
|
|
wmsRawStock.setWarehouseFloor(baseLocation.getWarehouseFloor());
|
|
|
|
// wmsRawStock.setLastOutstockTime(baseBarcodeInfo.getLastOutstockDate());
|
|
|
|
// wmsRawStock.setLastOutstockTime(baseBarcodeInfo.getLastOutstockDate());
|
|
|
|
// wmsRawStock.setQualityStatus(wmsRawInstockVo.getQualityStatus());
|
|
|
|
// wmsRawStock.setQualityStatus(wmsRawInstockVo.getQualityStatus());
|
|
|
|
wmsRawStock.setTotalAmount(wmsRawInstockVo.getInstockAmount());
|
|
|
|
newTotalAmount = wmsRawInstockVo.getInstockAmount();
|
|
|
|
|
|
|
|
wmsRawStock.setTotalAmount(newTotalAmount);
|
|
|
|
wmsRawStock.setSaleOrderId(baseBarcodeInfo.getSaleOrderId());
|
|
|
|
wmsRawStock.setSaleOrderId(baseBarcodeInfo.getSaleOrderId());
|
|
|
|
wmsRawStock.setSafeFlag(baseBarcodeInfo.getSafeFlag());
|
|
|
|
wmsRawStock.setSafeFlag(baseBarcodeInfo.getSafeFlag());
|
|
|
|
wmsRawStock.setInstockDate(baseBarcodeInfo.getAcceptedDate());
|
|
|
|
wmsRawStock.setInstockDate(baseBarcodeInfo.getAcceptedDate());
|
|
|
@ -267,6 +268,8 @@ public class WmsRawInstockServiceImpl implements IWmsRawInstockService {
|
|
|
|
wmsRawStock.setCreateDate(currentDate);
|
|
|
|
wmsRawStock.setCreateDate(currentDate);
|
|
|
|
wmsRawStockMapper.insertWmsRawStock(wmsRawStock);
|
|
|
|
wmsRawStockMapper.insertWmsRawStock(wmsRawStock);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return newTotalAmount;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -386,12 +389,12 @@ public class WmsRawInstockServiceImpl implements IWmsRawInstockService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
MesBaseBarcodeInfo baseBarcodeInfo = baseBarcodeInfoR.getData();
|
|
|
|
MesBaseBarcodeInfo baseBarcodeInfo = baseBarcodeInfoR.getData();
|
|
|
|
if (baseBarcodeInfo == null) {
|
|
|
|
if (baseBarcodeInfo == null) {
|
|
|
|
throw new ServiceException("物料条码有误");
|
|
|
|
throw new ServiceException("物料条码有误!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(baseBarcodeInfo.getProductBarcode())) {
|
|
|
|
// if (StringUtils.isEmpty(baseBarcodeInfo.getProductBarcode())) {
|
|
|
|
throw new ServiceException("此物料条码信息有误");
|
|
|
|
// throw new ServiceException("此物料条码信息有误");
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
String wcsAgvContinueUrl = wmsConfig.getWcsAgvContinueUrl();
|
|
|
|
String wcsAgvContinueUrl = wmsConfig.getWcsAgvContinueUrl();
|
|
|
|
RestTemplate restTemplate = new RestTemplate();
|
|
|
|
RestTemplate restTemplate = new RestTemplate();
|
|
|
|