|
|
|
@ -6,8 +6,10 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
|
import com.github.yulichang.toolkit.JoinWrappers;
|
|
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import org.dromara.common.core.exception.ServiceException;
|
|
|
|
|
import org.dromara.common.core.utils.DateUtils;
|
|
|
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
|
|
import org.dromara.common.satoken.utils.LoginHelper;
|
|
|
|
|
import org.dromara.common.translation.annotation.Translation;
|
|
|
|
|
import org.dromara.wms.domain.*;
|
|
|
|
@ -16,8 +18,10 @@ import org.dromara.wms.mapper.*;
|
|
|
|
|
import org.dromara.wms.service.IWmsPdaApiService;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
@ -41,6 +45,7 @@ public class WmsPdaApiServiceImpl implements IWmsPdaApiService {
|
|
|
|
|
private final WmsOutstockDetailMapper wmsOutstockDetailMapper;
|
|
|
|
|
private final BaseMaterialInfoMapper baseMaterialInfoMapper;//物料基础信息
|
|
|
|
|
private final WmsHppTransferMapper wmsHppTransferMapper;
|
|
|
|
|
private final WmsBaseLocationMapper wmsBaseLocationMapper;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public WmsOutstockRecordVo returnSelectCode(String code) {
|
|
|
|
@ -412,4 +417,79 @@ public class WmsPdaApiServiceImpl implements IWmsPdaApiService {
|
|
|
|
|
public int semiDeleteErrorCode(String code) {
|
|
|
|
|
return apiMapper.semiDeleteErrorCode(code);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生产入库接口
|
|
|
|
|
* @param vo 入库详情
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public Boolean productionSubmitInStoreInfo(ProdInStockApiVo vo) {
|
|
|
|
|
Date nowDate = new Date();
|
|
|
|
|
if (StringUtils.isEmpty(vo.getSecondConfirmFlag())){
|
|
|
|
|
throw new ServiceException("二次确认标识为空!");
|
|
|
|
|
}
|
|
|
|
|
String secondConfirmFlag = vo.getSecondConfirmFlag();// 二次确认标识(0否 1是)
|
|
|
|
|
Long locationId = vo.getLocationId() == null ? 3L : vo.getLocationId();
|
|
|
|
|
Long warehouseId = 4L;//默认仓库
|
|
|
|
|
BaseMaterialInfoVo materialInfoVo = baseMaterialInfoMapper.selectVoById(vo.getMaterialId());
|
|
|
|
|
if (StringUtils.isNull(materialInfoVo)){
|
|
|
|
|
throw new ServiceException("此物料不存在!");
|
|
|
|
|
}
|
|
|
|
|
WmsInstockPrint print = new WmsInstockPrint();
|
|
|
|
|
print.setBatchCode(vo.getBatchCode());
|
|
|
|
|
print.setMaterialQty(1L);
|
|
|
|
|
print.setApportionQty(vo.getInstockNum());
|
|
|
|
|
print.setMaterialId(vo.getMaterialId());
|
|
|
|
|
print.setMaterialCode(materialInfoVo.getMaterialCode());
|
|
|
|
|
print.setMaterialName(materialInfoVo.getMaterialName());
|
|
|
|
|
print.setMaterialSpe(materialInfoVo.getMaterialSpec());
|
|
|
|
|
print.setUnitName(materialInfoVo.getMaterialUnit());
|
|
|
|
|
print.setMaterialCategoryId(materialInfoVo.getMaterialCategoryId());
|
|
|
|
|
print.setCodeYesNo("1");
|
|
|
|
|
print.setLocationId(locationId);
|
|
|
|
|
|
|
|
|
|
if (secondConfirmFlag.equals("0")){
|
|
|
|
|
print.setInboundStatus("1");
|
|
|
|
|
print.setActualInboundTime(nowDate);
|
|
|
|
|
WmsInstockRecord record = new WmsInstockRecord();
|
|
|
|
|
record.setBatchCode(vo.getBatchCode());
|
|
|
|
|
record.setMaterialId(vo.getMaterialId());
|
|
|
|
|
record.setWarehouseId(warehouseId);
|
|
|
|
|
WmsBaseLocationVo locationVo = wmsBaseLocationMapper.selectVoById(locationId);
|
|
|
|
|
if (locationVo == null){
|
|
|
|
|
throw new ServiceException("此库位不存在!");
|
|
|
|
|
}
|
|
|
|
|
record.setLocationCode(locationVo.getLocationCode());
|
|
|
|
|
record.setMaterialCode(materialInfoVo.getMaterialCode());
|
|
|
|
|
record.setMaterialName(materialInfoVo.getMaterialName());
|
|
|
|
|
record.setInstockQty(vo.getInstockNum().doubleValue());
|
|
|
|
|
record.setMaterialCategoryId(materialInfoVo.getMaterialCategoryId());
|
|
|
|
|
wmsInstockRecordMapper.insert(record);
|
|
|
|
|
|
|
|
|
|
// 查询
|
|
|
|
|
WmsInventoryVo wmsInventoryVo = selectInVentoryByBatchCode(vo.getBatchCode(), locationVo.getLocationCode());
|
|
|
|
|
if (wmsInventoryVo == null) {
|
|
|
|
|
// 插入库存
|
|
|
|
|
WmsInventory inventory = new WmsInventory();
|
|
|
|
|
BeanUtils.copyProperties(record, inventory);
|
|
|
|
|
inventory.setMaterialCategoryId(Long.valueOf(materialInfoVo.getMaterialCategoryId()));
|
|
|
|
|
inventory.setInventoryQty(vo.getInstockNum());
|
|
|
|
|
inventory.setInventoryStatus("1");
|
|
|
|
|
inventory.setStoreId(warehouseId);
|
|
|
|
|
inventory.setWarehouseId(warehouseId.toString());
|
|
|
|
|
wmsInventoryMapper.insert(inventory);
|
|
|
|
|
} else {
|
|
|
|
|
WmsInventory inventory = new WmsInventory();
|
|
|
|
|
inventory.setInventoryId(wmsInventoryVo.getInventoryId());
|
|
|
|
|
inventory.setInventoryQty(wmsInventoryVo.getInventoryQty().add(vo.getInstockNum()));
|
|
|
|
|
wmsInventoryMapper.updateById(inventory);
|
|
|
|
|
}
|
|
|
|
|
wmsInstockPrintMapper.insert(print);
|
|
|
|
|
} else if (secondConfirmFlag.equals("1")){
|
|
|
|
|
print.setInboundStatus("0");
|
|
|
|
|
wmsInstockPrintMapper.insert(print);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|