| | |
| | | import com.consum.model.po.BaseCategory; |
| | | import com.consum.model.po.BaseGoodsModels; |
| | | import com.consum.model.po.BaseGoodsTemplate; |
| | | import com.consum.model.po.S_dict_data; |
| | | import com.consum.model.vo.BaseGoodsTemplateVo; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.db.page.GenericPager; |
| | |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Description 物品模板 |
| | |
| | | //根据分类id查询分类 |
| | | BaseCategory baseCategory = this.baseCategoryService.get(new BaseCategory(param.getCategoryId())); |
| | | if (baseCategory != null) { |
| | | baseGoodsTemplate.setCategoryName(baseCategory.getCategoryName()); |
| | | String classification = baseCategory.getClassification(); |
| | | //物品编码 |
| | | String goodsCode = codeGeneratorService.createGoodsTemplateCode(classification); |
| | |
| | | } |
| | | |
| | | /** |
| | | * @Description 物品模板列表查询 |
| | | * @Description 物品模板列表查询 |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/24 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据物品id查询物品详情 |
| | | * |
| | | * @author 卢庆阳 |
| | | * @date 2023/9/26 |
| | | */ |
| | |
| | | //3.封装 |
| | | BaseGoodsTemplateVo vo = new BaseGoodsTemplateVo(); |
| | | if (goodsTemplate != null) { |
| | | BeanUtils.copyProperties(goodsTemplate,vo); |
| | | BeanUtils.copyProperties(goodsTemplate, vo); |
| | | } |
| | | if (!CollectionUtils.isEmpty(modelsList)) { |
| | | vo.setModels(modelsList); |
| | |
| | | //1.修改物品模板 |
| | | BaseGoodsTemplate baseGoodsTemplate = new BaseGoodsTemplate(); |
| | | BeanUtils.copyProperties(param, baseGoodsTemplate); |
| | | BaseCategory baseCategory = this.baseCategoryService.get(new BaseCategory(param.getCategoryId())); |
| | | if (baseCategory != null) { |
| | | baseGoodsTemplate.setCategoryName(baseCategory.getCategoryName()); |
| | | } |
| | | int flag1 = this.update(baseGoodsTemplate); |
| | | //2.修改规格型号的单位 |
| | | List<BaseGoodsModels> modelsList = param.getModels(); |
| | |
| | | } |
| | | |
| | | /** |
| | | * @Description 根据物品名称和分类id查询物品 |
| | | * @Description 根据物品名称和分类id查询物品 |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/24 |
| | | */ |
| | |
| | | |
| | | return this.get(sql.toString(), paramts, new BaseGoodsTemplate()); |
| | | } |
| | | |
| | | /** |
| | | * 根据型号ID查询物品信息 |
| | | * |
| | | * @param modelId |
| | | * @return |
| | | */ |
| | | private static String QUERY_GOODSINFO_BY_MODELID = "SELECT model.MODEL_NAME modelName,model.UNIT,temp.id goodsId, temp.GOODS_CODE goodsCode,temp.GOODS_NAME goodsName,temp.CLASSIFICATION classification,temp.CATEGORY_ID categoryId FROM BASE_GOODS_MODELS model LEFT JOIN BASE_GOODS_TEMPLATE temp ON model.GOODS_TEMPLATES_ID=temp.id WHERE 1=1 "; |
| | | |
| | | public Map<String, Object> queryGoodsInfoByModelId(Long modelId) { |
| | | StringBuilder sqlStr = new StringBuilder(QUERY_GOODSINFO_BY_MODELID); |
| | | Map<String, Object> params = new HashMap<>(); |
| | | if (modelId != null) { |
| | | sqlStr.append(" AND model.id=:modelId"); |
| | | params.put("modelId", modelId); |
| | | } |
| | | List<Map<String, Object>> tempGoodsInfo = this.select(sqlStr.toString(), params); |
| | | if (CollectionUtils.isEmpty(tempGoodsInfo)) { |
| | | return null; |
| | | } |
| | | return tempGoodsInfo.get(0); |
| | | } |
| | | |
| | | /** |
| | | * 修改状态 |
| | | * @author 卢庆阳 |
| | | * @date 2023/10/25 |
| | | */ |
| | | public int updateStatus(BaseGoodsTemplate goodsTemplate) { |
| | | return this.update(goodsTemplate); |
| | | } |
| | | |
| | | /** |
| | | * @Description 根据物品id删除物品 |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/25 |
| | | */ |
| | | public int updateById(BaseGoodsTemplate goodsTemplate, S_user_core currentUser) { |
| | | goodsTemplate.setStates(Constants.STATES_DELETED); |
| | | //删除时间 |
| | | goodsTemplate.setDTime(DateUtils.getDateTimeNumber(System.currentTimeMillis())); |
| | | //删除人id和删除人姓名 |
| | | goodsTemplate.setDUserId(currentUser.getId()); |
| | | goodsTemplate.setDUserName(currentUser.getUser_name()); |
| | | return this.update(goodsTemplate); |
| | | } |
| | | |
| | | /** |
| | | * @Description 查询仓库类型(数据字典) |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/30 |
| | | * @return |
| | | */ |
| | | public List<S_dict_data> queryClassificationCode() { |
| | | StringBuilder sql = new StringBuilder("SELECT * FROM s_dict_data WHERE dict_type = 'CLASSIFICATION_CODE' order by dict_sort"); |
| | | return this.select(sql.toString(), new Object[]{}, new S_dict_data()); |
| | | } |
| | | } |