diff --git a/warehousing-system/project/wh-manage/src/main/java/com/wh/controller/purchasenew/PurchasenewController.java b/warehousing-system/project/wh-manage/src/main/java/com/wh/controller/purchasenew/PurchasenewController.java index 8f284480..740e0fb1 100644 --- a/warehousing-system/project/wh-manage/src/main/java/com/wh/controller/purchasenew/PurchasenewController.java +++ b/warehousing-system/project/wh-manage/src/main/java/com/wh/controller/purchasenew/PurchasenewController.java @@ -29,7 +29,7 @@ public class PurchasenewController { @PostMapping("/listAll") public ResultBean> listAll(){ ResultBean rb = ResultBean.fireFail(); - List list = purchasenewService.list(); + List list = purchasenewService.listForInput(); return rb.success().setData(list); } diff --git a/warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/purchasenew/PurchasenewMapper.java b/warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/purchasenew/PurchasenewMapper.java index 48925d0e..a30dde75 100644 --- a/warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/purchasenew/PurchasenewMapper.java +++ b/warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/purchasenew/PurchasenewMapper.java @@ -71,4 +71,6 @@ public interface PurchasenewMapper extends BaseMapper { */ @Update("update purchasenew set status='2' where sid=#{sid}") int updatePutInStatus(@Param("sid") String sid); + @Select("select * from purchasenew where state=1") + List listForInput(); } \ No newline at end of file diff --git a/warehousing-system/project/wh-manage/src/main/java/com/wh/service/api/instorehouse/InStorehouseMainService.java b/warehousing-system/project/wh-manage/src/main/java/com/wh/service/api/instorehouse/InStorehouseMainService.java index 57670e97..86d30b1f 100644 --- a/warehousing-system/project/wh-manage/src/main/java/com/wh/service/api/instorehouse/InStorehouseMainService.java +++ b/warehousing-system/project/wh-manage/src/main/java/com/wh/service/api/instorehouse/InStorehouseMainService.java @@ -18,6 +18,7 @@ import com.wh.pojo.purchasenew.Purchasenew; import com.wh.pojo.purchasenew.PurchasenewDto; import com.wh.pojo.purchasenewproduct.PurchasenewProduct; import com.wh.pojo.purchasenewproduct.PurchasenewProductDto; +import com.wh.pojo.purchasenewproduct.PurchasenewProductVo; import com.wh.service.api.prodstock.ProdStockService; import com.wh.service.purchasenew.PurchasenewService; import com.wh.service.purchasenewproduct.PurchasenewProductService; @@ -53,7 +54,8 @@ public class InStorehouseMainService extends MybatisBaseService r = ResultBean.fireFail(); if(inStoreHouseMainDto==null){ @@ -62,21 +64,58 @@ public class InStorehouseMainService extends MybatisBaseService purchasenewWrapper = new QueryWrapper<>(); + purchasenewWrapper.eq("purchase_no",inStoreHouseMainDto.getNo()); + List list1 = purchasenewService.list(purchasenewWrapper); + if(list1==null||list1.size()==0){ + return r.setMsg("申请单不存在"); + } + Purchasenew purchasenew = list1.get(0); + PurchasenewDto dto =new PurchasenewDto(); + BeanUtil.copyProperties(purchasenew,dto); + String purchaseSid=purchasenew.getSid(); QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("no",inStoreHouseMainDto.getNo()); - if(baseMapper.selectCount(queryWrapper) != 0){ - return r.setMsg("申请单编号已经存在"); + queryWrapper.eq("purchase_sid",purchasenew.getSid()); + List inStorehouseMains = baseMapper.selectList(queryWrapper); + if(inStorehouseMains!=null&&inStorehouseMains.size()>0){ + return r.setMsg("申请单编号已经入库"); + } + List purchasenewProductVos = + purchasenewProductService.fetchDetailsVoByPurchaseSid(purchaseSid); + List products=new ArrayList<>(); + for (PurchasenewProductVo purchasenewProductVo : purchasenewProductVos) { + PurchasenewProductDto d=new PurchasenewProductDto(); + BeanUtil.copyProperties(purchasenewProductVo,d); + products.add(d); } + dto.setProducts(products); + saveOrUpdateByPurchaseSid(dto,purchaseSid); +// InStorehouseMain in=new InStorehouseMain(); +// BeanUtils.copyProperties(inStoreHouseMainDto,in); +// List list = inStoreHouseMainDto.getList(); +// if(list==null||list.size()==0){ +// return r.setMsg("商品不能为空"); +// } +// //申请单主表信息 +// baseMapper.insert(in); +// addListing(in, list); + return ResultBean.fireSuccess().setMsg("添加成功"); + } + @Transactional + public ResultBean addInStorehouses(InStoreHouseMainDto inStoreHouseMainDto) { + ResultBean r = ResultBean.fireFail(); + InStorehouseMain in=new InStorehouseMain(); BeanUtils.copyProperties(inStoreHouseMainDto,in); List list = inStoreHouseMainDto.getList(); - if(list==null||list.size()==0){ - return r.setMsg("商品不能为空"); - } + //申请单主表信息 baseMapper.insert(in); addListing(in, list); + purchasenewService.updateStateToInputBySid(in.getPurchaseSid()); return ResultBean.fireSuccess().setMsg("添加成功"); + } public PagerVo listPage(PagerQuery pq) { InStorehouseMainQuery query = pq.getParams(); @@ -271,7 +310,7 @@ public class InStorehouseMainService extends MybatisBaseService locationList = locationMapper.selectList(locationQueryWrapper); List receivingIdList = new ArrayList<>(); - List locationIdList = new ArrayList<>(); + List locationIdList = new ArrayList<>(); for (Receiving receiving : receivingList){ receivingIdList.add(receiving.getReceivingId()); @@ -83,7 +83,7 @@ public class PutInServiceImpl implements PutInService { if (locationList != null){ for (Location location : locationList){ - locationIdList.add(location.getLocationId()); + locationIdList.add(location); } } diff --git a/warehousing-system/project/wh-manage/src/main/java/com/wh/service/purchasenew/PurchasenewService.java b/warehousing-system/project/wh-manage/src/main/java/com/wh/service/purchasenew/PurchasenewService.java index e46b2b15..73bb3398 100644 --- a/warehousing-system/project/wh-manage/src/main/java/com/wh/service/purchasenew/PurchasenewService.java +++ b/warehousing-system/project/wh-manage/src/main/java/com/wh/service/purchasenew/PurchasenewService.java @@ -172,4 +172,14 @@ public class PurchasenewService extends MybatisBaseService listForInput() { + return baseMapper.listForInput(); + } + + public void updateStateToInputBySid(String purchaseSid) { + Purchasenew purchasenew = fetchBySid(purchaseSid); + purchasenew.setState(2); + baseMapper.updateById(purchasenew); + } } diff --git a/warehousing-system/project_web/src/components/instorehouse/putIn.vue b/warehousing-system/project_web/src/components/instorehouse/putIn.vue index 224293ff..9b74c921 100644 --- a/warehousing-system/project_web/src/components/instorehouse/putIn.vue +++ b/warehousing-system/project_web/src/components/instorehouse/putIn.vue @@ -22,7 +22,7 @@ :key="i" :label="item.purchaseNo" :value="item.purchaseNo" - > + > @@ -36,7 +36,7 @@ @@ -68,13 +68,16 @@ export default { data() { return { user: "", - dingdanId: {}, - huoweiId: {}, + dingdanId: [], + huoweiId: [], inStorehouse: { inStorehouseId: "", receivingId: "", locationId: "", remarks: "", + no:'', + storeHouseSid:"", + storeHouseName:"", createPerson: "", checkPerson: "", status: "", @@ -85,7 +88,7 @@ export default { size: 100, params: { purchaseNo:'' - } + } }, queryPamas: { query: '', @@ -104,9 +107,9 @@ export default { }, methods: { async getOptions() { - const { data: result } = await this.$http.post('/purchasenew/listPage', { params: this.queryInfos }) + const { data: result } = await this.$http.post('/purchasenew/listAll', { params: this.queryInfos }) const { data: datas } = await this.$http.get('/location/list', { params: this.queryPamas }) - this.dingdanId = result.data.records; + this.dingdanId = result.data; this.huoweiId = datas.data.rows; }, @@ -117,13 +120,22 @@ export default { this.inStorehouse.createPerson = this.user; const now = new Date(); this.inStorehouse.inStorehouseId = "IN" + now.getTime(); + this.inStorehouse.no = this.inStorehouse.receivingId + this.inStorehouse.storeHouseSid = this.inStorehouse.locationId + let location =this.huoweiId.find((item)=>{ + return item.locationId === this.inStorehouse.locationId;//筛选出匹配数据 + }) + this.inStorehouse.storeHouseName= location.name; // const { data: result } = await this.$http.post('/putIn/addInStorehouse', this.inStorehouse) const { data: result } = await this.$http.post( "/input/addInStorehouse", this.inStorehouse ); - if (result.status === 201) return this.$message.error("入库失败"); - this.$message.success(result.data); + if (result.code != 200){ + alert(result.msg); + return ; + } + alert('操作成功'); this.$refs.onPutInRuleForm.resetFields(); }); }, diff --git a/warehousing-system/project_web/src/main.js b/warehousing-system/project_web/src/main.js index 09b6fc27..a8fc19d2 100644 --- a/warehousing-system/project_web/src/main.js +++ b/warehousing-system/project_web/src/main.js @@ -18,7 +18,6 @@ import axios from 'axios' /* 设定axios的请求根目录 */ axios.defaults.baseURL = 'http://jianguan.yyundong.com/warehouseapi/' //axios.defaults.baseURL = 'http://127.0.0.1:9050/' -// axios.defaults.baseURL = 'http://192.168.3.183:9050/' // axios.defaults.baseURL = 'http://manage.jt.com/' // axios.defaults.baseURL = 'http://yichuwh.com/'