@@ -25,8 +25,11 @@ | |||
<result column="materials_name" jdbcType="VARCHAR" property="materialsName" /> | |||
<result column="position_name" jdbcType="VARCHAR" property="positionName" /> | |||
<result column="company_name" jdbcType="VARCHAR" property="companyName" /> | |||
<result column="unit_id" jdbcType="INTEGER" property="unitId" /> | |||
<result column="unit_name" jdbcType="VARCHAR" property="unitName" /> | |||
<result column="parent_id" jdbcType="INTEGER" property="parentId" /> | |||
<result column="parent_name" jdbcType="VARCHAR" property="parentName" /> | |||
<result column="supplier_id" jdbcType="INTEGER" property="supplierId" /> | |||
<result column="supplier_name" jdbcType="VARCHAR" property="supplierName" /> | |||
</resultMap> | |||
@@ -39,12 +42,16 @@ | |||
<select id="findList" parameterType="com.deer.wms.produce.manage.model.MaterialsInfoParams" resultMap="MatInfoDTOResultMap"> | |||
SELECT | |||
materials.id, | |||
materials.code, | |||
materials.create_time, | |||
materials.materials_name, | |||
materials.parent_id, | |||
(SELECT m.materials_name FROM mt_alone_materials_info m | |||
WHERE m.id = materials.parent_id ) parent_name, | |||
WHERE m.id = materials.parent_id) parent_name, | |||
materials.unit_id, | |||
materials.specification, | |||
materials.memo, | |||
materials.supplier_id, | |||
IFNULL(stock.quantity,0) quantity, | |||
stock.position_name, | |||
unit.unit_name, | |||
@@ -83,12 +90,17 @@ | |||
<select id="findDetailById" parameterType="com.deer.wms.produce.manage.model.MaterialsInfoParams" resultMap="MatInfoDTOResultMap"> | |||
SELECT | |||
materials.id, | |||
materials.code, | |||
materials.create_time, | |||
materials.materials_name, | |||
materials.parent_id, | |||
(SELECT m.materials_name FROM mt_alone_materials_info m | |||
WHERE m.id = materials.parent_id ) parent_name, | |||
WHERE m.id = materials.parent_id) parent_name, | |||
materials.unit_id, | |||
materials.specification, | |||
materials.memo, | |||
materials.supplier_id, | |||
IFNULL(stock.quantity,0) quantity, | |||
stock.position_name, | |||
unit.unit_name, | |||
@@ -106,7 +118,7 @@ | |||
AND materials.id = #{materialsId} | |||
</if> | |||
<if test="companyId != null"> | |||
AND com.company_id = #{companyId} | |||
AND materials.company_id = #{companyId} | |||
</if> | |||
</where> | |||
</select> | |||
@@ -60,7 +60,7 @@ public class MaterialsInfoServiceImpl extends AbstractService<MaterialsInfo, Int | |||
materialsStockInfoService.deleteById(stock.getId()); | |||
MaterialsOutgoingLogParams params = new MaterialsOutgoingLogParams(); | |||
params.setMaterialsId(materialsId); | |||
params.setCompanyId(1); | |||
params.setCompanyId(currentUser.getCompanyId()); | |||
List<MaterialsOutgoingLogVo> materialsOutgoingLogList = materialsOutgoingLogService.findListByOneMaterial(params); | |||
if((null!=materialsOutgoingLogList) && (materialsOutgoingLogList.size()!=0)){ | |||
@@ -71,7 +71,7 @@ public class MaterialsInfoServiceImpl extends AbstractService<MaterialsInfo, Int | |||
if((null!=ids) && (ids.size()!=0)) { | |||
HashMap outgoingParam = new HashMap(); | |||
outgoingParam.put("companyId", 1); | |||
outgoingParam.put("companyId", currentUser.getCompanyId()); | |||
outgoingParam.put("ids", ids); | |||
materialsOutgoingLogService.deleteByOutgoingIds(outgoingParam); | |||
} | |||
@@ -84,9 +84,9 @@ public class MaterialsInfoController { | |||
@ApiOperation(value = "删除物料", notes = "删除物料") | |||
@DeleteMapping("/delete") | |||
public Result delete(Integer materialsId, @ApiIgnore @User CurrentUser currentUser) { | |||
//if(currentUser==null){ | |||
// return ResultGenerator.genFailResult(CommonCode.SERVICE_ERROR,"未登录错误",null ); | |||
//} | |||
if(currentUser==null){ | |||
return ResultGenerator.genFailResult(CommonCode.SERVICE_ERROR,"未登录错误",null ); | |||
} | |||
materialsInfoService.deleteRelevantById(materialsId, currentUser); | |||
return ResultGenerator.genSuccessResult(); | |||
@@ -124,12 +124,12 @@ public class MaterialsInfoController { | |||
@ApiOperation(value = "获取某种物料详细信息", notes = "获取某种物料详细信息") | |||
@GetMapping("/detail") | |||
public Result detail(MaterialsInfoParams params, @ApiIgnore @User CurrentUser currentUser) { | |||
if(currentUser==null){ | |||
return ResultGenerator.genFailResult(CommonCode.SERVICE_ERROR,"未登录错误",null ); | |||
} | |||
//if(currentUser==null){ | |||
// return ResultGenerator.genFailResult(CommonCode.SERVICE_ERROR,"未登录错误",null ); | |||
//} | |||
StringUtil.trimObjectStringProperties(params); | |||
params.setCompanyId(currentUser.getCompanyId()); | |||
params.setCompanyId(1); | |||
MaterialsInfoDto materialsInfoDto = materialsInfoService.findDetailById(params); | |||
return ResultGenerator.genSuccessResult(materialsInfoDto); | |||
} | |||
@@ -1,44 +0,0 @@ | |||
package com.deer.wms.produce.manage.web; | |||
import com.alibaba.fastjson.JSON; | |||
import com.alibaba.fastjson.JSONArray; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.deer.wms.intercept.annotation.User; | |||
import com.deer.wms.intercept.common.data.CurrentUser; | |||
import com.deer.wms.produce.manage.model.*; | |||
import com.deer.wms.project.seed.core.result.Result; | |||
import com.deer.wms.project.seed.core.result.ResultGenerator; | |||
import io.swagger.annotations.Api; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
import org.springframework.web.client.RestTemplate; | |||
import springfox.documentation.annotations.ApiIgnore; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
/** | |||
* Created by on 2019/09/09. | |||
*/ | |||
@Api(description = "其他服务接口") | |||
@RestController | |||
@RequestMapping("/other/service") | |||
public class OtherServiceController { | |||
private String ipUrl = "http://132.232.34.114:9060/wms/"; | |||
@Autowired | |||
private RestTemplate restTemplate; | |||
//获取所有客户 | |||
@GetMapping | |||
public Result getClients() { | |||
JSONObject jsonObject = restTemplate.getForObject(ipUrl+"client/manages/list/new", JSONObject.class); | |||
JSONObject data = jsonObject.getJSONObject("data"); | |||
JSONArray listJson = data.getJSONArray("list"); | |||
List list = JSON.parseObject(listJson.toJSONString(), ArrayList.class); | |||
return ResultGenerator.genSuccessResult(list); | |||
} | |||
} |