MaterialService.java 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. package com.jsh.erp.service;
  2. import com.alibaba.fastjson.JSONArray;
  3. import com.alibaba.fastjson.JSONObject;
  4. import com.baomidou.mybatisplus.extension.service.IService;
  5. import com.jsh.erp.datasource.dto.MaterialDTO;
  6. import com.jsh.erp.datasource.dto.MaterialQueryDTO;
  7. import com.jsh.erp.datasource.entities.*;
  8. import com.jsh.erp.datasource.pda.dto.PDAInventoryDTO;
  9. import com.jsh.erp.datasource.pda.vo.PDADepotItemVO;
  10. import com.jsh.erp.datasource.vo.MaterialAndExtendVo;
  11. import com.jsh.erp.datasource.vo.MaterialCurrentStock4SystemSku;
  12. import com.jsh.erp.datasource.pda.vo.PDATypeTree;
  13. import com.jsh.erp.datasource.vo.MaterialWarnListVo;
  14. import com.jsh.erp.utils.BaseResponseInfo;
  15. import org.springframework.transaction.annotation.Transactional;
  16. import org.springframework.web.multipart.MultipartFile;
  17. import javax.servlet.http.HttpServletRequest;
  18. import javax.servlet.http.HttpServletResponse;
  19. import java.math.BigDecimal;
  20. import java.util.List;
  21. import java.util.Map;
  22. public interface MaterialService extends IService<Material> {
  23. Material getMaterial(long id)throws Exception;
  24. List<Material> getMaterialListByIds(String ids)throws Exception;
  25. List<Material> getMaterial() throws Exception;
  26. /**
  27. * 查询商品管理-商品信息列表查询
  28. */
  29. List<MaterialVo4Unit> select(String materialParam, String standard, String model, String color, String brand,
  30. String materialOther, String weight, String expiryNum, String enableSerialNumber,
  31. String enabled, String remark, String categoryId,
  32. String mpList, String reminder);
  33. /**
  34. * 新增商品
  35. * @param materialDTO
  36. */
  37. @Transactional(value = "transactionManager", rollbackFor = Exception.class)
  38. boolean insertMaterial(MaterialDTO materialDTO, HttpServletRequest request);
  39. /**
  40. * 修改商品
  41. * @param materialDTO
  42. */
  43. @Transactional(value = "transactionManager", rollbackFor = Exception.class)
  44. boolean updateMaterial(MaterialDTO materialDTO, HttpServletRequest request);
  45. /**
  46. * 删除商品
  47. * @param id 商品id
  48. */
  49. @Transactional(value = "transactionManager", rollbackFor = Exception.class)
  50. int deleteMaterial(Long id, HttpServletRequest request)throws Exception;
  51. @Transactional(value = "transactionManager", rollbackFor = Exception.class)
  52. int batchDeleteMaterial(String ids, HttpServletRequest request)throws Exception;
  53. @Transactional(value = "transactionManager", rollbackFor = Exception.class)
  54. int batchDeleteMaterialByIds(String ids) throws Exception;
  55. int checkIsNameExist(Long id, String name)throws Exception;
  56. int checkIsExist(Long id, String name, String model, String color, String standard, String mfrs,
  57. String otherField1, String otherField2, String otherField3, String unit, Long unitId)throws Exception;
  58. @Transactional(value = "transactionManager", rollbackFor = Exception.class)
  59. int batchSetStatus(Boolean status, String ids)throws Exception;
  60. Unit findUnit(Long mId)throws Exception;
  61. List<MaterialVo4Unit> findById(Long id)throws Exception;
  62. List<MaterialVo4Unit> findByIdWithBarCode(Long meId)throws Exception;
  63. List<Long> getListByParentId(Long parentId);
  64. List<Long> getIdListByParentId(List<Long> idList, Long parentId);
  65. JSONArray getMaterialByParam(String materialParam);
  66. /**
  67. * 商品选择-查找商品信息
  68. * @param categoryId
  69. * @param q
  70. * @param standardOrModel
  71. * @param color
  72. * @param brand
  73. * @param mfrs
  74. * @param enableSerialNumber
  75. * @param enableBatchNumber
  76. * @param offset
  77. * @param rows
  78. * @param depotId
  79. * @return
  80. * @throws Exception
  81. */
  82. List<MaterialVo4Unit> findBySelectWithBarCode(Long categoryId, String q, String standardOrModel, String color,
  83. String brand, String mfrs, String enableSerialNumber, String enableBatchNumber,
  84. Integer offset, Integer rows, Long depotId) throws Exception;
  85. /**
  86. * 商品选择-查找商品信息
  87. * @param offset
  88. * @param rows
  89. * @return
  90. * @throws Exception
  91. */
  92. List<MaterialVo4Unit> findBySelectWithBarCode(MaterialQueryDTO materialQueryDTO, Integer offset, Integer rows) throws Exception;
  93. int findBySelectWithBarCodeCount(Long categoryId, String q, String standardOrModel, String color,
  94. String brand, String mfrs, String enableSerialNumber, String enableBatchNumber, Long depotId) throws Exception;
  95. void exportExcel(String categoryId, String materialParam, String color, String materialOther, String weight,
  96. String expiryNum, String enabled, String enableSerialNumber, String enableBatchNumber,
  97. String remark, HttpServletResponse response)throws Exception;
  98. @Transactional(value = "transactionManager", rollbackFor = Exception.class)
  99. BaseResponseInfo importExcel(MultipartFile file, HttpServletRequest request) throws Exception;
  100. void batchCheckExistMaterialListByParam(List<MaterialWithInitStock> mList, String name, String standard,
  101. String model, String color, String unit, String sku);
  102. void batchCheckExistBarCodeByParam(List<MaterialWithInitStock> mList,
  103. String barCode, String manyBarCode) throws Exception;
  104. @Transactional(value = "transactionManager", rollbackFor = Exception.class)
  105. void insertOrUpdateMaterialExtend(JSONObject materialExObj, String type, String defaultFlag, Long mId, User user) throws Exception;
  106. String getBasicBarCode(MaterialWithInitStock m);
  107. List<Material> getMaterialListByParam(String name, String standard, String model, String color, String unit, Long unitId, String basicBarCode) throws Exception;
  108. @Transactional(value = "transactionManager", rollbackFor = Exception.class)
  109. void insertCurrentStockByMaterialAndDepot(Long depotId, Long mId, BigDecimal stock);
  110. @Transactional(value = "transactionManager", rollbackFor = Exception.class)
  111. void batchDeleteInitialStockByMaterialList(List<Long> mIdList);
  112. @Transactional(value = "transactionManager", rollbackFor = Exception.class)
  113. void batchDeleteCurrentStockByMaterialList(List<Long> mIdList);
  114. List<MaterialVo4Unit> getMaterialEnableSerialNumberList(String q, Integer offset, Integer rows)throws Exception;
  115. Long getMaterialEnableSerialNumberCount(String q)throws Exception;
  116. BigDecimal parseBigDecimalEx(String str) throws Exception;
  117. BigDecimal parsePrice(String price, String ratio) throws Exception;
  118. BigDecimal getInitStockByMidAndDepotList(List<Long> depotList, Long materialId);
  119. BigDecimal getInitStock(Long materialId, Long depotId);
  120. BigDecimal getCurrentStockByMaterialIdAndDepotId(Long materialId, Long depotId);
  121. Map<Long,BigDecimal> getInitialStockMapByMaterialList(List<MaterialVo4Unit> list);
  122. Map<Long,BigDecimal> getCurrentStockMapByMaterialList(List<MaterialVo4Unit> list);
  123. /**
  124. * 根据商品和仓库获取安全库存信息
  125. * @param materialId 商品id
  126. * @param depotId 仓库id
  127. * @return
  128. */
  129. MaterialInitialStock getSafeStock(Long materialId, Long depotId);
  130. List<MaterialVo4Unit> getMaterialByMeId(Long meId);
  131. String getMaxBarCode();
  132. List<String> getMaterialNameList();
  133. /**
  134. * 根据sku查询商品信息
  135. * @param barCode 商品sku
  136. */
  137. List<MaterialVo4Unit> getMaterialByBarCode(String barCode);
  138. List<MaterialVo4Unit> getMaterialByBarCode(List<String> barCodeList);
  139. List<MaterialVo4Unit> getMaterialByBarCodeAndWithOutMId(String barCode, Long mId);
  140. List<MaterialInitialStockWithMaterial> getInitialStockWithMaterial(List<Long> depotList);
  141. List<MaterialVo4Unit> getListWithStock(List<Long> depotList, List<Long> idList, String position, String materialParam,
  142. Boolean moveAvgPriceFlag, Integer zeroStock, String column, String order,
  143. Integer offset, Integer rows) throws Exception;
  144. int getListWithStockCount(List<Long> depotList, List<Long> idList, String position, String materialParam, Integer zeroStock);
  145. MaterialVo4Unit getTotalStockAndPrice(List<Long> depotList, List<Long> idList, String position, String materialParam);
  146. String getBigUnitStock(BigDecimal stock, Long unitId) throws Exception;
  147. /**
  148. * 构造扩展信息
  149. */
  150. String getMaterialOtherByParam(String[] mpArr, MaterialVo4Unit m);
  151. @Transactional(value = "transactionManager", rollbackFor = Exception.class)
  152. int batchSetMaterialCurrentStock(String ids) throws Exception;
  153. @Transactional(value = "transactionManager", rollbackFor = Exception.class)
  154. int batchSetMaterialCurrentUnitPrice(String ids) throws Exception;
  155. int batchUpdate(JSONObject jsonObject);
  156. MaterialExtend getMaterialExtendBySerialNumber(String serialNumber);
  157. /**
  158. * 根据商品id查询主表及子表信息
  159. */
  160. Material getMaterialById(Long id);
  161. List<MaterialVo4Unit> getMaterialBySystemSku(List<String> systemSkuList);
  162. List<MaterialCurrentStock4SystemSku> getMaterialCurrentPriceByIdList(List<Long> idList);
  163. /**
  164. * 获取商品提醒
  165. * @return
  166. */
  167. MaterialWarnListVo getMaterialWarn();
  168. /**
  169. * 导入商品信息
  170. * @param file excel表格
  171. * @return
  172. */
  173. BaseResponseInfo importExcelTwo(MultipartFile file, HttpServletRequest request) throws Exception;
  174. /**
  175. * PDA库存查询
  176. * pdaInventoryDTO
  177. * @return
  178. */
  179. List<PDADepotItemVO> inventoryInquiry(PDAInventoryDTO pdaInventoryDTO);
  180. /**
  181. * 根据库位查询商品id集合
  182. * @param position
  183. * @return
  184. */
  185. List<Long> selectMaterialIdByPosition(String position);
  186. /**
  187. * 根据类型id查询子类型集合
  188. * @param id 类型id
  189. * @return
  190. */
  191. List<Long> selectCategoryIds(Long id);
  192. /**
  193. * 查询库位树
  194. */
  195. List<PDATypeTree> selectPosition(Long depotId);
  196. /**
  197. * 获取仓库id、商品id获取商品库位信息
  198. * @param did 仓库id
  199. * @param mid 商品id
  200. * @return 库位
  201. */
  202. String getPositionByDidAndMid(Long did, Long mid);
  203. /**
  204. * 根据商品id查询商品库存
  205. * @param mid 商品id
  206. * @return 商品库存
  207. */
  208. BigDecimal getMaterialStockByMid(Long mid);
  209. /**
  210. * 根据商品id和仓库id查询商品当前库存
  211. * @param mid 商品id
  212. * @param did 仓库id
  213. * @return 商品库存
  214. */
  215. BigDecimal getMaterialStockByMidAndDid(Long mid,Long did);
  216. }