CyclecountAPIService.java
2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package com.huaheng.api.general.service;
import com.alibaba.fastjson.JSON;
import com.huaheng.common.utils.http.HttpUtils;
import com.huaheng.framework.web.domain.AjaxResult;
import com.huaheng.pc.inventory.cyclecountAdjust.domain.CyclecountAdjust;
import com.huaheng.pc.inventory.cyclecountAdjust.domain.CyclecountAdjustModel;
import com.huaheng.pc.inventory.cyclecountAdjust.mapper.CyclecountAdjustMapperAuto;
import com.huaheng.pc.inventory.cyclecountAdjust.service.ICycleconutAdjustService;
import com.huaheng.pc.inventory.cyclecountAdjustDetail.domain.CyclecountAdjustDetail;
import com.huaheng.pc.inventory.cyclecountAdjustDetail.service.ICyclecountAdjustDetailService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 盘点差异接口服务层
* @author huaheng
* @date 2019-1-8
*
*
*
*/
@Service
public class CyclecountAPIService {
@Resource
private CyclecountAdjustMapperAuto cyclecountAdjustMapperAuto;
@Resource
private ICycleconutAdjustService cycleconutAdjustService;
@Resource
private ICyclecountAdjustDetailService cyclecountAdjustDetailService;
public AjaxResult confirm(String url) {
//查找状态为10的盘点差异主单
CyclecountAdjust cyclecountAdjust=new CyclecountAdjust();
cyclecountAdjust.setStatus(10);
cyclecountAdjust=cyclecountAdjustMapperAuto.selectFirstEntity(cyclecountAdjust);
if(cyclecountAdjust==null){
return AjaxResult.error("没有盘点差异上传");
}
//通过主单id找到子单
CyclecountAdjustDetail cyclecountAdjustDetail=new CyclecountAdjustDetail();
cyclecountAdjustDetail.setCyclecountAdjustCode(cyclecountAdjust.getCode());
List<CyclecountAdjustDetail> cyclecountAdjustDetails=cyclecountAdjustDetailService.selectListEntityByEqual(cyclecountAdjustDetail);
//把主单和子单整合到一起
CyclecountAdjustModel cyclecountAdjustModel=new CyclecountAdjustModel();
cyclecountAdjustModel.setCyclecountAdjust(cyclecountAdjust);
cyclecountAdjustModel.setCyclecountAdjustDetails(cyclecountAdjustDetails);
String JsonParam = JSON.toJSONString(cyclecountAdjustModel);
String result = HttpUtils.sendPost(url, JsonParam);
AjaxResult ajaxResult = JSON.parseObject(result, AjaxResult.class);
cyclecountAdjust.setStatus(20);
cycleconutAdjustService.updateByModel(cyclecountAdjust);
return ajaxResult;
}
}