|
@@ -6,7 +6,6 @@ import com.jsh.erp.base.AjaxResult;
|
|
import com.jsh.erp.base.BaseController;
|
|
import com.jsh.erp.base.BaseController;
|
|
import com.jsh.erp.base.TableDataInfo;
|
|
import com.jsh.erp.base.TableDataInfo;
|
|
import com.jsh.erp.datasource.dto.MaterialDTO;
|
|
import com.jsh.erp.datasource.dto.MaterialDTO;
|
|
-import com.jsh.erp.datasource.dto.MaterialQueryDTO;
|
|
|
|
import com.jsh.erp.datasource.entities.*;
|
|
import com.jsh.erp.datasource.entities.*;
|
|
import com.jsh.erp.datasource.vo.TaskStocktakingItemVO;
|
|
import com.jsh.erp.datasource.vo.TaskStocktakingItemVO;
|
|
import com.jsh.erp.service.*;
|
|
import com.jsh.erp.service.*;
|
|
@@ -61,16 +60,15 @@ public class MaterialController extends BaseController {
|
|
@Resource
|
|
@Resource
|
|
private MaterialUnitService materialUnitService;
|
|
private MaterialUnitService materialUnitService;
|
|
|
|
|
|
- @Value(value="${file.uploadType}")
|
|
|
|
|
|
+ @Value(value = "${file.uploadType}")
|
|
private Long fileUploadType;
|
|
private Long fileUploadType;
|
|
|
|
|
|
@GetMapping(value = "/info")
|
|
@GetMapping(value = "/info")
|
|
@ApiOperation(value = "根据id获取信息")
|
|
@ApiOperation(value = "根据id获取信息")
|
|
- public String getList(@RequestParam("id") Long id,
|
|
|
|
- HttpServletRequest request) throws Exception {
|
|
|
|
|
|
+ public String getList(@RequestParam("id") Long id) throws Exception {
|
|
Material material = materialService.getMaterial(id);
|
|
Material material = materialService.getMaterial(id);
|
|
Map<String, Object> objectMap = new HashMap<>();
|
|
Map<String, Object> objectMap = new HashMap<>();
|
|
- if(material != null) {
|
|
|
|
|
|
+ if (material != null) {
|
|
objectMap.put("info", material);
|
|
objectMap.put("info", material);
|
|
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
|
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
|
} else {
|
|
} else {
|
|
@@ -103,21 +101,21 @@ public class MaterialController extends BaseController {
|
|
|
|
|
|
@PostMapping(value = "/add")
|
|
@PostMapping(value = "/add")
|
|
@ApiOperation(value = "新增")
|
|
@ApiOperation(value = "新增")
|
|
- public AjaxResult addResource(@RequestBody MaterialDTO materialDTO, HttpServletRequest request)throws Exception {
|
|
|
|
|
|
+ public AjaxResult addResource(@RequestBody MaterialDTO materialDTO, HttpServletRequest request) throws Exception {
|
|
materialService.insertMaterial(materialDTO, request);
|
|
materialService.insertMaterial(materialDTO, request);
|
|
return AjaxResult.success();
|
|
return AjaxResult.success();
|
|
}
|
|
}
|
|
|
|
|
|
@PutMapping(value = "/update")
|
|
@PutMapping(value = "/update")
|
|
@ApiOperation(value = "修改")
|
|
@ApiOperation(value = "修改")
|
|
- public AjaxResult updateResource(@RequestBody MaterialDTO materialDTO, HttpServletRequest request)throws Exception {
|
|
|
|
|
|
+ public AjaxResult updateResource(@RequestBody MaterialDTO materialDTO, HttpServletRequest request) throws Exception {
|
|
materialService.updateMaterial(materialDTO, request);
|
|
materialService.updateMaterial(materialDTO, request);
|
|
- return AjaxResult.success();
|
|
|
|
|
|
+ return AjaxResult.success();
|
|
}
|
|
}
|
|
|
|
|
|
@DeleteMapping(value = "/delete")
|
|
@DeleteMapping(value = "/delete")
|
|
@ApiOperation(value = "删除")
|
|
@ApiOperation(value = "删除")
|
|
- public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
|
|
|
|
|
|
+ public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request) throws Exception {
|
|
Map<String, Object> objectMap = new HashMap<>();
|
|
Map<String, Object> objectMap = new HashMap<>();
|
|
int delete = materialService.deleteMaterial(id, request);
|
|
int delete = materialService.deleteMaterial(id, request);
|
|
return returnStr(objectMap, delete);
|
|
return returnStr(objectMap, delete);
|
|
@@ -125,7 +123,7 @@ public class MaterialController extends BaseController {
|
|
|
|
|
|
@DeleteMapping(value = "/deleteBatch")
|
|
@DeleteMapping(value = "/deleteBatch")
|
|
@ApiOperation(value = "批量删除")
|
|
@ApiOperation(value = "批量删除")
|
|
- public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
|
|
|
|
|
|
+ public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request) throws Exception {
|
|
Map<String, Object> objectMap = new HashMap<>();
|
|
Map<String, Object> objectMap = new HashMap<>();
|
|
int delete = materialService.batchDeleteMaterial(ids, request);
|
|
int delete = materialService.batchDeleteMaterial(ids, request);
|
|
return returnStr(objectMap, delete);
|
|
return returnStr(objectMap, delete);
|
|
@@ -133,11 +131,11 @@ public class MaterialController extends BaseController {
|
|
|
|
|
|
@GetMapping(value = "/checkIsNameExist")
|
|
@GetMapping(value = "/checkIsNameExist")
|
|
@ApiOperation(value = "检查名称是否存在")
|
|
@ApiOperation(value = "检查名称是否存在")
|
|
- public String checkIsNameExist(@RequestParam Long id, @RequestParam(value ="name", required = false) String name,
|
|
|
|
- HttpServletRequest request)throws Exception {
|
|
|
|
|
|
+ public String checkIsNameExist(@RequestParam Long id, @RequestParam(value = "name", required = false) String name,
|
|
|
|
+ HttpServletRequest request) throws Exception {
|
|
Map<String, Object> objectMap = new HashMap<>();
|
|
Map<String, Object> objectMap = new HashMap<>();
|
|
int exist = materialService.checkIsNameExist(id, name);
|
|
int exist = materialService.checkIsNameExist(id, name);
|
|
- if(exist > 0) {
|
|
|
|
|
|
+ if (exist > 0) {
|
|
objectMap.put("status", true);
|
|
objectMap.put("status", true);
|
|
} else {
|
|
} else {
|
|
objectMap.put("status", false);
|
|
objectMap.put("status", false);
|
|
@@ -147,6 +145,7 @@ public class MaterialController extends BaseController {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 检查商品是否存在
|
|
* 检查商品是否存在
|
|
|
|
+ *
|
|
* @param id
|
|
* @param id
|
|
* @param name
|
|
* @param name
|
|
* @param model
|
|
* @param model
|
|
@@ -168,13 +167,13 @@ public class MaterialController extends BaseController {
|
|
@RequestParam("model") String model, @RequestParam("color") String color,
|
|
@RequestParam("model") String model, @RequestParam("color") String color,
|
|
@RequestParam("standard") String standard, @RequestParam("mfrs") String mfrs,
|
|
@RequestParam("standard") String standard, @RequestParam("mfrs") String mfrs,
|
|
@RequestParam("otherField1") String otherField1, @RequestParam("otherField2") String otherField2,
|
|
@RequestParam("otherField1") String otherField1, @RequestParam("otherField2") String otherField2,
|
|
- @RequestParam("otherField3") String otherField3, @RequestParam("unit") String unit,@RequestParam("unitId") Long unitId,
|
|
|
|
- HttpServletRequest request)throws Exception {
|
|
|
|
|
|
+ @RequestParam("otherField3") String otherField3, @RequestParam("unit") String unit, @RequestParam("unitId") Long unitId,
|
|
|
|
+ HttpServletRequest request) throws Exception {
|
|
Map<String, Object> objectMap = new HashMap<String, Object>();
|
|
Map<String, Object> objectMap = new HashMap<String, Object>();
|
|
int exist = materialService.checkIsExist(id, name, StringUtil.toNull(model), StringUtil.toNull(color),
|
|
int exist = materialService.checkIsExist(id, name, StringUtil.toNull(model), StringUtil.toNull(color),
|
|
StringUtil.toNull(standard), StringUtil.toNull(mfrs), StringUtil.toNull(otherField1),
|
|
StringUtil.toNull(standard), StringUtil.toNull(mfrs), StringUtil.toNull(otherField1),
|
|
StringUtil.toNull(otherField2), StringUtil.toNull(otherField3), StringUtil.toNull(unit), unitId);
|
|
StringUtil.toNull(otherField2), StringUtil.toNull(otherField3), StringUtil.toNull(unit), unitId);
|
|
- if(exist > 0) {
|
|
|
|
|
|
+ if (exist > 0) {
|
|
objectMap.put("status", true);
|
|
objectMap.put("status", true);
|
|
} else {
|
|
} else {
|
|
objectMap.put("status", false);
|
|
objectMap.put("status", false);
|
|
@@ -184,6 +183,7 @@ public class MaterialController extends BaseController {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 批量设置状态-启用或者禁用
|
|
* 批量设置状态-启用或者禁用
|
|
|
|
+ *
|
|
* @param jsonObject
|
|
* @param jsonObject
|
|
* @param request
|
|
* @param request
|
|
* @return
|
|
* @return
|
|
@@ -192,12 +192,12 @@ public class MaterialController extends BaseController {
|
|
@PostMapping(value = "/batchSetStatus")
|
|
@PostMapping(value = "/batchSetStatus")
|
|
@ApiOperation(value = "批量设置状态-启用或者禁用")
|
|
@ApiOperation(value = "批量设置状态-启用或者禁用")
|
|
public String batchSetStatus(@RequestBody JSONObject jsonObject,
|
|
public String batchSetStatus(@RequestBody JSONObject jsonObject,
|
|
- HttpServletRequest request)throws Exception {
|
|
|
|
|
|
+ HttpServletRequest request) throws Exception {
|
|
Boolean status = jsonObject.getBoolean("status");
|
|
Boolean status = jsonObject.getBoolean("status");
|
|
String ids = jsonObject.getString("ids");
|
|
String ids = jsonObject.getString("ids");
|
|
Map<String, Object> objectMap = new HashMap<>();
|
|
Map<String, Object> objectMap = new HashMap<>();
|
|
int res = materialService.batchSetStatus(status, ids);
|
|
int res = materialService.batchSetStatus(status, ids);
|
|
- if(res > 0) {
|
|
|
|
|
|
+ if (res > 0) {
|
|
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
|
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
|
} else {
|
|
} else {
|
|
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
|
|
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
|
|
@@ -206,19 +206,20 @@ public class MaterialController extends BaseController {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 根据id来查询商品名称
|
|
* 根据id来查询商品名称
|
|
|
|
+ *
|
|
* @param id
|
|
* @param id
|
|
* @param request
|
|
* @param request
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@GetMapping(value = "/findById")
|
|
@GetMapping(value = "/findById")
|
|
@ApiOperation(value = "根据id来查询商品名称")
|
|
@ApiOperation(value = "根据id来查询商品名称")
|
|
- public BaseResponseInfo findById(@RequestParam("id") Long id, HttpServletRequest request) throws Exception{
|
|
|
|
|
|
+ public BaseResponseInfo findById(@RequestParam("id") Long id, HttpServletRequest request) throws Exception {
|
|
BaseResponseInfo res = new BaseResponseInfo();
|
|
BaseResponseInfo res = new BaseResponseInfo();
|
|
try {
|
|
try {
|
|
List<MaterialVo4Unit> list = materialService.findById(id);
|
|
List<MaterialVo4Unit> list = materialService.findById(id);
|
|
res.code = 200;
|
|
res.code = 200;
|
|
res.data = list;
|
|
res.data = list;
|
|
- } catch(Exception e){
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
logger.error(e.getMessage(), e);
|
|
logger.error(e.getMessage(), e);
|
|
res.code = 500;
|
|
res.code = 500;
|
|
res.data = "获取数据失败";
|
|
res.data = "获取数据失败";
|
|
@@ -228,6 +229,7 @@ public class MaterialController extends BaseController {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 根据meId来查询商品名称
|
|
* 根据meId来查询商品名称
|
|
|
|
+ *
|
|
* @param meId
|
|
* @param meId
|
|
* @param request
|
|
* @param request
|
|
* @return
|
|
* @return
|
|
@@ -236,19 +238,19 @@ public class MaterialController extends BaseController {
|
|
@ApiOperation(value = "根据meId来查询商品名称")
|
|
@ApiOperation(value = "根据meId来查询商品名称")
|
|
public BaseResponseInfo findByIdWithBarCode(@RequestParam("meId") Long meId,
|
|
public BaseResponseInfo findByIdWithBarCode(@RequestParam("meId") Long meId,
|
|
@RequestParam("mpList") String mpList,
|
|
@RequestParam("mpList") String mpList,
|
|
- HttpServletRequest request) throws Exception{
|
|
|
|
|
|
+ HttpServletRequest request) throws Exception {
|
|
BaseResponseInfo res = new BaseResponseInfo();
|
|
BaseResponseInfo res = new BaseResponseInfo();
|
|
try {
|
|
try {
|
|
String[] mpArr = mpList.split(",");
|
|
String[] mpArr = mpList.split(",");
|
|
MaterialVo4Unit mu = new MaterialVo4Unit();
|
|
MaterialVo4Unit mu = new MaterialVo4Unit();
|
|
List<MaterialVo4Unit> list = materialService.findByIdWithBarCode(meId);
|
|
List<MaterialVo4Unit> list = materialService.findByIdWithBarCode(meId);
|
|
- if(list!=null && list.size()>0) {
|
|
|
|
|
|
+ if (list != null && list.size() > 0) {
|
|
mu = list.get(0);
|
|
mu = list.get(0);
|
|
mu.setMaterialOther(materialService.getMaterialOtherByParam(mpArr, mu));
|
|
mu.setMaterialOther(materialService.getMaterialOtherByParam(mpArr, mu));
|
|
}
|
|
}
|
|
res.code = 200;
|
|
res.code = 200;
|
|
res.data = mu;
|
|
res.data = mu;
|
|
- } catch(Exception e){
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
logger.error(e.getMessage(), e);
|
|
logger.error(e.getMessage(), e);
|
|
res.code = 500;
|
|
res.code = 500;
|
|
res.data = "获取数据失败";
|
|
res.data = "获取数据失败";
|
|
@@ -258,6 +260,7 @@ public class MaterialController extends BaseController {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 根据关键词查找商品信息-条码、名称、规格、型号
|
|
* 根据关键词查找商品信息-条码、名称、规格、型号
|
|
|
|
+ *
|
|
* @param q
|
|
* @param q
|
|
* @param request
|
|
* @param request
|
|
* @return
|
|
* @return
|
|
@@ -265,7 +268,7 @@ public class MaterialController extends BaseController {
|
|
@GetMapping(value = "/getMaterialByParam")
|
|
@GetMapping(value = "/getMaterialByParam")
|
|
@ApiOperation(value = "根据关键词查找商品信息")
|
|
@ApiOperation(value = "根据关键词查找商品信息")
|
|
public BaseResponseInfo getMaterialByParam(@RequestParam("q") String q,
|
|
public BaseResponseInfo getMaterialByParam(@RequestParam("q") String q,
|
|
- HttpServletRequest request) throws Exception{
|
|
|
|
|
|
+ HttpServletRequest request) throws Exception {
|
|
BaseResponseInfo res = new BaseResponseInfo();
|
|
BaseResponseInfo res = new BaseResponseInfo();
|
|
try {
|
|
try {
|
|
JSONArray arr = materialService.getMaterialByParam(q);
|
|
JSONArray arr = materialService.getMaterialByParam(q);
|
|
@@ -400,6 +403,7 @@ public class MaterialController extends BaseController {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 查找商品信息-下拉框
|
|
* 查找商品信息-下拉框
|
|
|
|
+ *
|
|
* @param mpList
|
|
* @param mpList
|
|
* @param request
|
|
* @param request
|
|
* @return
|
|
* @return
|
|
@@ -418,18 +422,18 @@ public class MaterialController extends BaseController {
|
|
@RequestParam(value = "enableBatchNumber", required = false) String enableBatchNumber,
|
|
@RequestParam(value = "enableBatchNumber", required = false) String enableBatchNumber,
|
|
@RequestParam("page") Integer currentPage,
|
|
@RequestParam("page") Integer currentPage,
|
|
@RequestParam("rows") Integer pageSize,
|
|
@RequestParam("rows") Integer pageSize,
|
|
- HttpServletRequest request) throws Exception{
|
|
|
|
|
|
+ HttpServletRequest request) throws Exception {
|
|
JSONObject object = new JSONObject();
|
|
JSONObject object = new JSONObject();
|
|
try {
|
|
try {
|
|
String[] mpArr = new String[]{};
|
|
String[] mpArr = new String[]{};
|
|
- if(StringUtil.isNotEmpty(mpList)){
|
|
|
|
- mpArr= mpList.split(",");
|
|
|
|
|
|
+ if (StringUtil.isNotEmpty(mpList)) {
|
|
|
|
+ mpArr = mpList.split(",");
|
|
}
|
|
}
|
|
List<MaterialVo4Unit> dataList = materialService.findBySelectWithSku(categoryId, q, StringUtil.toNull(standardOrModel),
|
|
List<MaterialVo4Unit> dataList = materialService.findBySelectWithSku(categoryId, q, StringUtil.toNull(standardOrModel),
|
|
StringUtil.toNull(color), StringUtil.toNull(brand), StringUtil.toNull(mfrs), enableSerialNumber, enableBatchNumber,
|
|
StringUtil.toNull(color), StringUtil.toNull(brand), StringUtil.toNull(mfrs), enableSerialNumber, enableBatchNumber,
|
|
- (currentPage-1)*pageSize, pageSize,depotId);
|
|
|
|
|
|
+ (currentPage - 1) * pageSize, pageSize, depotId);
|
|
int total = materialService.findBySelectWithSkuCount(categoryId, q, StringUtil.toNull(standardOrModel),
|
|
int total = materialService.findBySelectWithSkuCount(categoryId, q, StringUtil.toNull(standardOrModel),
|
|
- StringUtil.toNull(color), StringUtil.toNull(brand), StringUtil.toNull(mfrs), enableSerialNumber, enableBatchNumber,depotId);
|
|
|
|
|
|
+ StringUtil.toNull(color), StringUtil.toNull(brand), StringUtil.toNull(mfrs), enableSerialNumber, enableBatchNumber, depotId);
|
|
object.put("total", total);
|
|
object.put("total", total);
|
|
JSONArray dataArray = new JSONArray();
|
|
JSONArray dataArray = new JSONArray();
|
|
//存放数据json数组
|
|
//存放数据json数组
|
|
@@ -447,19 +451,19 @@ public class MaterialController extends BaseController {
|
|
unit = unitService.getUnit(material.getUnitId());
|
|
unit = unitService.getUnit(material.getUnitId());
|
|
//拼接副单位的比例
|
|
//拼接副单位的比例
|
|
String commodityUnit = material.getCommodityUnit();
|
|
String commodityUnit = material.getCommodityUnit();
|
|
- if(commodityUnit.equals(unit.getBasicUnit())) {
|
|
|
|
|
|
+ if (commodityUnit.equals(unit.getBasicUnit())) {
|
|
ratioStr = "[基本]";
|
|
ratioStr = "[基本]";
|
|
ratio = new BigDecimal("1");
|
|
ratio = new BigDecimal("1");
|
|
}
|
|
}
|
|
- if(commodityUnit.equals(unit.getOtherUnit()) && unit.getRatio()!=null) {
|
|
|
|
|
|
+ if (commodityUnit.equals(unit.getOtherUnit()) && unit.getRatio() != null) {
|
|
ratioStr = "[" + unit.getRatio().stripTrailingZeros().toPlainString() + unit.getBasicUnit() + "]";
|
|
ratioStr = "[" + unit.getRatio().stripTrailingZeros().toPlainString() + unit.getBasicUnit() + "]";
|
|
ratio = unit.getRatio();
|
|
ratio = unit.getRatio();
|
|
}
|
|
}
|
|
- if(commodityUnit.equals(unit.getOtherUnitTwo()) && unit.getRatioTwo()!=null) {
|
|
|
|
|
|
+ if (commodityUnit.equals(unit.getOtherUnitTwo()) && unit.getRatioTwo() != null) {
|
|
ratioStr = "[" + unit.getRatioTwo().stripTrailingZeros().toPlainString() + unit.getBasicUnit() + "]";
|
|
ratioStr = "[" + unit.getRatioTwo().stripTrailingZeros().toPlainString() + unit.getBasicUnit() + "]";
|
|
ratio = unit.getRatioTwo();
|
|
ratio = unit.getRatioTwo();
|
|
}
|
|
}
|
|
- if(commodityUnit.equals(unit.getOtherUnitThree()) && unit.getRatioThree()!=null) {
|
|
|
|
|
|
+ if (commodityUnit.equals(unit.getOtherUnitThree()) && unit.getRatioThree() != null) {
|
|
ratioStr = "[" + unit.getRatioThree().stripTrailingZeros().toPlainString() + unit.getBasicUnit() + "]";
|
|
ratioStr = "[" + unit.getRatioThree().stripTrailingZeros().toPlainString() + unit.getBasicUnit() + "]";
|
|
ratio = unit.getRatioThree();
|
|
ratio = unit.getRatioThree();
|
|
}
|
|
}
|
|
@@ -489,11 +493,11 @@ public class MaterialController extends BaseController {
|
|
// item.put("unitId",material.getUnitId());
|
|
// item.put("unitId",material.getUnitId());
|
|
// item.put("inventory",materialService.getMaterialStockByMid(material.getId()).divide(ratio,2,BigDecimal.ROUND_HALF_UP));
|
|
// item.put("inventory",materialService.getMaterialStockByMid(material.getId()).divide(ratio,2,BigDecimal.ROUND_HALF_UP));
|
|
BigDecimal stock;
|
|
BigDecimal stock;
|
|
- if(StringUtil.isNotEmpty(material.getSku())){
|
|
|
|
- stock = depotItemService.getSkuStockByParam(depotId,material.getMeId(),null,null);
|
|
|
|
|
|
+ if (StringUtil.isNotEmpty(material.getSku())) {
|
|
|
|
+ stock = depotItemService.getSkuStockByParam(depotId, material.getMeId(), null, null);
|
|
} else {
|
|
} else {
|
|
stock = depotItemService.getCurrentStockByParam(depotId, material.getId());
|
|
stock = depotItemService.getCurrentStockByParam(depotId, material.getId());
|
|
- if (material.getUnitId()!=null){
|
|
|
|
|
|
+ if (material.getUnitId() != null) {
|
|
String commodityUnit = material.getCommodityUnit();
|
|
String commodityUnit = material.getCommodityUnit();
|
|
stock = unitService.parseStockByUnit(stock, unit, commodityUnit);
|
|
stock = unitService.parseStockByUnit(stock, unit, commodityUnit);
|
|
}
|
|
}
|
|
@@ -511,6 +515,7 @@ public class MaterialController extends BaseController {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 根据商品id查找商品信息
|
|
* 根据商品id查找商品信息
|
|
|
|
+ *
|
|
* @param meId
|
|
* @param meId
|
|
* @param request
|
|
* @param request
|
|
* @return
|
|
* @return
|
|
@@ -520,14 +525,14 @@ public class MaterialController extends BaseController {
|
|
@ApiOperation(value = "根据商品id查找商品信息")
|
|
@ApiOperation(value = "根据商品id查找商品信息")
|
|
public JSONObject getMaterialByMeId(@RequestParam(value = "meId", required = false) Long meId,
|
|
public JSONObject getMaterialByMeId(@RequestParam(value = "meId", required = false) Long meId,
|
|
@RequestParam("mpList") String mpList,
|
|
@RequestParam("mpList") String mpList,
|
|
- HttpServletRequest request) throws Exception{
|
|
|
|
|
|
+ HttpServletRequest request) throws Exception {
|
|
JSONObject item = new JSONObject();
|
|
JSONObject item = new JSONObject();
|
|
try {
|
|
try {
|
|
String[] mpArr = mpList.split(",");
|
|
String[] mpArr = mpList.split(",");
|
|
List<MaterialVo4Unit> materialList = materialService.getMaterialByMeId(meId);
|
|
List<MaterialVo4Unit> materialList = materialService.getMaterialByMeId(meId);
|
|
- if(materialList!=null && materialList.size()!=1) {
|
|
|
|
|
|
+ if (materialList != null && materialList.size() != 1) {
|
|
return item;
|
|
return item;
|
|
- } else if(materialList.size() == 1) {
|
|
|
|
|
|
+ } else if (materialList.size() == 1) {
|
|
MaterialVo4Unit material = materialList.get(0);
|
|
MaterialVo4Unit material = materialList.get(0);
|
|
item.put("Id", material.getMeId()); //商品扩展表的id
|
|
item.put("Id", material.getMeId()); //商品扩展表的id
|
|
String ratio; //比例
|
|
String ratio; //比例
|
|
@@ -558,6 +563,7 @@ public class MaterialController extends BaseController {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 生成excel表格
|
|
* 生成excel表格
|
|
|
|
+ *
|
|
* @param categoryId
|
|
* @param categoryId
|
|
* @param materialParam
|
|
* @param materialParam
|
|
* @param color
|
|
* @param color
|
|
@@ -597,6 +603,7 @@ public class MaterialController extends BaseController {
|
|
|
|
|
|
/**
|
|
/**
|
|
* excel表格导入产品(含初始库存)
|
|
* excel表格导入产品(含初始库存)
|
|
|
|
+ *
|
|
* @param file
|
|
* @param file
|
|
* @param request
|
|
* @param request
|
|
* @param response
|
|
* @param response
|
|
@@ -605,7 +612,7 @@ public class MaterialController extends BaseController {
|
|
@PostMapping(value = "/importExcel")
|
|
@PostMapping(value = "/importExcel")
|
|
@ApiOperation(value = "excel表格导入产品")
|
|
@ApiOperation(value = "excel表格导入产品")
|
|
public BaseResponseInfo importExcel(MultipartFile file,
|
|
public BaseResponseInfo importExcel(MultipartFile file,
|
|
- HttpServletRequest request, HttpServletResponse response) throws Exception{
|
|
|
|
|
|
+ HttpServletRequest request, HttpServletResponse response) throws Exception {
|
|
BaseResponseInfo res = new BaseResponseInfo();
|
|
BaseResponseInfo res = new BaseResponseInfo();
|
|
try {
|
|
try {
|
|
res = materialService.importExcelTwo(file, request);
|
|
res = materialService.importExcelTwo(file, request);
|
|
@@ -617,6 +624,7 @@ public class MaterialController extends BaseController {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取商品序列号
|
|
* 获取商品序列号
|
|
|
|
+ *
|
|
* @param q
|
|
* @param q
|
|
* @param currentPage
|
|
* @param currentPage
|
|
* @param pageSize
|
|
* @param pageSize
|
|
@@ -628,14 +636,14 @@ public class MaterialController extends BaseController {
|
|
@GetMapping(value = "/getMaterialEnableSerialNumberList")
|
|
@GetMapping(value = "/getMaterialEnableSerialNumberList")
|
|
@ApiOperation(value = "获取商品序列号")
|
|
@ApiOperation(value = "获取商品序列号")
|
|
public JSONObject getMaterialEnableSerialNumberList(
|
|
public JSONObject getMaterialEnableSerialNumberList(
|
|
- @RequestParam(value = "q", required = false) String q,
|
|
|
|
- @RequestParam("page") Integer currentPage,
|
|
|
|
- @RequestParam("rows") Integer pageSize,
|
|
|
|
- HttpServletRequest request,
|
|
|
|
- HttpServletResponse response)throws Exception {
|
|
|
|
- JSONObject object= new JSONObject();
|
|
|
|
|
|
+ @RequestParam(value = "q", required = false) String q,
|
|
|
|
+ @RequestParam("page") Integer currentPage,
|
|
|
|
+ @RequestParam("rows") Integer pageSize,
|
|
|
|
+ HttpServletRequest request,
|
|
|
|
+ HttpServletResponse response) throws Exception {
|
|
|
|
+ JSONObject object = new JSONObject();
|
|
try {
|
|
try {
|
|
- List<MaterialVo4Unit> list = materialService.getMaterialEnableSerialNumberList(q, (currentPage-1)*pageSize, pageSize);
|
|
|
|
|
|
+ List<MaterialVo4Unit> list = materialService.getMaterialEnableSerialNumberList(q, (currentPage - 1) * pageSize, pageSize);
|
|
Long count = materialService.getMaterialEnableSerialNumberCount(q);
|
|
Long count = materialService.getMaterialEnableSerialNumberCount(q);
|
|
object.put("rows", list);
|
|
object.put("rows", list);
|
|
object.put("total", count);
|
|
object.put("total", count);
|
|
@@ -647,6 +655,7 @@ public class MaterialController extends BaseController {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取最大条码
|
|
* 获取最大条码
|
|
|
|
+ *
|
|
* @return
|
|
* @return
|
|
* @throws Exception
|
|
* @throws Exception
|
|
*/
|
|
*/
|
|
@@ -664,6 +673,7 @@ public class MaterialController extends BaseController {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 商品名称模糊匹配
|
|
* 商品名称模糊匹配
|
|
|
|
+ *
|
|
* @return
|
|
* @return
|
|
* @throws Exception
|
|
* @throws Exception
|
|
*/
|
|
*/
|
|
@@ -687,6 +697,7 @@ public class MaterialController extends BaseController {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 根据条码查询商品信息
|
|
* 根据条码查询商品信息
|
|
|
|
+ *
|
|
* @return
|
|
* @return
|
|
* @throws Exception
|
|
* @throws Exception
|
|
*/
|
|
*/
|
|
@@ -709,8 +720,8 @@ public class MaterialController extends BaseController {
|
|
// barCode = materialExtend.getBarCode();
|
|
// barCode = materialExtend.getBarCode();
|
|
// }
|
|
// }
|
|
List<MaterialVo4Unit> list = materialService.getMaterialByBarCode(barCode);
|
|
List<MaterialVo4Unit> list = materialService.getMaterialByBarCode(barCode);
|
|
- if(list!=null && list.size()>0) {
|
|
|
|
- for(MaterialVo4Unit mvo: list) {
|
|
|
|
|
|
+ if (list != null && list.size() > 0) {
|
|
|
|
+ for (MaterialVo4Unit mvo : list) {
|
|
mvo.setMaterialOther(materialService.getMaterialOtherByParam(mpArr, mvo));
|
|
mvo.setMaterialOther(materialService.getMaterialOtherByParam(mpArr, mvo));
|
|
if ("LSCK".equals(prefixNo) || "LSTH".equals(prefixNo)) {
|
|
if ("LSCK".equals(prefixNo) || "LSTH".equals(prefixNo)) {
|
|
//零售价
|
|
//零售价
|
|
@@ -718,15 +729,15 @@ public class MaterialController extends BaseController {
|
|
} else if ("CGDD".equals(prefixNo) || "CGRK".equals(prefixNo) || "CGTH".equals(prefixNo)) {
|
|
} else if ("CGDD".equals(prefixNo) || "CGRK".equals(prefixNo) || "CGTH".equals(prefixNo)) {
|
|
//采购价
|
|
//采购价
|
|
mvo.setBillPrice(mvo.getDefaultPurchaseDecimal());
|
|
mvo.setBillPrice(mvo.getDefaultPurchaseDecimal());
|
|
- } else if("QTRK".equals(prefixNo) || "DBCK".equals(prefixNo) || "ZZD".equals(prefixNo) || "CXD".equals(prefixNo)
|
|
|
|
|
|
+ } else if ("QTRK".equals(prefixNo) || "DBCK".equals(prefixNo) || "ZZD".equals(prefixNo) || "CXD".equals(prefixNo)
|
|
|| "PDLR".equals(prefixNo) || "PDFP".equals(prefixNo)) {
|
|
|| "PDLR".equals(prefixNo) || "PDFP".equals(prefixNo)) {
|
|
//采购价-给录入界面按权限屏蔽
|
|
//采购价-给录入界面按权限屏蔽
|
|
- // mvo.setBillPrice(roleService.parseBillPriceByLimit(mvo.getPurchaseDecimal(), "buy", priceLimit, request));
|
|
|
|
|
|
+ // mvo.setBillPrice(roleService.parseBillPriceByLimit(mvo.getPurchaseDecimal(), "buy", priceLimit, request));
|
|
mvo.setBillPrice(mvo.getDefaultPurchaseDecimal());
|
|
mvo.setBillPrice(mvo.getDefaultPurchaseDecimal());
|
|
}
|
|
}
|
|
if ("XSDD".equals(prefixNo) || "XSCK".equals(prefixNo) || "XSTH".equals(prefixNo) || "QTCK".equals(prefixNo)) {
|
|
if ("XSDD".equals(prefixNo) || "XSCK".equals(prefixNo) || "XSTH".equals(prefixNo) || "QTCK".equals(prefixNo)) {
|
|
//销售价
|
|
//销售价
|
|
- if(organId == null) {
|
|
|
|
|
|
+ if (organId == null) {
|
|
mvo.setBillPrice(mvo.getDefaultWholesaleDecimal());
|
|
mvo.setBillPrice(mvo.getDefaultWholesaleDecimal());
|
|
} else {
|
|
} else {
|
|
//查询最后一单的销售价,实现不同的客户不同的销售价
|
|
//查询最后一单的销售价,实现不同的客户不同的销售价
|
|
@@ -734,7 +745,7 @@ public class MaterialController extends BaseController {
|
|
mvo.setBillPrice(lastUnitPrice != null ? lastUnitPrice : mvo.getDefaultWholesaleDecimal());
|
|
mvo.setBillPrice(lastUnitPrice != null ? lastUnitPrice : mvo.getDefaultWholesaleDecimal());
|
|
}
|
|
}
|
|
//销售价-给录入界面按权限屏蔽价格
|
|
//销售价-给录入界面按权限屏蔽价格
|
|
- if("QTCK".equals(prefixNo)) {
|
|
|
|
|
|
+ if ("QTCK".equals(prefixNo)) {
|
|
//mvo.setBillPrice(roleService.parseBillPriceByLimit(mvo.getWholesaleDecimal(), "sale", priceLimit, request));
|
|
//mvo.setBillPrice(roleService.parseBillPriceByLimit(mvo.getWholesaleDecimal(), "sale", priceLimit, request));
|
|
mvo.setBillPrice(mvo.getDefaultWholesaleDecimal());
|
|
mvo.setBillPrice(mvo.getDefaultWholesaleDecimal());
|
|
}
|
|
}
|
|
@@ -765,7 +776,7 @@ public class MaterialController extends BaseController {
|
|
}
|
|
}
|
|
res.code = 200;
|
|
res.code = 200;
|
|
res.data = list;
|
|
res.data = list;
|
|
- } catch(Exception e){
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
logger.error(e.getMessage(), e);
|
|
logger.error(e.getMessage(), e);
|
|
res.code = 500;
|
|
res.code = 500;
|
|
res.data = "获取数据失败";
|
|
res.data = "获取数据失败";
|
|
@@ -775,6 +786,7 @@ public class MaterialController extends BaseController {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 根据sku查询商品信息
|
|
* 根据sku查询商品信息
|
|
|
|
+ *
|
|
* @return
|
|
* @return
|
|
* @throws Exception
|
|
* @throws Exception
|
|
*/
|
|
*/
|
|
@@ -783,25 +795,25 @@ public class MaterialController extends BaseController {
|
|
public AjaxResult getMaterialBySku(@RequestParam("sku") String sku,
|
|
public AjaxResult getMaterialBySku(@RequestParam("sku") String sku,
|
|
@RequestParam(value = "depotId", required = false) Long depotId,
|
|
@RequestParam(value = "depotId", required = false) Long depotId,
|
|
@RequestParam(required = false, value = "prefixNo") String prefixNo) {
|
|
@RequestParam(required = false, value = "prefixNo") String prefixNo) {
|
|
- List<MaterialVo4Unit> list = materialService.getMaterialBySku(sku);
|
|
|
|
- if(list != null && list.size() > 0) {
|
|
|
|
- for(MaterialVo4Unit mvo: list) {
|
|
|
|
- //包装规格
|
|
|
|
- mvo.setUnitName(materialUnitService.getStandardByMeId(mvo.getMeId()));
|
|
|
|
- if ("LSCK".equals(prefixNo) || "LSTH".equals(prefixNo)) {
|
|
|
|
- //零售价
|
|
|
|
- mvo.setBillPrice(mvo.getCommodityDecimal());
|
|
|
|
- } else if ("CGDD".equals(prefixNo) || "CGRK".equals(prefixNo) || "CGTH".equals(prefixNo)) {
|
|
|
|
- //采购价
|
|
|
|
- mvo.setBillPrice(mvo.getDefaultPurchaseDecimal());
|
|
|
|
- } else if("QTRK".equals(prefixNo) || "DBCK".equals(prefixNo) || "ZZD".equals(prefixNo) || "CXD".equals(prefixNo)
|
|
|
|
- || "PDLR".equals(prefixNo) || "PDFP".equals(prefixNo)) {
|
|
|
|
- mvo.setBillPrice(mvo.getDefaultPurchaseDecimal());
|
|
|
|
- }
|
|
|
|
- if ("XSDD".equals(prefixNo) || "XSCK".equals(prefixNo) || "XSTH".equals(prefixNo) || "QTCK".equals(prefixNo)) {
|
|
|
|
- mvo.setBillPrice(mvo.getDefaultWholesaleDecimal());
|
|
|
|
- }
|
|
|
|
- //仓库id
|
|
|
|
|
|
+ List<MaterialVo4Unit> list = materialService.getMaterialBySku(sku);
|
|
|
|
+ if (list != null && list.size() > 0) {
|
|
|
|
+ for (MaterialVo4Unit mvo : list) {
|
|
|
|
+ //包装规格
|
|
|
|
+ mvo.setUnitName(materialUnitService.getStandardByMeId(mvo.getMeId()));
|
|
|
|
+ if ("LSCK".equals(prefixNo) || "LSTH".equals(prefixNo)) {
|
|
|
|
+ //零售价
|
|
|
|
+ mvo.setBillPrice(mvo.getCommodityDecimal());
|
|
|
|
+ } else if ("CGDD".equals(prefixNo) || "CGRK".equals(prefixNo) || "CGTH".equals(prefixNo)) {
|
|
|
|
+ //采购价
|
|
|
|
+ mvo.setBillPrice(mvo.getDefaultPurchaseDecimal());
|
|
|
|
+ } else if ("QTRK".equals(prefixNo) || "DBCK".equals(prefixNo) || "ZZD".equals(prefixNo) || "CXD".equals(prefixNo)
|
|
|
|
+ || "PDLR".equals(prefixNo) || "PDFP".equals(prefixNo)) {
|
|
|
|
+ mvo.setBillPrice(mvo.getDefaultPurchaseDecimal());
|
|
|
|
+ }
|
|
|
|
+ if ("XSDD".equals(prefixNo) || "XSCK".equals(prefixNo) || "XSTH".equals(prefixNo) || "QTCK".equals(prefixNo)) {
|
|
|
|
+ mvo.setBillPrice(mvo.getDefaultWholesaleDecimal());
|
|
|
|
+ }
|
|
|
|
+ //仓库id
|
|
// if (depotId == null) {
|
|
// if (depotId == null) {
|
|
// JSONArray depotArr = depotService.findDepotByCurrentUser();
|
|
// JSONArray depotArr = depotService.findDepotByCurrentUser();
|
|
// for (Object obj : depotArr) {
|
|
// for (Object obj : depotArr) {
|
|
@@ -821,13 +833,14 @@ public class MaterialController extends BaseController {
|
|
// } else {
|
|
// } else {
|
|
// mvo.setDepotId(depotId);
|
|
// mvo.setDepotId(depotId);
|
|
// }
|
|
// }
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
+ }
|
|
return AjaxResult.success(list);
|
|
return AjaxResult.success(list);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 根据商品信息获取库存,进行赋值
|
|
* 根据商品信息获取库存,进行赋值
|
|
|
|
+ *
|
|
* @param mvo
|
|
* @param mvo
|
|
* @throws Exception
|
|
* @throws Exception
|
|
*/
|
|
*/
|
|
@@ -848,6 +861,7 @@ public class MaterialController extends BaseController {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 商品库存查询
|
|
* 商品库存查询
|
|
|
|
+ *
|
|
* @param currentPage
|
|
* @param currentPage
|
|
* @param pageSize
|
|
* @param pageSize
|
|
* @param depotIds
|
|
* @param depotIds
|
|
@@ -871,42 +885,42 @@ public class MaterialController extends BaseController {
|
|
@RequestParam("zeroStock") Integer zeroStock,
|
|
@RequestParam("zeroStock") Integer zeroStock,
|
|
@RequestParam(value = "column", required = false, defaultValue = "createTime") String column,
|
|
@RequestParam(value = "column", required = false, defaultValue = "createTime") String column,
|
|
@RequestParam(value = "order", required = false, defaultValue = "desc") String order,
|
|
@RequestParam(value = "order", required = false, defaultValue = "desc") String order,
|
|
- HttpServletRequest request)throws Exception {
|
|
|
|
|
|
+ HttpServletRequest request) throws Exception {
|
|
BaseResponseInfo res = new BaseResponseInfo();
|
|
BaseResponseInfo res = new BaseResponseInfo();
|
|
Map<String, Object> map = new HashMap<>();
|
|
Map<String, Object> map = new HashMap<>();
|
|
try {
|
|
try {
|
|
List<Long> idList = new ArrayList<>();
|
|
List<Long> idList = new ArrayList<>();
|
|
List<Long> depotList = new ArrayList<>();
|
|
List<Long> depotList = new ArrayList<>();
|
|
- if(categoryId != null){
|
|
|
|
|
|
+ if (categoryId != null) {
|
|
idList = materialService.getListByParentId(categoryId);
|
|
idList = materialService.getListByParentId(categoryId);
|
|
}
|
|
}
|
|
- if(StringUtil.isNotEmpty(depotIds)) {
|
|
|
|
|
|
+ if (StringUtil.isNotEmpty(depotIds)) {
|
|
depotList = StringUtil.strToLongList(depotIds);
|
|
depotList = StringUtil.strToLongList(depotIds);
|
|
} else {
|
|
} else {
|
|
//未选择仓库时默认为当前用户有权限的仓库
|
|
//未选择仓库时默认为当前用户有权限的仓库
|
|
JSONArray depotArr = depotService.findDepotByCurrentUser();
|
|
JSONArray depotArr = depotService.findDepotByCurrentUser();
|
|
- for(Object obj: depotArr) {
|
|
|
|
|
|
+ for (Object obj : depotArr) {
|
|
JSONObject object = JSONObject.parseObject(obj.toString());
|
|
JSONObject object = JSONObject.parseObject(obj.toString());
|
|
depotList.add(object.getLong("id"));
|
|
depotList.add(object.getLong("id"));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
Boolean moveAvgPriceFlag = systemConfigService.getMoveAvgPriceFlag();
|
|
Boolean moveAvgPriceFlag = systemConfigService.getMoveAvgPriceFlag();
|
|
List<MaterialVo4Unit> dataList = materialService.getListWithStock(depotList, idList, StringUtil.toNull(position), StringUtil.toNull(materialParam),
|
|
List<MaterialVo4Unit> dataList = materialService.getListWithStock(depotList, idList, StringUtil.toNull(position), StringUtil.toNull(materialParam),
|
|
- moveAvgPriceFlag, zeroStock, StringUtil.safeSqlParse(column), StringUtil.safeSqlParse(order), (currentPage-1)*pageSize, pageSize);
|
|
|
|
|
|
+ moveAvgPriceFlag, zeroStock, StringUtil.safeSqlParse(column), StringUtil.safeSqlParse(order), (currentPage - 1) * pageSize, pageSize);
|
|
int total = materialService.getListWithStockCount(depotList, idList, StringUtil.toNull(position), StringUtil.toNull(materialParam), zeroStock);
|
|
int total = materialService.getListWithStockCount(depotList, idList, StringUtil.toNull(position), StringUtil.toNull(materialParam), zeroStock);
|
|
- MaterialVo4Unit materialVo4Unit= materialService.getTotalStockAndPrice(depotList, idList, StringUtil.toNull(position), StringUtil.toNull(materialParam));
|
|
|
|
|
|
+ MaterialVo4Unit materialVo4Unit = materialService.getTotalStockAndPrice(depotList, idList, StringUtil.toNull(position), StringUtil.toNull(materialParam));
|
|
map.put("total", total);
|
|
map.put("total", total);
|
|
- map.put("currentStock", materialVo4Unit.getCurrentStock()!=null?materialVo4Unit.getCurrentStock():BigDecimal.ZERO);
|
|
|
|
- if(moveAvgPriceFlag) {
|
|
|
|
- map.put("currentStockPrice", materialVo4Unit.getCurrentStockMovePrice()!=null?materialVo4Unit.getCurrentStockMovePrice():BigDecimal.ZERO);
|
|
|
|
|
|
+ map.put("currentStock", materialVo4Unit.getCurrentStock() != null ? materialVo4Unit.getCurrentStock() : BigDecimal.ZERO);
|
|
|
|
+ if (moveAvgPriceFlag) {
|
|
|
|
+ map.put("currentStockPrice", materialVo4Unit.getCurrentStockMovePrice() != null ? materialVo4Unit.getCurrentStockMovePrice() : BigDecimal.ZERO);
|
|
} else {
|
|
} else {
|
|
- map.put("currentStockPrice", materialVo4Unit.getCurrentStockPrice()!=null?materialVo4Unit.getCurrentStockPrice():BigDecimal.ZERO);
|
|
|
|
|
|
+ map.put("currentStockPrice", materialVo4Unit.getCurrentStockPrice() != null ? materialVo4Unit.getCurrentStockPrice() : BigDecimal.ZERO);
|
|
}
|
|
}
|
|
- map.put("currentWeight", materialVo4Unit.getCurrentWeight()!=null?materialVo4Unit.getCurrentWeight():BigDecimal.ZERO);
|
|
|
|
|
|
+ map.put("currentWeight", materialVo4Unit.getCurrentWeight() != null ? materialVo4Unit.getCurrentWeight() : BigDecimal.ZERO);
|
|
map.put("rows", dataList);
|
|
map.put("rows", dataList);
|
|
res.code = 200;
|
|
res.code = 200;
|
|
res.data = map;
|
|
res.data = map;
|
|
- } catch(Exception e){
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
logger.error(e.getMessage(), e);
|
|
logger.error(e.getMessage(), e);
|
|
res.code = 500;
|
|
res.code = 500;
|
|
res.data = "获取数据失败";
|
|
res.data = "获取数据失败";
|
|
@@ -916,6 +930,7 @@ public class MaterialController extends BaseController {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 批量设置商品当前的实时库存(按每个仓库)
|
|
* 批量设置商品当前的实时库存(按每个仓库)
|
|
|
|
+ *
|
|
* @param jsonObject
|
|
* @param jsonObject
|
|
* @param request
|
|
* @param request
|
|
* @return
|
|
* @return
|
|
@@ -924,11 +939,11 @@ public class MaterialController extends BaseController {
|
|
@PostMapping(value = "/batchSetMaterialCurrentStock")
|
|
@PostMapping(value = "/batchSetMaterialCurrentStock")
|
|
@ApiOperation(value = "批量设置商品当前的实时库存(按每个仓库)")
|
|
@ApiOperation(value = "批量设置商品当前的实时库存(按每个仓库)")
|
|
public String batchSetMaterialCurrentStock(@RequestBody JSONObject jsonObject,
|
|
public String batchSetMaterialCurrentStock(@RequestBody JSONObject jsonObject,
|
|
- HttpServletRequest request)throws Exception {
|
|
|
|
|
|
+ HttpServletRequest request) throws Exception {
|
|
String ids = jsonObject.getString("ids");
|
|
String ids = jsonObject.getString("ids");
|
|
Map<String, Object> objectMap = new HashMap<>();
|
|
Map<String, Object> objectMap = new HashMap<>();
|
|
int res = materialService.batchSetMaterialCurrentStock(ids);
|
|
int res = materialService.batchSetMaterialCurrentStock(ids);
|
|
- if(res > 0) {
|
|
|
|
|
|
+ if (res > 0) {
|
|
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
|
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
|
} else {
|
|
} else {
|
|
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
|
|
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
|
|
@@ -937,6 +952,7 @@ public class MaterialController extends BaseController {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 批量设置商品当前的成本价
|
|
* 批量设置商品当前的成本价
|
|
|
|
+ *
|
|
* @param jsonObject
|
|
* @param jsonObject
|
|
* @param request
|
|
* @param request
|
|
* @return
|
|
* @return
|
|
@@ -945,11 +961,11 @@ public class MaterialController extends BaseController {
|
|
@PostMapping(value = "/batchSetMaterialCurrentUnitPrice")
|
|
@PostMapping(value = "/batchSetMaterialCurrentUnitPrice")
|
|
@ApiOperation(value = "批量设置商品当前的成本价")
|
|
@ApiOperation(value = "批量设置商品当前的成本价")
|
|
public String batchSetMaterialCurrentUnitPrice(@RequestBody JSONObject jsonObject,
|
|
public String batchSetMaterialCurrentUnitPrice(@RequestBody JSONObject jsonObject,
|
|
- HttpServletRequest request)throws Exception {
|
|
|
|
|
|
+ HttpServletRequest request) throws Exception {
|
|
String ids = jsonObject.getString("ids");
|
|
String ids = jsonObject.getString("ids");
|
|
Map<String, Object> objectMap = new HashMap<>();
|
|
Map<String, Object> objectMap = new HashMap<>();
|
|
int res = materialService.batchSetMaterialCurrentUnitPrice(ids);
|
|
int res = materialService.batchSetMaterialCurrentUnitPrice(ids);
|
|
- if(res > 0) {
|
|
|
|
|
|
+ if (res > 0) {
|
|
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
|
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
|
} else {
|
|
} else {
|
|
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
|
|
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
|
|
@@ -958,6 +974,7 @@ public class MaterialController extends BaseController {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 批量更新商品信息
|
|
* 批量更新商品信息
|
|
|
|
+ *
|
|
* @param jsonObject
|
|
* @param jsonObject
|
|
* @param request
|
|
* @param request
|
|
* @return
|
|
* @return
|
|
@@ -966,10 +983,10 @@ public class MaterialController extends BaseController {
|
|
@PostMapping(value = "/batchUpdate")
|
|
@PostMapping(value = "/batchUpdate")
|
|
@ApiOperation(value = "批量更新商品信息")
|
|
@ApiOperation(value = "批量更新商品信息")
|
|
public String batchUpdate(@RequestBody JSONObject jsonObject,
|
|
public String batchUpdate(@RequestBody JSONObject jsonObject,
|
|
- HttpServletRequest request)throws Exception {
|
|
|
|
|
|
+ HttpServletRequest request) throws Exception {
|
|
Map<String, Object> objectMap = new HashMap<>();
|
|
Map<String, Object> objectMap = new HashMap<>();
|
|
int res = materialService.batchUpdate(jsonObject);
|
|
int res = materialService.batchUpdate(jsonObject);
|
|
- if(res > 0) {
|
|
|
|
|
|
+ if (res > 0) {
|
|
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
|
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
|
} else {
|
|
} else {
|
|
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
|
|
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
|
|
@@ -978,17 +995,18 @@ public class MaterialController extends BaseController {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 转换名称为拼音
|
|
* 转换名称为拼音
|
|
|
|
+ *
|
|
* @param jsonObject
|
|
* @param jsonObject
|
|
*/
|
|
*/
|
|
@PostMapping(value = "/changeNameToPinYin")
|
|
@PostMapping(value = "/changeNameToPinYin")
|
|
@ApiOperation(value = "转换名称为拼音")
|
|
@ApiOperation(value = "转换名称为拼音")
|
|
- public BaseResponseInfo changeNameToPinYin(@RequestBody JSONObject jsonObject)throws Exception {
|
|
|
|
|
|
+ public BaseResponseInfo changeNameToPinYin(@RequestBody JSONObject jsonObject) throws Exception {
|
|
BaseResponseInfo res = new BaseResponseInfo();
|
|
BaseResponseInfo res = new BaseResponseInfo();
|
|
try {
|
|
try {
|
|
String name = jsonObject.getString("name");
|
|
String name = jsonObject.getString("name");
|
|
res.code = 200;
|
|
res.code = 200;
|
|
res.data = PinYinUtil.getFirstLettersLo(name);
|
|
res.data = PinYinUtil.getFirstLettersLo(name);
|
|
- } catch(Exception e){
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
logger.error(e.getMessage(), e);
|
|
logger.error(e.getMessage(), e);
|
|
res.code = 500;
|
|
res.code = 500;
|
|
res.data = "获取数据失败";
|
|
res.data = "获取数据失败";
|
|
@@ -999,7 +1017,7 @@ public class MaterialController extends BaseController {
|
|
|
|
|
|
@GetMapping(value = "/getMaterialByBatchNumber")
|
|
@GetMapping(value = "/getMaterialByBatchNumber")
|
|
@ApiOperation(value = "根据批次号查询商品信息")
|
|
@ApiOperation(value = "根据批次号查询商品信息")
|
|
- public TableDataInfo getMaterialByBatchNumber(@RequestParam("batchNumber") String batchNumber){
|
|
|
|
|
|
+ public TableDataInfo getMaterialByBatchNumber(@RequestParam("batchNumber") String batchNumber) {
|
|
String[] batchNumbers = batchNumber.split(",");
|
|
String[] batchNumbers = batchNumber.split(",");
|
|
startPage();
|
|
startPage();
|
|
List<TaskStocktakingItemVO> list = materialBatchService.getMaterialByBatchNumber(batchNumbers);
|
|
List<TaskStocktakingItemVO> list = materialBatchService.getMaterialByBatchNumber(batchNumbers);
|
|
@@ -1009,7 +1027,7 @@ public class MaterialController extends BaseController {
|
|
@GetMapping(value = "/getMaterialById")
|
|
@GetMapping(value = "/getMaterialById")
|
|
@ApiOperation(value = "根据商品id查询商品及子表信息")
|
|
@ApiOperation(value = "根据商品id查询商品及子表信息")
|
|
public BaseResponseInfo getMaterialById(@RequestParam("mid") Long materialId,
|
|
public BaseResponseInfo getMaterialById(@RequestParam("mid") Long materialId,
|
|
- HttpServletRequest request)throws Exception {
|
|
|
|
|
|
+ HttpServletRequest request) throws Exception {
|
|
BaseResponseInfo res = new BaseResponseInfo();
|
|
BaseResponseInfo res = new BaseResponseInfo();
|
|
res.code = 200;
|
|
res.code = 200;
|
|
res.data = materialService.getMaterialById(materialId);
|
|
res.data = materialService.getMaterialById(materialId);
|
|
@@ -1018,7 +1036,7 @@ public class MaterialController extends BaseController {
|
|
|
|
|
|
@GetMapping(value = "/getMaterialWarn")
|
|
@GetMapping(value = "/getMaterialWarn")
|
|
@ApiOperation(value = "获取商品提醒")
|
|
@ApiOperation(value = "获取商品提醒")
|
|
- public BaseResponseInfo getMaterialWarn()throws Exception {
|
|
|
|
|
|
+ public BaseResponseInfo getMaterialWarn() throws Exception {
|
|
BaseResponseInfo res = new BaseResponseInfo();
|
|
BaseResponseInfo res = new BaseResponseInfo();
|
|
res.code = 200;
|
|
res.code = 200;
|
|
res.data = materialService.getMaterialWarn();
|
|
res.data = materialService.getMaterialWarn();
|
|
@@ -1028,20 +1046,20 @@ public class MaterialController extends BaseController {
|
|
@GetMapping(value = "/findBatchNumbersBySelect")
|
|
@GetMapping(value = "/findBatchNumbersBySelect")
|
|
@ApiOperation(value = "商品选择全选获取商品批次号")
|
|
@ApiOperation(value = "商品选择全选获取商品批次号")
|
|
public BaseResponseInfo findBatchNumberSBySelect(@RequestParam(value = "categoryId", required = false) Long categoryId,
|
|
public BaseResponseInfo findBatchNumberSBySelect(@RequestParam(value = "categoryId", required = false) Long categoryId,
|
|
- @RequestParam(value = "q", required = false) String q,
|
|
|
|
- @RequestParam(value = "standardOrModel", required = false) String standardOrModel,
|
|
|
|
- @RequestParam(value = "depotId", required = false) Long depotId,
|
|
|
|
- @RequestParam(value = "color", required = false) String color,
|
|
|
|
- @RequestParam(value = "brand", required = false) String brand,
|
|
|
|
- @RequestParam(value = "mfrs", required = false) String mfrs,
|
|
|
|
- @RequestParam(value = "enableSerialNumber", required = false) String enableSerialNumber,
|
|
|
|
- @RequestParam(value = "enableBatchNumber", required = false) String enableBatchNumber,
|
|
|
|
- HttpServletRequest request){
|
|
|
|
|
|
+ @RequestParam(value = "q", required = false) String q,
|
|
|
|
+ @RequestParam(value = "standardOrModel", required = false) String standardOrModel,
|
|
|
|
+ @RequestParam(value = "depotId", required = false) Long depotId,
|
|
|
|
+ @RequestParam(value = "color", required = false) String color,
|
|
|
|
+ @RequestParam(value = "brand", required = false) String brand,
|
|
|
|
+ @RequestParam(value = "mfrs", required = false) String mfrs,
|
|
|
|
+ @RequestParam(value = "enableSerialNumber", required = false) String enableSerialNumber,
|
|
|
|
+ @RequestParam(value = "enableBatchNumber", required = false) String enableBatchNumber,
|
|
|
|
+ HttpServletRequest request) {
|
|
BaseResponseInfo res = new BaseResponseInfo();
|
|
BaseResponseInfo res = new BaseResponseInfo();
|
|
try {
|
|
try {
|
|
List<MaterialVo4Unit> dataList = materialBatchService.findBySelectWithBarCode(categoryId, q, StringUtil.toNull(standardOrModel),
|
|
List<MaterialVo4Unit> dataList = materialBatchService.findBySelectWithBarCode(categoryId, q, StringUtil.toNull(standardOrModel),
|
|
StringUtil.toNull(color), StringUtil.toNull(brand), StringUtil.toNull(mfrs), enableSerialNumber, enableBatchNumber,
|
|
StringUtil.toNull(color), StringUtil.toNull(brand), StringUtil.toNull(mfrs), enableSerialNumber, enableBatchNumber,
|
|
- null, null,depotId);
|
|
|
|
|
|
+ null, null, depotId);
|
|
StringBuffer str = new StringBuffer();
|
|
StringBuffer str = new StringBuffer();
|
|
//存放数据json数组
|
|
//存放数据json数组
|
|
if (null != dataList) {
|
|
if (null != dataList) {
|