MaterialService.java 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  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. boolean insertMaterial(MaterialDTO materialDTO, HttpServletRequest request);
  38. /**
  39. * 修改商品
  40. * @param materialDTO
  41. */
  42. boolean updateMaterial(MaterialDTO materialDTO, HttpServletRequest request);
  43. /**
  44. * 删除商品
  45. * @param id 商品id
  46. */
  47. int deleteMaterial(Long id, HttpServletRequest request)throws Exception;
  48. @Transactional(value = "transactionManager", rollbackFor = Exception.class)
  49. int batchDeleteMaterial(String ids, HttpServletRequest request)throws Exception;
  50. /**
  51. * 根据id集合批量删除商品
  52. * @param ids
  53. */
  54. int batchDeleteMaterialByIds(String ids) throws Exception;
  55. /**
  56. * 检查名称是否存在
  57. */
  58. int checkIsNameExist(Long id, String name)throws Exception;
  59. int checkIsExist(Long id, String name, String model, String color, String standard, String mfrs,
  60. String otherField1, String otherField2, String otherField3, String unit, Long unitId)throws Exception;
  61. /**
  62. * 批量设置状态-启用或者禁用
  63. */
  64. int batchSetStatus(Boolean status, String ids)throws Exception;
  65. Unit findUnit(Long mId)throws Exception;
  66. List<MaterialVo4Unit> findById(Long id)throws Exception;
  67. List<MaterialVo4Unit> findByIdWithBarCode(Long meId)throws Exception;
  68. List<Long> getListByParentId(Long parentId);
  69. List<Long> getIdListByParentId(List<Long> idList, Long parentId);
  70. JSONArray getMaterialByParam(String materialParam);
  71. /**
  72. * 商品选择-查找商品信息
  73. * @param categoryId
  74. * @param q
  75. * @param standardOrModel
  76. * @param color
  77. * @param brand
  78. * @param mfrs
  79. * @param enableSerialNumber
  80. * @param enableBatchNumber
  81. * @param offset
  82. * @param rows
  83. * @param depotId
  84. * @return
  85. * @throws Exception
  86. */
  87. List<MaterialVo4Unit> findBySelectWithBarCode(Long categoryId, String q, String standardOrModel, String color,
  88. String brand, String mfrs, String enableSerialNumber, String enableBatchNumber,
  89. Integer offset, Integer rows, Long depotId) throws Exception;
  90. /**
  91. * 商品选择-查找商品信息 按sku分类
  92. * @param offset
  93. * @param rows
  94. * @return
  95. * @throws Exception
  96. */
  97. List<MaterialVo4Unit> findBySelectWithSku(Long categoryId, String q, String standardOrModel, String color,
  98. String brand, String mfrs, String enableSerialNumber, String enableBatchNumber,
  99. Integer offset, Integer rows, Long depotId) throws Exception;
  100. int findBySelectWithBarCodeCount(Long categoryId, String q, String standardOrModel, String color,
  101. String brand, String mfrs, String enableSerialNumber, String enableBatchNumber, Long depotId) throws Exception;
  102. /**
  103. * 商品选择-查找商品数量 按sku分类
  104. */
  105. int findBySelectWithSkuCount(Long categoryId, String q, String standardOrModel, String color,
  106. String brand, String mfrs, String enableSerialNumber, String enableBatchNumber, Long depotId) throws Exception;
  107. void exportExcel(String categoryId, String materialParam, String color, String materialOther, String weight,
  108. String expiryNum, String enabled, String enableSerialNumber, String enableBatchNumber,
  109. String remark, HttpServletResponse response)throws Exception;
  110. @Transactional(value = "transactionManager", rollbackFor = Exception.class)
  111. BaseResponseInfo importExcel(MultipartFile file, HttpServletRequest request) throws Exception;
  112. void batchCheckExistMaterialListByParam(List<MaterialWithInitStock> mList, String name, String standard,
  113. String model, String color, String unit, String sku);
  114. void batchCheckExistBarCodeByParam(List<MaterialWithInitStock> mList,
  115. String barCode, String manyBarCode) throws Exception;
  116. @Transactional(value = "transactionManager", rollbackFor = Exception.class)
  117. void insertOrUpdateMaterialExtend(JSONObject materialExObj, String type, String defaultFlag, Long mId, User user) throws Exception;
  118. String getBasicBarCode(MaterialWithInitStock m);
  119. List<Material> getMaterialListByParam(String name, String standard, String model, String color, String unit, Long unitId, String basicBarCode) throws Exception;
  120. @Transactional(value = "transactionManager", rollbackFor = Exception.class)
  121. void insertCurrentStockByMaterialAndDepot(Long depotId, Long mId, BigDecimal stock);
  122. @Transactional(value = "transactionManager", rollbackFor = Exception.class)
  123. void batchDeleteInitialStockByMaterialList(List<Long> mIdList);
  124. @Transactional(value = "transactionManager", rollbackFor = Exception.class)
  125. void batchDeleteCurrentStockByMaterialList(List<Long> mIdList);
  126. List<MaterialVo4Unit> getMaterialEnableSerialNumberList(String q, Integer offset, Integer rows)throws Exception;
  127. Long getMaterialEnableSerialNumberCount(String q)throws Exception;
  128. BigDecimal parseBigDecimalEx(String str) throws Exception;
  129. BigDecimal parsePrice(String price, String ratio) throws Exception;
  130. BigDecimal getInitStockByMidAndDepotList(List<Long> depotList, Long materialId);
  131. BigDecimal getInitStock(Long materialId, Long depotId);
  132. BigDecimal getCurrentStockByMaterialIdAndDepotId(Long materialId, Long depotId);
  133. Map<Long,BigDecimal> getInitialStockMapByMaterialList(List<MaterialVo4Unit> list);
  134. Map<Long,BigDecimal> getCurrentStockMapByMaterialList(List<MaterialVo4Unit> list);
  135. /**
  136. * 根据商品和仓库获取安全库存信息
  137. * @param materialId 商品id
  138. * @param depotId 仓库id
  139. * @return
  140. */
  141. MaterialInitialStock getSafeStock(Long materialId, Long depotId);
  142. List<MaterialVo4Unit> getMaterialByMeId(Long meId);
  143. String getMaxBarCode();
  144. List<String> getMaterialNameList();
  145. List<MaterialVo4Unit> getMaterialByBarCode(String barCode);
  146. /**
  147. * 根据sku查询商品信息
  148. * @param sku 商品sku
  149. */
  150. List<MaterialVo4Unit> getMaterialBySku(String sku);
  151. List<MaterialVo4Unit> getMaterialByBarCode(List<String> barCodeList);
  152. List<MaterialVo4Unit> getMaterialByBarCodeAndWithOutMId(String barCode, Long mId);
  153. List<MaterialInitialStockWithMaterial> getInitialStockWithMaterial(List<Long> depotList);
  154. List<MaterialVo4Unit> getListWithStock(List<Long> depotList, List<Long> idList, String position, String materialParam,
  155. Boolean moveAvgPriceFlag, Integer zeroStock, String column, String order,
  156. Integer offset, Integer rows) throws Exception;
  157. int getListWithStockCount(List<Long> depotList, List<Long> idList, String position, String materialParam, Integer zeroStock);
  158. MaterialVo4Unit getTotalStockAndPrice(List<Long> depotList, List<Long> idList, String position, String materialParam);
  159. String getBigUnitStock(BigDecimal stock, Long unitId) throws Exception;
  160. /**
  161. * 构造扩展信息
  162. */
  163. String getMaterialOtherByParam(String[] mpArr, MaterialVo4Unit m);
  164. @Transactional(value = "transactionManager", rollbackFor = Exception.class)
  165. int batchSetMaterialCurrentStock(String ids) throws Exception;
  166. @Transactional(value = "transactionManager", rollbackFor = Exception.class)
  167. int batchSetMaterialCurrentUnitPrice(String ids) throws Exception;
  168. /**
  169. * 批量编辑
  170. * @param jsonObject
  171. */
  172. int batchUpdate(JSONObject jsonObject);
  173. MaterialExtend getMaterialExtendBySerialNumber(String serialNumber);
  174. /**
  175. * 根据商品id查询主表及子表信息
  176. */
  177. Material getMaterialById(Long id);
  178. List<MaterialVo4Unit> getMaterialBySystemSku(List<String> systemSkuList);
  179. List<MaterialCurrentStock4SystemSku> getMaterialCurrentPriceByIdList(List<Long> idList);
  180. /**
  181. * 获取商品提醒
  182. * @return
  183. */
  184. MaterialWarnListVo getMaterialWarn();
  185. /**
  186. * 导入商品信息
  187. * @param file excel表格
  188. * @return
  189. */
  190. BaseResponseInfo importExcelTwo(MultipartFile file, HttpServletRequest request) throws Exception;
  191. /**
  192. * PDA库存查询
  193. * pdaInventoryDTO
  194. * @return
  195. */
  196. List<PDADepotItemVO> inventoryInquiry(PDAInventoryDTO pdaInventoryDTO);
  197. /**
  198. * 根据库位查询商品id集合
  199. * @param position
  200. * @return
  201. */
  202. List<Long> selectMaterialIdByPosition(String position);
  203. /**
  204. * 根据类型id查询子类型集合
  205. * @param id 类型id
  206. * @return
  207. */
  208. List<Long> selectCategoryIds(Long id);
  209. /**
  210. * 查询库位树
  211. */
  212. List<PDATypeTree> selectPosition(Long depotId);
  213. /**
  214. * 获取仓库id、商品id获取商品库位信息
  215. * @param did 仓库id
  216. * @param mid 商品id
  217. * @return 库位
  218. */
  219. String getPositionByDidAndMid(Long did, Long mid);
  220. /**
  221. * 根据商品id查询商品库存
  222. * @param mid 商品id
  223. * @return 商品库存
  224. */
  225. BigDecimal getMaterialStockByMid(Long mid);
  226. /**
  227. * 根据商品id和仓库id查询商品当前库存
  228. * @param mid 商品id
  229. * @param did 仓库id
  230. * @return 商品库存
  231. */
  232. BigDecimal getMaterialStockByMidAndDid(Long mid,Long did);
  233. }