| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import com.alibaba.excel.event.AnalysisEventListener; |
| | | import com.alibaba.excel.exception.ExcelDataConvertException; |
| | | import com.consum.base.BaseController; |
| | | import com.consum.base.core.type.StatesType; |
| | | import com.consum.base.core.utils.CommonUtil; |
| | | import com.consum.base.core.utils.MapUtils; |
| | | import com.consum.base.core.utils.MapperUtil; |
| | |
| | | * |
| | | * @author 卢庆阳 |
| | | * @date 2023/10/25 |
| | | * <p> |
| | | * 物品的禁用或删除,不影响已经采购入过库的物品信息。 |
| | | * <p> |
| | | */ |
| | | // TODO 物品的禁用或删除,不影响已经采购入过库的物品信息。 |
| | | @PostMapping("/updStatus") |
| | | public ResponseValue updateStatus() { |
| | | BaseGoodsTemplate goodsTemplate = CommonUtil.getObjFromReqBody(BaseGoodsTemplate.class); |
| | |
| | | * @Description 根据物品id删除物品 |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/25 |
| | | * <p> |
| | | * 物品的禁用或删除,不影响已经采购入过库的物品信息。 |
| | | * <p/> |
| | | */ |
| | | // TODO 物品的禁用或删除,不影响已经采购入过库的物品信息。 |
| | | @DeleteMapping("/del") |
| | | public ResponseValue updateById() { |
| | | BaseGoodsTemplate goodsTemplate = CommonUtil.getObjFromReqBody(BaseGoodsTemplate.class); |
| | |
| | | |
| | | @GetMapping("/query/goodsTemplate") |
| | | public ResponseValue queryGoodsTemplateByCategoryId(Long agencyId, Long categoryId) { |
| | | // TODO 不限制机构 |
| | | List<BaseGoodsTemplate> list = |
| | | this.baseGoodsTemplateService.queryGoodsTemplateByCategoryId(null, categoryId, null, null); |
| | | // 不限制机构 |
| | | List<BaseGoodsTemplate> list = baseGoodsTemplateService.queryGoodsTemplateByCategoryId(null, categoryId, |
| | | StatesType.NORMAL.getValue(), null); |
| | | if (list == null) { |
| | | return ResponseValue.error("查询失败!"); |
| | | } |
| | | return ResponseValue.success("查询成功!", list); |
| | | } |
| | | |
| | | @ApiOperation(value = "查询机构下默认仓库下的分类模板信息", notes = "查询机构下默认仓库下的分类模板信息") |
| | | @ApiOperation(value = "调拨查询机构下所有仓库下的分类模板信息", notes = "调拨查询机构下所有仓库下的分类模板信息") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "agencyId", value = "父级机构id", required = true, dataType = "java.lang.Long", |
| | | paramType = "query"), |
| | |
| | | @GetMapping("/query/warehouse/goods") |
| | | public ResponseValue queryWarehouseGoods(Long agencyId, Long categoryId) { |
| | | |
| | | // TODO 调拨查询仓库物品 |
| | | // 调拨查询所有仓库物品模板信息 |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("categoryId", categoryId); |
| | | |
| | | List<BaseWarehouse> baseWarehouseList = baseWarehouseService.getByAgencyId(agencyId, (short)1, (short)1); |
| | | List<BaseWarehouse> baseWarehouseList = |
| | | baseWarehouseService.getBaseWareHouseList(agencyId, StatesType.NORMAL.getValue()); |
| | | if (CollectionUtils.isEmpty(baseWarehouseList)) { |
| | | return ResponseValue.error("机构无默认仓库!"); |
| | | return ResponseValue.error("机构无仓库!"); |
| | | |
| | | } |
| | | map.put("warehouseId", baseWarehouseList.get(0).getId()); |
| | | List<Long> warehouseIdList = baseWarehouseList.stream().map(BaseWarehouse::getId).collect(Collectors.toList()); |
| | | map.put("warehouseIdList", warehouseIdList); |
| | | |
| | | String sql = |
| | | "SELECT DISTINCT bgt.id,bgt.GOODS_NAME, CLASSIFICATION type FROM l_wh_goods g LEFT JOIN base_goods_template bgt ON g.BASE_GOODS_TEMPLATE_ID = bgt.id " |
| | | + "WHERE WAREHOUSE_TYPE = 0 " + "AND WAREHOUSE_ID = :warehouseId " |
| | | // TODO 临时解决 |
| | | /*+ "AND CATEGORY_ID = :categoryId "*/ |
| | | + "WHERE WAREHOUSE_TYPE = 0 " + "AND WAREHOUSE_ID in (:warehouseIdList) " |
| | | + "AND CATEGORY_ID = :categoryId " |
| | | // 1:集采,2:自采 |
| | | + "AND BUY_TYPE =1"; |
| | | |