|
@@ -1,13 +1,27 @@
|
|
package com.ruoyi.basicData.service.impl;
|
|
package com.ruoyi.basicData.service.impl;
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
|
|
|
+import com.ruoyi.basicData.domain.TCorps;
|
|
|
|
+import com.ruoyi.basicData.domain.TCustomerContact;
|
|
import com.ruoyi.basicData.domain.TWarehouse;
|
|
import com.ruoyi.basicData.domain.TWarehouse;
|
|
|
|
+import com.ruoyi.basicData.domain.TWarehouseArea;
|
|
|
|
+import com.ruoyi.basicData.mapper.TCustomerContactMapper;
|
|
|
|
+import com.ruoyi.basicData.mapper.TWarehouseAreaMapper;
|
|
import com.ruoyi.basicData.mapper.TWarehouseMapper;
|
|
import com.ruoyi.basicData.mapper.TWarehouseMapper;
|
|
import com.ruoyi.basicData.service.ITWarehouseService;
|
|
import com.ruoyi.basicData.service.ITWarehouseService;
|
|
|
|
+import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
|
+import com.ruoyi.common.core.domain.model.LoginUser;
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
|
+import com.ruoyi.common.utils.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import java.util.Date;
|
|
|
|
+import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 仓库Service业务层处理
|
|
* 仓库Service业务层处理
|
|
@@ -20,6 +34,9 @@ public class TWarehouseServiceImpl implements ITWarehouseService {
|
|
@Autowired
|
|
@Autowired
|
|
private TWarehouseMapper tWarehouseMapper;
|
|
private TWarehouseMapper tWarehouseMapper;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private TWarehouseAreaMapper tWarehouseAreaMapper;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 查询仓库
|
|
* 查询仓库
|
|
*
|
|
*
|
|
@@ -31,6 +48,22 @@ public class TWarehouseServiceImpl implements ITWarehouseService {
|
|
return tWarehouseMapper.selectTWarehouseById(fId);
|
|
return tWarehouseMapper.selectTWarehouseById(fId);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public Map<String, Object> selectTWarehouseById1(Long fId) {
|
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
|
+ TWarehouse tWarehouse = tWarehouseMapper.selectTWarehouseById(fId);
|
|
|
|
+ if (StringUtils.isNotNull(tWarehouse)) {
|
|
|
|
+ map.put("tWarehouse", tWarehouse);
|
|
|
|
+ }
|
|
|
|
+ TWarehouseArea tWarehouseArea= new TWarehouseArea();
|
|
|
|
+ tWarehouseArea.setfWarehouseid(fId);
|
|
|
|
+ List<TWarehouseArea> tWarehouseAreaList =tWarehouseAreaMapper.selectTWarehouseAreaList(tWarehouseArea);
|
|
|
|
+ if (StringUtils.isNotEmpty(tWarehouseAreaList)) {
|
|
|
|
+ map.put("tWarehouseArea", tWarehouseAreaList);
|
|
|
|
+ }
|
|
|
|
+ return map;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 查询仓库列表
|
|
* 查询仓库列表
|
|
*
|
|
*
|
|
@@ -54,6 +87,41 @@ public class TWarehouseServiceImpl implements ITWarehouseService {
|
|
return tWarehouseMapper.insertTWarehouse(tWarehouse);
|
|
return tWarehouseMapper.insertTWarehouse(tWarehouse);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public AjaxResult insertTWarehouse1(String tWarehouse, String tWarehouseArea, LoginUser loginUser) {
|
|
|
|
+ if (StringUtils.isEmpty(tWarehouse)) {
|
|
|
|
+ return AjaxResult.error("提交失败:仓库信息为空");
|
|
|
|
+ }
|
|
|
|
+ if ( StringUtils.isEmpty(tWarehouseArea) ) {
|
|
|
|
+ return AjaxResult.error("提交失败:库区为空");
|
|
|
|
+ }
|
|
|
|
+ Long fPid = null;
|
|
|
|
+ TWarehouse tWarehouses = JSONArray.parseObject(tWarehouse, TWarehouse.class);
|
|
|
|
+ JSONArray jsonArray = JSONArray.parseArray(tWarehouseArea);
|
|
|
|
+ List<TWarehouseArea> tWarehouseAreaList = JSONObject.parseArray(jsonArray.toJSONString(), TWarehouseArea.class);
|
|
|
|
+ tWarehouses.setfStatus("0");
|
|
|
|
+ if (StringUtils.isNull(tWarehouses.getfId())) {
|
|
|
|
+ tWarehouses.setCreateBy(loginUser.getUser().getUserName());
|
|
|
|
+ tWarehouses.setCreateTime(new Date());
|
|
|
|
+ tWarehouseMapper.insertTWarehouse(tWarehouses);
|
|
|
|
+ fPid=tWarehouses.getfId();
|
|
|
|
+ } else {
|
|
|
|
+ fPid=tWarehouses.getfId();
|
|
|
|
+ tWarehouses.setUpdateBy(loginUser.getUser().getUserName());
|
|
|
|
+ tWarehouses.setUpdateTime(new Date());
|
|
|
|
+ tWarehouseMapper.updateTWarehouse(tWarehouses);
|
|
|
|
+ tWarehouseAreaMapper.deleteTWarehouseAreaByTWarehoused(fPid);
|
|
|
|
+ }
|
|
|
|
+ for (TWarehouseArea cc : tWarehouseAreaList) {
|
|
|
|
+ cc.setfWarehouseid(fPid);
|
|
|
|
+ cc.setfStatus("0");
|
|
|
|
+ cc.setCreateBy(loginUser.getUser().getUserName());
|
|
|
|
+ cc.setCreateTime(new Date());
|
|
|
|
+ tWarehouseAreaMapper.insertTWarehouseArea(cc);
|
|
|
|
+ }
|
|
|
|
+ return AjaxResult.success();
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 修改仓库
|
|
* 修改仓库
|
|
*
|
|
*
|