| | |
| | | import com.consum.base.Constants; |
| | | import com.consum.base.core.CodeGeneratorService; |
| | | import com.consum.base.pojo.BaseGoodsTemplateParam; |
| | | import com.consum.base.util.IdUtil; |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.model.po.BaseCategory; |
| | | import com.consum.model.po.BaseGoodsModels; |
| | | import com.consum.model.po.BaseGoodsTemplate; |
| | | import com.consum.model.po.SDictData; |
| | | import com.consum.model.vo.BaseGoodsTemplateVo; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.db.page.GenericPager; |
| | | import com.walker.infrastructure.utils.DateUtils; |
| | | import com.walker.infrastructure.utils.StringUtils; |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | 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); |
| | |
| | | //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.修改规格型号的单位 |
| | | // TODO id 物品型号修改待整理 |
| | | List<BaseGoodsModels> modelsList = param.getModels(); |
| | | for (BaseGoodsModels baseGoodsModel : modelsList) { |
| | | BaseGoodsModels baseGoodsModels = new BaseGoodsModels(); |
| | | BeanUtils.copyProperties(baseGoodsModel, baseGoodsModels); |
| | | } |
| | | int flag2 = this.update(modelsList); |
| | | |
| | | if (flag1 > 0 && flag2 > 0) { |
| | |
| | | * @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 FROM BASE_GOODS_MODELS model LEFT JOIN BASE_GOODS_TEMPLATE temp ON model.GOODS_TEMPLATES_ID=temp.id WHERE 1=1 "; |
| | | 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); |
| | |
| | | |
| | | /** |
| | | * 修改状态 |
| | | * |
| | | * @author 卢庆阳 |
| | | * @date 2023/10/25 |
| | | */ |
| | |
| | | goodsTemplate.setDUserName(currentUser.getUser_name()); |
| | | return this.update(goodsTemplate); |
| | | } |
| | | |
| | | /** |
| | | * @return |
| | | * @Description 查询仓库类型(数据字典) |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/30 |
| | | */ |
| | | public List<SDictData> 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 SDictData()); |
| | | } |
| | | |
| | | /** |
| | | * @Description 根据分类id查询物品模板 |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/30 |
| | | */ |
| | | public List<BaseGoodsTemplate> queryByCategoryId(Long categoryId) { |
| | | BaseGoodsTemplate goodsTemplate = new BaseGoodsTemplate(); |
| | | goodsTemplate.setCategoryId(categoryId); |
| | | return this.select(goodsTemplate); |
| | | } |
| | | |
| | | public List<BaseGoodsTemplate> queryGoodsTemplateByCategoryId(Long agencyId, Long categoryId) { |
| | | StringBuilder sql = new StringBuilder("SELECT * FROM base_goods_template WHERE 1=1 "); |
| | | Map<String, Object> params = new HashMap<>(); |
| | | if (agencyId != null) { |
| | | sql.append("AND AGENCY_ID=:agencyId"); |
| | | params.put("agencyId", agencyId); |
| | | } |
| | | if (categoryId != null) { |
| | | sql.append("AND CATEGORY_ID=:categoryId"); |
| | | params.put("categoryId", categoryId); |
| | | } |
| | | return this.select(sql.toString(), params, new BaseGoodsTemplate()); |
| | | } |
| | | } |