|
@@ -7,6 +7,8 @@ import com.yh.saas.common.support.util.IdGenerator;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.constant.NumberConstant;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.constant.StatusEnum;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.entity.*;
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.entity.view.WarehouseNumView;
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.entity.view.WarehouseView;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.exception.YException;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.exception.YExceptionEnum;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.mapper.WarehouseInOutInfoMapper;
|
|
@@ -25,6 +27,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
import java.util.HashMap;
|
|
@@ -241,6 +244,48 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
|
|
|
throw new YException(YExceptionEnum.WAREHOUSE_NO_ERROR);
|
|
|
}
|
|
|
}
|
|
|
+ //临时库出库
|
|
|
+ else if ("1".equals(warehouseInOutInfo.getInOutFlag()) && "2".equals(warehouseBaseInfo.getWarehouseType())) {
|
|
|
+ if (warehouseBaseInfo != null) {
|
|
|
+ //定义入库
|
|
|
+ String inNetWeight = "";
|
|
|
+ // 查询入库量
|
|
|
+ List<WarehouseInOutInfo> warehouseInOutInfoList = warehouseInOutInfoService.selectList(new EntityWrapper<WarehouseInOutInfo>()
|
|
|
+ .eq("base_id", warehouseInOutInfo.getBaseId()).eq("in_out_flag", "2").eq("goods_name_key", warehouseInOutInfo.getGoodsNameKey()));
|
|
|
+ if (!CollectionUtils.isEmpty(warehouseInOutInfoList)) {
|
|
|
+ for (WarehouseInOutInfo warehouseInOutInfos : warehouseInOutInfoList) {
|
|
|
+ if (StringUtils.isEmpty(inNetWeight)) {
|
|
|
+ inNetWeight = "0";
|
|
|
+ }
|
|
|
+ inNetWeight = String.valueOf(Float.valueOf(inNetWeight) + warehouseInOutInfos.getNetWeight());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //定义出库量
|
|
|
+ String outNetWeight = "";
|
|
|
+ // 查询出库量
|
|
|
+ List<WarehouseInOutInfo> warehouseInOutInfo1 = warehouseInOutInfoService.selectList(new EntityWrapper<WarehouseInOutInfo>()
|
|
|
+ .eq("base_id", warehouseInOutInfo.getBaseId()).eq("in_out_flag", "1")
|
|
|
+ .eq("goods_name_key", warehouseInOutInfo.getGoodsNameKey()));
|
|
|
+ if (!CollectionUtils.isEmpty(warehouseInOutInfo1)) {
|
|
|
+ for (WarehouseInOutInfo warehouseInOutInfos : warehouseInOutInfo1) {
|
|
|
+ if (StringUtils.isEmpty(inNetWeight)) {
|
|
|
+ outNetWeight = "0";
|
|
|
+ }
|
|
|
+ outNetWeight = String.valueOf(Float.valueOf(outNetWeight) + warehouseInOutInfos.getNetWeight());
|
|
|
+ }
|
|
|
+ //有出库记录
|
|
|
+ outNetWeight = String.valueOf(Float.valueOf(outNetWeight) + warehouseInOutInfo.getNetWeight());
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ //没有出库记录
|
|
|
+ outNetWeight = String.valueOf(warehouseInOutInfo.getNetWeight());
|
|
|
+ }
|
|
|
+ if ((outNetWeight.compareTo(inNetWeight)) > 0) {
|
|
|
+ //出库量大于入库量
|
|
|
+ throw new YException(YExceptionEnum.INNETWEIGHT_NO_ERROR);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
//插入记录
|
|
|
if (StringUtils.isEmpty(warehouseInOutInfo.getId())) {
|
|
|
warehouseInOutInfo.setId(IdGenerator.generateUUID());
|
|
@@ -328,7 +373,7 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
|
|
|
@Override
|
|
|
public List<WarehouseInOutInfo> selectTemporaryGoodsNameList(String baseId) {
|
|
|
List<WarehouseInOutInfo> warehouseInOutInfoList = this.selectList(new EntityWrapper<WarehouseInOutInfo>()
|
|
|
- .eq("base_id", baseId).eq("delete_flag", "0").eq("status_flag", "3"));
|
|
|
+ .eq("base_id", baseId).eq("delete_flag", "0").eq("status_flag", "3").groupBy("goods_name_key"));
|
|
|
return warehouseInOutInfoList;
|
|
|
}
|
|
|
|