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