|
@@ -7,6 +7,9 @@ import org.jeecg.modules.documents.seclarationElements.entity.SyDeclarationEleme
|
|
|
import org.jeecg.modules.documents.seclarationElements.mapper.SyDeclarationElementsMapper;
|
|
|
import org.jeecg.modules.documents.seclarationElements.service.ISyDeclarationElementsItemService;
|
|
|
import org.jeecg.modules.documents.seclarationElements.service.ISyDeclarationElementsService;
|
|
|
+import org.jeecg.modules.documents.shippingDetails.entity.SyShippingDetailsItem;
|
|
|
+import org.jeecg.modules.documents.shippingDetails.service.ISyShippingDetailsItemService;
|
|
|
+import org.jeecg.modules.documents.shippingDetails.service.ISyShippingDetailsService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -27,6 +30,10 @@ public class SyDeclarationElementsServiceImpl extends ServiceImpl<SyDeclarationE
|
|
|
|
|
|
@Autowired
|
|
|
private ISyDeclarationElementsItemService syDeclarationElementsItemService;
|
|
|
+ @Autowired
|
|
|
+ private ISyShippingDetailsItemService syShippingDetailsItemService;
|
|
|
+ @Autowired
|
|
|
+ private ISyShippingDetailsService syShippingDetailsService;
|
|
|
|
|
|
|
|
|
* 新增(发运明细调用)
|
|
@@ -35,55 +42,100 @@ public class SyDeclarationElementsServiceImpl extends ServiceImpl<SyDeclarationE
|
|
|
*/
|
|
|
@Override
|
|
|
public SyDeclarationElements syDeclarationElementsAdd(SyDeclarationElements syDeclarationElements) {
|
|
|
-
|
|
|
- List<SyDeclarationElementsItem> syDeclarationElementsItemListUpdate = new ArrayList<SyDeclarationElementsItem>();
|
|
|
-
|
|
|
- String ids = syDeclarationElements.getId();
|
|
|
-
|
|
|
- if(oConvertUtils.isEmpty(ids)){
|
|
|
- String id = oConvertUtils.id();
|
|
|
-
|
|
|
- List<SyDeclarationElementsItem> syDeclarationElementsItemList = new ArrayList<SyDeclarationElementsItem>();
|
|
|
-
|
|
|
- syDeclarationElements.setId(id);
|
|
|
-
|
|
|
- List<SyDeclarationElementsItem> list = syDeclarationElements.getSyDeclarationElementsItemList();
|
|
|
- for (SyDeclarationElementsItem item:list){
|
|
|
- item.setId(oConvertUtils.id());
|
|
|
- item.setSyDeclarationElementsId(id);
|
|
|
- syDeclarationElementsItemList.add(item);
|
|
|
- }
|
|
|
- if(syDeclarationElementsItemList.size()!=0){
|
|
|
- syDeclarationElementsItemService.saveBatch(syDeclarationElementsItemList);
|
|
|
- }
|
|
|
-
|
|
|
- boolean ok = save(syDeclarationElements);
|
|
|
- if(ok){
|
|
|
- return syDeclarationElements;
|
|
|
- }
|
|
|
-
|
|
|
- }else{
|
|
|
+
|
|
|
+ List<SyDeclarationElementsItem> syDeclarationElementsItemList = new ArrayList<SyDeclarationElementsItem>();
|
|
|
+
|
|
|
+
|
|
|
|
|
|
-
|
|
|
- QueryWrapper<SyDeclarationElementsItem> queryWrapperItem = new QueryWrapper<SyDeclarationElementsItem>();
|
|
|
- queryWrapperItem.eq("sy_declaration_elements_id", ids).eq("del_flag", 0);
|
|
|
- List<SyDeclarationElementsItem> syDeclarationElementsItemsList = syDeclarationElementsItemService.list(queryWrapperItem);
|
|
|
- for(SyDeclarationElementsItem li:syDeclarationElementsItemsList){
|
|
|
- li.setDelFlag("1");
|
|
|
+
|
|
|
+ String ids = syDeclarationElements.getSyShippingids();
|
|
|
+ String elementid = syDeclarationElements.getId();
|
|
|
+ List<String> shippingList = new ArrayList<>();
|
|
|
+ String shSplit[] = ids.split(",");
|
|
|
+ for (String s : shSplit) {
|
|
|
+ shippingList.add(s);
|
|
|
}
|
|
|
- syDeclarationElementsItemService.updateBatchById(syDeclarationElementsItemsList);
|
|
|
+ String id = oConvertUtils.id();
|
|
|
+
|
|
|
+ QueryWrapper<SyShippingDetailsItem> shiItemQuery = new QueryWrapper<>();
|
|
|
+ shiItemQuery.in("id", shippingList);
|
|
|
+ List<SyShippingDetailsItem> shList = syShippingDetailsItemService.list(shiItemQuery);
|
|
|
+
|
|
|
+ SyShippingDetailsItem zero = shList.get(0);
|
|
|
+
|
|
|
+ syDeclarationElements.setId(id);
|
|
|
+ syDeclarationElements.setInventoryCode(zero.getInventoryCode());
|
|
|
+ syDeclarationElements.setAcSetNo(zero.getAccount());
|
|
|
+ syDeclarationElements.setItemNumber(zero.getItemNumber());
|
|
|
+ syDeclarationElements.setInventoryName(zero.getInventoryName());
|
|
|
|
|
|
-
|
|
|
List<SyDeclarationElementsItem> list = syDeclarationElements.getSyDeclarationElementsItemList();
|
|
|
- for (SyDeclarationElementsItem item:list){
|
|
|
+ for (SyDeclarationElementsItem item : list) {
|
|
|
item.setId(oConvertUtils.id());
|
|
|
- item.setSyDeclarationElementsId(syDeclarationElements.getId());
|
|
|
- syDeclarationElementsItemListUpdate.add(item);
|
|
|
+ item.setSyDeclarationElementsId(id);
|
|
|
+ syDeclarationElementsItemList.add(item);
|
|
|
+ }
|
|
|
+ if (syDeclarationElementsItemList.size() != 0) {
|
|
|
+ syDeclarationElementsItemService.saveBatch(syDeclarationElementsItemList);
|
|
|
}
|
|
|
- if(syDeclarationElementsItemListUpdate.size()!=0){
|
|
|
- syDeclarationElementsItemService.saveBatch(syDeclarationElementsItemListUpdate);
|
|
|
+
|
|
|
+ if(oConvertUtils.isNotEmpty(elementid)){
|
|
|
+ syShippingDetailsService.updateElenmentId(id,elementid);
|
|
|
+ }else{
|
|
|
+ syShippingDetailsService.writeBackElenmentId(id,shippingList);
|
|
|
}
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+ boolean ok = save(syDeclarationElements);
|
|
|
+ if (ok) {
|
|
|
+ return syDeclarationElements;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
return syDeclarationElements;
|
|
|
}
|
|
|
}
|