|
|
@@ -117,7 +117,6 @@ public class BusinessRpReportServiceImpl implements BusinessRpReportService {
|
|
117
|
117
|
@Override
|
|
118
|
118
|
public Map<String, Object> add(BusinessRpReport businessRpReport) {
|
|
119
|
119
|
Map<String,Object> result = new HashMap<>();
|
|
120
|
|
- result.put("status", "error");
|
|
121
|
120
|
List<BusinessRpInbound> businessRpInbound = businessRpReport.getBusinessRpInboundList();
|
|
122
|
121
|
// if (businessRpInbound.size() <= 0){
|
|
123
|
122
|
// result.put("msg", "出库信息不能为空");
|
|
|
@@ -134,12 +133,14 @@ public class BusinessRpReportServiceImpl implements BusinessRpReportService {
|
|
134
|
133
|
for (BusinessRpInbound br: inList) {
|
|
135
|
134
|
br.setCreatedate(new Date());
|
|
136
|
135
|
br.setUpdatedate(new Date());
|
|
|
136
|
+ br.setRpReportId(businessRpReport.getId());
|
|
137
|
137
|
businessRpInboundMapper.insertSelective(br);
|
|
138
|
138
|
}
|
|
139
|
139
|
List<BusinessRpOutbound> outlist =businessRpReport.getBusinessRpOutboundList();
|
|
140
|
140
|
for (BusinessRpOutbound ou: outlist) {
|
|
141
|
141
|
ou.setCreatedate(new Date());
|
|
142
|
142
|
ou.setUpdatedate(new Date());
|
|
|
143
|
+ ou.setRpReportId(businessRpReport.getId());
|
|
143
|
144
|
businessRpOutboundMapper.insertSelective(ou);
|
|
144
|
145
|
}
|
|
145
|
146
|
}else{//保存
|
|
|
@@ -165,24 +166,37 @@ public class BusinessRpReportServiceImpl implements BusinessRpReportService {
|
|
165
|
166
|
}else{//提交
|
|
166
|
167
|
|
|
167
|
168
|
if(businessRpReport.getId()!=null){//修改
|
|
|
169
|
+ //根据id查找主表数据
|
|
|
170
|
+ BusinessRpReportVO businessRpReportVO =businessRpReportMapper.getRpReportFindByById(businessRpReport.getId());
|
|
|
171
|
+ if(businessRpReportVO!=null){
|
|
|
172
|
+ result.put("status", "error");
|
|
|
173
|
+ result.put("msg", "请填写数据后再执行上传操作");
|
|
|
174
|
+ }
|
|
168
|
175
|
businessRpReportMapper.updateByPrimaryKeySelective(businessRpReport);
|
|
169
|
|
- businessRpInboundMapper.deleteByReportId(businessRpReport.getId());
|
|
170
|
|
- businessRpOutboundMapper.deleteByReportId(businessRpReport.getId());
|
|
171
|
176
|
List<BusinessRpInbound> inList =businessRpReport.getBusinessRpInboundList();
|
|
172
|
|
- for (BusinessRpInbound br: inList) {
|
|
173
|
|
- br.setCreatedate(new Date());
|
|
174
|
|
- br.setUpdatedate(new Date());
|
|
175
|
|
- br.setRpReportId(businessRpReport.getId());
|
|
176
|
|
- businessRpInboundMapper.insertSelective(br);
|
|
|
177
|
+ if(!inList.isEmpty()){
|
|
|
178
|
+ businessRpInboundMapper.deleteByReportId(businessRpReport.getId());
|
|
|
179
|
+ for (BusinessRpInbound br: inList) {
|
|
|
180
|
+ br.setCreatedate(new Date());
|
|
|
181
|
+ br.setUpdatedate(new Date());
|
|
|
182
|
+ br.setRpReportId(businessRpReport.getId());
|
|
|
183
|
+ businessRpInboundMapper.insertSelective(br);
|
|
|
184
|
+ }
|
|
177
|
185
|
}
|
|
178
|
186
|
List<BusinessRpOutbound> outlist =businessRpReport.getBusinessRpOutboundList();
|
|
179
|
|
- for (BusinessRpOutbound ou: outlist) {
|
|
180
|
|
- ou.setCreatedate(new Date());
|
|
181
|
|
- ou.setUpdatedate(new Date());
|
|
182
|
|
- ou.setRpReportId(businessRpReport.getId());
|
|
183
|
|
- businessRpOutboundMapper.insertSelective(ou);
|
|
184
|
|
- }
|
|
|
187
|
+ if(!outlist.isEmpty()){
|
|
|
188
|
+ businessRpOutboundMapper.deleteByReportId(businessRpReport.getId());
|
|
|
189
|
+ for (BusinessRpOutbound ou: outlist) {
|
|
|
190
|
+ ou.setCreatedate(new Date());
|
|
|
191
|
+ ou.setUpdatedate(new Date());
|
|
|
192
|
+ ou.setRpReportId(businessRpReport.getId());
|
|
|
193
|
+ businessRpOutboundMapper.insertSelective(ou);
|
|
|
194
|
+ }
|
|
|
195
|
+ }
|
|
|
196
|
+
|
|
|
197
|
+
|
|
185
|
198
|
}else{//保存
|
|
|
199
|
+
|
|
186
|
200
|
businessRpReport.setCreateTime(new Date());
|
|
187
|
201
|
businessRpReport.setUpdateTime(new Date());
|
|
188
|
202
|
businessRpReportMapper.insert(businessRpReport);
|