| | |
| | | |
| | | import com.consum.base.core.CodeGeneratorEnum; |
| | | import com.consum.base.core.CodeGeneratorService; |
| | | import com.consum.base.core.utils.MapRowMapper; |
| | | import com.consum.base.pojo.*; |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.model.po.*; |
| | | import com.consum.base.core.utils.MapRowMapper; |
| | | import com.consum.base.pojo.LWhFormScrappedExtend; |
| | | import com.consum.base.pojo.LWhFormScrappedGoodsParams; |
| | | import com.consum.base.pojo.LWhFormScrappedParam; |
| | | import com.consum.model.po.BaseGoodsModels; |
| | | import com.consum.model.po.BaseGoodsTemplate; |
| | | import com.consum.model.po.BaseWarehouse; |
| | | import com.consum.model.po.FinSysTenantDepartment; |
| | | import com.consum.model.po.FinSysTenantUser; |
| | | import com.consum.model.po.LWhFormScrapped; |
| | | import com.consum.model.po.LWhFormScrappedGoods; |
| | | import com.consum.model.po.SDictData; |
| | | 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 org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | /** |
| | | * @Description 报废单 |
| | |
| | | */ |
| | | @Service |
| | | public class LWhFormScrappedServiceImpl extends BaseServiceImpl { |
| | | |
| | | @Autowired |
| | | private CodeGeneratorService codeGeneratorService; |
| | | @Autowired |
| | |
| | | private static String QUERY_LIST = "SELECT * FROM l_wh_form_scrapped WHERE 1 = 1"; |
| | | |
| | | private static final String QUERY_BF_DETAIL_LIST = "select lwfs.BUSINESS_FORM_CODE,\n" + |
| | | " lwfsg.GOODS_TEMPLATE_NAME,\n" + |
| | | " lwfsg.BASE_GOODS_MODELS_NAME,\n" + |
| | | " lwfsg.COUNTS,\n" + |
| | | " lwfs.AGENCY_NAME,\n" + |
| | | " lwfs,OPERATOR_NAME,\n" + |
| | | " lwfs,DEAL_TIME\n" + |
| | | "from l_wh_form_scrapped lwfs\n" + |
| | | " inner join l_wh_form_scrapped_goods lwfsg on lwfs.ID = lwfsg.FORM_SCRAPPED_ID "; |
| | | " lwfsg.GOODS_TEMPLATE_NAME,\n" + |
| | | " lwfsg.BASE_GOODS_MODELS_NAME,\n" + |
| | | " lwfsg.COUNTS,\n" + |
| | | " lwfs.AGENCY_NAME,\n" + |
| | | " lwfs,OPERATOR_NAME,\n" + |
| | | " lwfs,DEAL_TIME\n" + |
| | | "from l_wh_form_scrapped lwfs\n" + |
| | | " inner join l_wh_form_scrapped_goods lwfsg on lwfs.ID = lwfsg.FORM_SCRAPPED_ID "; |
| | | |
| | | /** |
| | | * 新增 |
| | | * |
| | | * @param param |
| | | * @param currentUser 当前登录用户 |
| | | * @param sysInfo 当前登录用户 |
| | | * @param currentUser 当前登录用户 |
| | | * @param sysInfo 当前登录用户 |
| | | * @return |
| | | */ |
| | | //1.新增报废单 |
| | |
| | | //获取报废原因code |
| | | List<String> scrappedCodeList = scrappedGoodsParamList.stream().map(params -> params.getScrappedCode()).collect(Collectors.toList()); |
| | | //根据报废原因code查询数据字典 |
| | | List<S_dict_data> s_dict_dataList = this.sDictDataService.selectByScrappedCodeList(scrappedCodeList); |
| | | Map<Long, String> scrappedNameMap = s_dict_dataList.stream().collect(Collectors.toMap(s -> s.getDict_code(), s -> s.getDict_label())); |
| | | List<SDictData> SDictDataList = this.sDictDataService.selectByScrappedCodeList(scrappedCodeList); |
| | | Map<Long, String> scrappedNameMap = SDictDataList.stream().collect(Collectors.toMap(s -> s.getDict_code(), s -> s.getDict_label())); |
| | | |
| | | List<LWhFormScrappedGoods> scrappedGoodsList = new ArrayList<>(); |
| | | for (LWhFormScrappedGoodsParams params : scrappedGoodsParamList) { |
| | | LWhFormScrappedGoods scrappedGoods = new LWhFormScrappedGoods(); |
| | | scrappedGoods.setId(IdUtil.generateId()); |
| | | //根据物品型号查询物品库存 |
| | | int goodsNum = this.lWhGoodsService.queryGoodsModelNum(0, warehouseId, scrappedGoods.getBaseGoodsModelsId(), (short) 1, null); |
| | | int goodsNum = this.lWhGoodsService.queryGoodsModelNum(0, warehouseId, scrappedGoods.getBaseGoodsModelsId(), 1, null); |
| | | if (params.getCounts() > goodsNum) { |
| | | log.error("报废数量大于库存数量"); |
| | | return 0; |
| | |
| | | } |
| | | |
| | | /** |
| | | * @Description 列表查询 |
| | | * @Description 列表查询 |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/11/2 |
| | | */ |
| | |
| | | } |
| | | //物品名称 |
| | | if (!StringUtils.isEmpty(param.getGoodsTemplateName())) { |
| | | sql.append(" AND id IN (SELECT BUSINESS_ID FROM L_WH_PROCURE_MODEL procureModel LEFT JOIN BASE_GOODS_MODELS baseModel ON procureModel.BASE_GOODS_MODELS_ID=baseModel.ID LEFT JOIN BASE_GOODS_TEMPLATE baseTemp ON baseModel.GOODS_TEMPLATES_ID=baseTemp.id WHERE procureModel.BUSINESS_TYPE=1 AND baseTemp.GOODS_NAME LIKE :goodsTemplateName)"); |
| | | sql.append( |
| | | " AND id IN (SELECT BUSINESS_ID FROM L_WH_PROCURE_MODEL procureModel LEFT JOIN BASE_GOODS_MODELS baseModel ON procureModel.BASE_GOODS_MODELS_ID=baseModel.ID LEFT JOIN BASE_GOODS_TEMPLATE baseTemp ON baseModel.GOODS_TEMPLATES_ID=baseTemp.id WHERE procureModel.BUSINESS_TYPE=1 AND baseTemp.GOODS_NAME LIKE :goodsTemplateName)"); |
| | | paramts.put("goodsTemplateName", StringUtils.CHAR_PERCENT + param.getGoodsTemplateName() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | //机构 |
| | | sql.append(" and AGENCY_ID like :agencyId "); |
| | | if (param.getAgencyId() != null){ |
| | | paramts.put("agencyId", param.getAgencyId() + StringUtils.CHAR_PERCENT); |
| | | if (param.getAgencyId() != null) { |
| | | paramts.put("agencyId", param.getAgencyId() + StringUtils.CHAR_PERCENT); |
| | | } else { |
| | | paramts.put("agencyId", sysInfo.getTenantId() + StringUtils.CHAR_PERCENT); |
| | | paramts.put("agencyId", sysInfo.getTenantId() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | //报废时间 |
| | | if (param.getDealTimeStart() != null) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * @Description 根据id查询详情 |
| | | * @Description 根据id查询详情 |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/11/2 |
| | | */ |
| | |
| | | //1.查询报废单 |
| | | LWhFormScrapped lWhFormScrapped = this.get(new LWhFormScrapped(id)); |
| | | if (lWhFormScrapped != null) { |
| | | BeanUtils.copyProperties(lWhFormScrapped,scrappedExtend); |
| | | BeanUtils.copyProperties(lWhFormScrapped, scrappedExtend); |
| | | } |
| | | //2.查询报废单 |
| | | List<LWhFormScrappedGoods> scrappedGoodsList = this.scrappedGoodsService.getByFormScrappedId(id); |
| | |
| | | |
| | | /** |
| | | * 报废明细 |
| | | * |
| | | * @param param |
| | | * @return |
| | | */ |
| | |
| | | |
| | | |
| | | /** |
| | | * @Description 导出报废登记单 |
| | | * @Description 导出报废登记单 |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/11/2 |
| | | */ |
| | |
| | | if (lWhFormScrapped != null) { |
| | | lWhFormScrapped.setDealTime(DateUtils.getDateTimeNumber(System.currentTimeMillis())); |
| | | lWhFormScrapped.setOperatorName(sysInfo.getUserName()); |
| | | BeanUtils.copyProperties(lWhFormScrapped,scrappedExtend); |
| | | BeanUtils.copyProperties(lWhFormScrapped, scrappedExtend); |
| | | } |
| | | //2.查询报废单物品 |
| | | List<LWhFormScrappedGoods> scrappedGoodsList = this.scrappedGoodsService.getByFormScrappedId(id); |