ICSReceiptHeaderServiceImpl.java
7.89 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
package com.huaheng.pc.u8.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.huaheng.common.utils.DateUtils;
import com.huaheng.common.utils.StringUtils;
import com.huaheng.common.utils.Wrappers;
import com.huaheng.pc.config.company.domain.CompanyU8;
import com.huaheng.pc.config.company.service.CompanyU8Service;
import com.huaheng.pc.config.customer.service.CustomerServiceImpl;
import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail;
import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader;
import com.huaheng.pc.system.user.domain.User;
import com.huaheng.pc.system.user.service.IUserService;
import com.huaheng.pc.task.taskHeader.domain.TaskHeader;
import com.huaheng.pc.u8.domain.ICSReceiptHeader;
import com.huaheng.pc.u8.mapper.ICSReceiptHeaderMapper;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 入库下发或回传主单 实现层
*
* @author huaheng
* @date 2019-1-2
*/
@Service
public class ICSReceiptHeaderServiceImpl extends ServiceImpl<ICSReceiptHeaderMapper, ICSReceiptHeader> implements ICSReceiptHeaderService{
@Resource
private CompanyU8Service companyU8Service;
@Resource
private CustomerServiceImpl customerService;
@Resource
private IUserService userService;
@Override
public ICSReceiptHeader getHeaderByPI(ReceiptHeader header) {
String warehouseCode = header.getWarehouseCode();
header.getCompanyCode();
CompanyU8 companyU8 = companyU8Service.getCompanyU8ByCode(header.getCompanyCode(), header.getWarehouseCode());
ICSReceiptHeader rh = new ICSReceiptHeader();
rh.setReferCode(header.getReferCode());
rh.setReferId(header.getReferId());
rh.setCCode(header.getReferCode());
rh.setCompanyCode(companyU8.getUCompanyCode());
rh.setCWHCode(header.getUWarehouseCode());
rh.setCVenCode(header.getSupplierCode());
rh.setCVenName(header.getSupplierName());
rh.setCWHCode(header.getUWarehouseCode());
rh.setCBusType("普通采购");
rh.setCDepCode(header.getDeptCode());
rh.setCDepName(header.getCDeptName());
rh.setID(header.getId());
rh.setDPODate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,DateUtils.getNowDate()));
rh.setCModifyDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,DateUtils.getNowDate()));
rh.setCMemo(header.getReceiptNote());
rh.setCMaker(header.getLastUpdatedBy());
rh.setVoucherType("CreateICSRdRecord_01");
rh.setType(header.getReceiptType());
return rh;
}
@Override
public ICSReceiptHeader getHeaderByPCI(ReceiptHeader header) {
ICSReceiptHeader rh = new ICSReceiptHeader();
return null;
}
@Override
public ICSReceiptHeader getHeaderByCI(ReceiptHeader header) {
ICSReceiptHeader rh = new ICSReceiptHeader();
CompanyU8 companyU8 = companyU8Service.getCompanyU8ByCode(header.getCompanyCode(), header.getWarehouseCode());
rh.setCCode(header.getReferCode());
rh.setCompanyCode(companyU8.getUCompanyCode());
rh.setCWHCode(header.getUWarehouseCode());
rh.setCBusType(header.getTypeName());
rh.setID(header.getReferId());
rh.setDDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,DateUtils.getNowDate()));
rh.setCModifyDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,DateUtils.getNowDate()));
rh.setCMemo(header.getReceiptNote());
rh.setCMaker(header.getLastUpdatedBy());
rh.setVoucherType("UpdateICSRdRecord_11_Return_Confirm");
rh.setType(header.getReceiptType());
return rh;
}
@Override
public ICSReceiptHeader getHeaderBySRI(ReceiptHeader header) {
ICSReceiptHeader rh = new ICSReceiptHeader();
CompanyU8 companyU8 = companyU8Service.getCompanyU8ByCode(header.getCompanyCode(), header.getWarehouseCode());
rh.setCBusType("普通销售");
rh.setCCode(header.getReferCode());
rh.setCCusCode(header.getCustomerCode());
rh.setCDLCode(header.getReferCode());
rh.setCDepCode(header.getDeptCode());
rh.setCMaker(header.getLastUpdatedBy());
rh.setCModifyDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,DateUtils.getNowDate()));
rh.setCPersonCode(header.getPersonCode());
rh.setCSTName("普通销售");
rh.setCWHCode(header.getUWarehouseCode());
rh.setCompanyCode(companyU8.getUCompanyCode());
rh.setCMemo(header.getReceiptNote());
rh.setDDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,DateUtils.getNowDate()));
rh.setDLID(header.getReferId());
rh.setID(header.getReferId());
rh.setType(header.getReceiptType());
rh.setVoucherType("CreateICSRdRecord_32_Return");
rh.setReferCode(header.getReferCode());
rh.setReferId(header.getReferId());
return rh;
}
@Override
public ICSReceiptHeader getHeaderBySI(ReceiptHeader receiptHeader, TaskHeader taskHeader) {
String warehouseCode = taskHeader.getWarehouseCode();
String companyCode = taskHeader.getCompanyCode();
CompanyU8 companyU8 = companyU8Service.getCompanyU8ByCode(companyCode, warehouseCode);
ICSReceiptHeader icsReceiptHeader = new ICSReceiptHeader();
icsReceiptHeader.setCBusType("产品入库");
icsReceiptHeader.setCWHCode(receiptHeader.getUWarehouseCode());
icsReceiptHeader.setVoucherType("CreateICSRdRecord_10");
User user=new User();
user.setUserName(taskHeader.getCreatedBy());
List<User> users = userService.selectUserList(user);
if(CollectionUtils.isNotEmpty(users)){
icsReceiptHeader.setCMaker(users.get(0).getLoginName());
}else {
icsReceiptHeader.setCMaker(taskHeader.getCreatedBy());
}
icsReceiptHeader.setCDepCode(receiptHeader.getDeptCode());
icsReceiptHeader.setCMemo("");
icsReceiptHeader.setCompanyCode(companyU8.getUCompanyCode());
icsReceiptHeader.setDPODate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,taskHeader.getLastUpdated()));
return icsReceiptHeader;
}
@Override
public ICSReceiptHeader selectModel(ICSReceiptHeader model){
LambdaQueryWrapper<ICSReceiptHeader> lamb = Wrappers.lambdaQuery();
lamb.eq(StringUtils.isNotNull(model.getID()),ICSReceiptHeader::getID,model.getID());
lamb.eq(StringUtils.isNotEmpty(model.getCTVCode()),ICSReceiptHeader::getCTVCode,model.getCTVCode());
lamb.eq(StringUtils.isNotEmpty(model.getIWHCode()),ICSReceiptHeader::getIWHCode,model.getIWHCode());
lamb.eq(StringUtils.isNotEmpty(model.getCompanyCode()),ICSReceiptHeader::getCompanyCode,model.getCompanyCode());
lamb.eq(StringUtils.isNotEmpty(model.getCCode()),ICSReceiptHeader::getCCode,model.getCCode());
lamb.last("limit 1");
return this.getOne(lamb);
}
@Override
public List<ICSReceiptHeader> selectModelList(ICSReceiptHeader model){
LambdaQueryWrapper<ICSReceiptHeader> lamb = Wrappers.lambdaQuery();
lamb.eq(StringUtils.isNotEmpty(model.getCTVCode()),ICSReceiptHeader::getCTVCode,model.getCTVCode());
lamb.eq(StringUtils.isNotNull(model.getID()),ICSReceiptHeader::getID,model.getID());
lamb.eq(StringUtils.isNotEmpty(model.getIWHCode()),ICSReceiptHeader::getIWHCode,model.getIWHCode());
lamb.eq(StringUtils.isNotEmpty(model.getCompanyCode()),ICSReceiptHeader::getCompanyCode,model.getCompanyCode());
lamb.eq(StringUtils.isNotEmpty(model.getCCode()),ICSReceiptHeader::getCCode,model.getCCode());
lamb.eq(StringUtils.isNotEmpty(model.getWarehouseCode()),ICSReceiptHeader::getWarehouseCode,model.getWarehouseCode());
return this.list(lamb);
}
}