|
@@ -30,7 +30,7 @@ import java.util.List;
|
|
|
/**
|
|
|
* @Description: 报关要素
|
|
|
* @Author: jeecg-boot
|
|
|
- * @Date: 2022-05-23
|
|
|
+ * @Date: 2022-05-23
|
|
|
* @Version: V1.0
|
|
|
*/
|
|
|
@Service
|
|
@@ -57,18 +57,19 @@ public class SyDeclarationElementsServiceImpl extends ServiceImpl<SyDeclarationE
|
|
|
|
|
|
/**
|
|
|
* 新增(发运明细调用)
|
|
|
+ *
|
|
|
* @param syDeclarationElements
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public SyDeclarationElements syDeclarationElementsAdd(SyDeclarationElements syDeclarationElements,String type,String code) {
|
|
|
+ public SyDeclarationElements syDeclarationElementsAdd(SyDeclarationElements syDeclarationElements, String type, String code) {
|
|
|
//子表集合
|
|
|
List<SyDeclarationElementsItem> syDeclarationElementsItemList = new ArrayList<SyDeclarationElementsItem>();
|
|
|
- //获取发运明细子表ID
|
|
|
- String ids = syDeclarationElements.getSyShippingids();
|
|
|
- String elementid = syDeclarationElements.getId();
|
|
|
+ //获取发运明细子表ID
|
|
|
+ String ids = syDeclarationElements.getSyShippingids();
|
|
|
+ String elementid = syDeclarationElements.getId();
|
|
|
|
|
|
- String id = oConvertUtils.id();
|
|
|
+ String id = oConvertUtils.id();
|
|
|
// //查询发运明细
|
|
|
// QueryWrapper<SyShippingDetailsItem> shiItemQuery = new QueryWrapper<>();
|
|
|
// shiItemQuery.in("id", shippingList);
|
|
@@ -105,9 +106,9 @@ public class SyDeclarationElementsServiceImpl extends ServiceImpl<SyDeclarationE
|
|
|
// if (ok) {
|
|
|
// return syDeclarationElements;
|
|
|
// }
|
|
|
- if(oConvertUtils.isEmpty(elementid)){ //新增
|
|
|
+ if (oConvertUtils.isEmpty(elementid)) { //新增
|
|
|
|
|
|
- List<String> shippingList = new ArrayList<>();
|
|
|
+ List<String> shippingList = new ArrayList<>();
|
|
|
String shSplit[] = ids.split(",");
|
|
|
for (String s : shSplit) {
|
|
|
shippingList.add(s);
|
|
@@ -127,88 +128,101 @@ public class SyDeclarationElementsServiceImpl extends ServiceImpl<SyDeclarationE
|
|
|
syDeclarationElements.setOrderNumber(zero.getOrderNumber());//销售订单号
|
|
|
|
|
|
//新增子表
|
|
|
- List<SyDeclarationElementsItem> list = syDeclarationElements.getSyDeclarationElementsItemList();
|
|
|
- for (SyDeclarationElementsItem item:list){
|
|
|
- if(item.getTypeValue().equals("品名")){
|
|
|
- item.setDescribeText(syDeclarationElements.getDeclarationName());
|
|
|
- }
|
|
|
- item.setId(oConvertUtils.id());
|
|
|
- item.setSyDeclarationElementsId(id);
|
|
|
- syDeclarationElementsItemList.add(item);
|
|
|
- }
|
|
|
- if(syDeclarationElementsItemList.size()!=0){
|
|
|
- syDeclarationElementsItemService.saveBatch(syDeclarationElementsItemList);
|
|
|
+ List<SyDeclarationElementsItem> list = syDeclarationElements.getSyDeclarationElementsItemList();
|
|
|
+ for (SyDeclarationElementsItem item : list) {
|
|
|
+ if (item.getTypeValue().equals("品名")) {
|
|
|
+ item.setDescribeText(syDeclarationElements.getDeclarationName());
|
|
|
}
|
|
|
+ item.setId(oConvertUtils.id());
|
|
|
+ item.setSyDeclarationElementsId(id);
|
|
|
+ syDeclarationElementsItemList.add(item);
|
|
|
+ }
|
|
|
+ if (syDeclarationElementsItemList.size() != 0) {
|
|
|
+ syDeclarationElementsItemService.saveBatch(syDeclarationElementsItemList);
|
|
|
+ }
|
|
|
|
|
|
- //查询其他发运明细是否有相同getInventoryCcode().substring(0,2).equals("19")
|
|
|
- List<SyShippingDetailsVo> list2 = syShippingDetailsMapper.queryAllsyShippingDeial(zero.getItemNumber(),zero.getInventoryCode(),zero.getAccount(),zero.getOrderNumber());
|
|
|
- for(SyShippingDetailsVo li2:list2){
|
|
|
- shippingList.add(li2.getItemIds());
|
|
|
- }
|
|
|
- //修改发运明细报关要素ID
|
|
|
- syShippingDetailsService.writeBackElenmentId(id,shippingList,type,code);
|
|
|
- // 修改预装箱单报关要素ID
|
|
|
- syDeclarationElementsMapper.updateAssembledPackingByShippingDetailItemId(id,shippingList);
|
|
|
-
|
|
|
- boolean ok = save(syDeclarationElements);
|
|
|
- if(ok){
|
|
|
- return syDeclarationElements;
|
|
|
- }
|
|
|
-
|
|
|
- }else{ //修改
|
|
|
-
|
|
|
- //记录未推送的发运明细子表ID集合
|
|
|
- List<String> itemIdsZeor = new ArrayList<>();
|
|
|
-
|
|
|
- //查询所有相关发运明细
|
|
|
- List<SyShippingDetailsVo> list1= syDeclarationElementsMapper.queryList(elementid);
|
|
|
-
|
|
|
- for(SyShippingDetailsVo li: list1){
|
|
|
- if(li.getPushState().equals("0")){
|
|
|
- itemIdsZeor.add(li.getItemIds());
|
|
|
- }
|
|
|
+ //查询其他发运明细是否有相同getInventoryCcode().substring(0,2).equals("19")
|
|
|
+ List<SyShippingDetailsVo> list2 = syShippingDetailsMapper.queryAllsyShippingDeial(zero.getItemNumber(), zero.getInventoryCode(), zero.getAccount(), zero.getOrderNumber());
|
|
|
+ for (SyShippingDetailsVo li2 : list2) {
|
|
|
+ shippingList.add(li2.getItemIds());
|
|
|
+ }
|
|
|
+ //修改发运明细报关要素ID
|
|
|
+ syShippingDetailsService.writeBackElenmentId(id, shippingList, type, code);
|
|
|
+ // 修改预装箱单报关要素ID
|
|
|
+ syDeclarationElementsMapper.updateAssembledPackingByShippingDetailItemId(id, shippingList);
|
|
|
+
|
|
|
+ boolean ok = save(syDeclarationElements);
|
|
|
+ if (ok) {
|
|
|
+ return syDeclarationElements;
|
|
|
}
|
|
|
|
|
|
- if(itemIdsZeor.size()!=0){
|
|
|
- String uuid = oConvertUtils.id();
|
|
|
- //新增子表
|
|
|
- List<SyDeclarationElementsItem> list = syDeclarationElements.getSyDeclarationElementsItemList();
|
|
|
- for (SyDeclarationElementsItem item:list){
|
|
|
- if(item.getTypeValue().equals("品名")){
|
|
|
+ } else { //修改
|
|
|
+ this.updateById(syDeclarationElements);
|
|
|
+ QueryWrapper<SyDeclarationElementsItem> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.lambda().eq(SyDeclarationElementsItem::getSyDeclarationElementsId, elementid);
|
|
|
+ syDeclarationElementsItemService.remove(queryWrapper);
|
|
|
+ List<SyDeclarationElementsItem> itemList = syDeclarationElements.getSyDeclarationElementsItemList();
|
|
|
+ for (SyDeclarationElementsItem item : itemList) {
|
|
|
+ item.setSyDeclarationElementsId(syDeclarationElements.getId());
|
|
|
+ item.setId(null);
|
|
|
+
|
|
|
+ if (item.getTypeValue().equals("品名")) {
|
|
|
item.setDescribeText(syDeclarationElements.getDeclarationName());
|
|
|
}
|
|
|
- item.setId(oConvertUtils.id());
|
|
|
- item.setSyDeclarationElementsId(uuid);
|
|
|
- syDeclarationElementsItemList.add(item);
|
|
|
- }
|
|
|
- if(syDeclarationElementsItemList.size()!=0){
|
|
|
- syDeclarationElementsItemService.saveBatch(syDeclarationElementsItemList);
|
|
|
}
|
|
|
- //新增主表
|
|
|
- syDeclarationElements.setId(uuid);
|
|
|
- //获取第一条数据
|
|
|
- SyShippingDetailsVo zero = list1.get(0);
|
|
|
- syDeclarationElements.setInventoryCode(zero.getInventoryCode());
|
|
|
- syDeclarationElements.setAcSetNo(zero.getAccount());
|
|
|
- syDeclarationElements.setItemNumber(zero.getItemNumber());
|
|
|
- syDeclarationElements.setInventoryName(zero.getInventoryName());
|
|
|
- syDeclarationElements.setOrderNumber(zero.getOrderNumber());//销售订单号
|
|
|
- save(syDeclarationElements);
|
|
|
-
|
|
|
- //修改发运明细报关要素ID
|
|
|
- syShippingDetailsService.writeBackElenmentId(uuid,itemIdsZeor,type,code);
|
|
|
- //修改预装箱单报关要素ID
|
|
|
- //syDeclarationElementsMapper.updateAssembledPacking(uuid,elementid);
|
|
|
- syDeclarationElementsMapper.updateAssembledPackingByShippingDetailItemId(uuid, Arrays.asList(ids.split(",")));
|
|
|
- //修改装箱成衣单报关要素ID
|
|
|
- syDeclarationElementsMapper.updateTailoring(uuid,elementid);
|
|
|
- //修改装箱单面料报关要素ID
|
|
|
- syDeclarationElementsMapper.updateFabric(uuid,elementid,type,code);
|
|
|
- //修改托书子表报关要素ID
|
|
|
- syDeclarationElementsMapper.updatesyShippingOrderItem(uuid,elementid,type,code);
|
|
|
-
|
|
|
- }
|
|
|
+ syDeclarationElementsItemService.saveBatch(itemList);
|
|
|
+// //记录未推送的发运明细子表ID集合
|
|
|
+// List<String> itemIdsZeor = new ArrayList<>();
|
|
|
+//
|
|
|
+// //查询所有相关发运明细
|
|
|
+// List<SyShippingDetailsVo> list1 = syDeclarationElementsMapper.queryList(elementid);
|
|
|
+//
|
|
|
+// for (SyShippingDetailsVo li : list1) {
|
|
|
+// if (li.getPushState().equals("0")) {
|
|
|
+// itemIdsZeor.add(li.getItemIds());
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (itemIdsZeor.size() != 0) {
|
|
|
+// String uuid = oConvertUtils.id();
|
|
|
+// //新增子表
|
|
|
+// List<SyDeclarationElementsItem> list = syDeclarationElements.getSyDeclarationElementsItemList();
|
|
|
+// for (SyDeclarationElementsItem item : list) {
|
|
|
+// if (item.getTypeValue().equals("品名")) {
|
|
|
+// item.setDescribeText(syDeclarationElements.getDeclarationName());
|
|
|
+// }
|
|
|
+// item.setId(oConvertUtils.id());
|
|
|
+// item.setSyDeclarationElementsId(uuid);
|
|
|
+// syDeclarationElementsItemList.add(item);
|
|
|
+// }
|
|
|
+// if (syDeclarationElementsItemList.size() != 0) {
|
|
|
+// syDeclarationElementsItemService.saveBatch(syDeclarationElementsItemList);
|
|
|
+// }
|
|
|
+// //新增主表
|
|
|
+// syDeclarationElements.setId(uuid);
|
|
|
+// //获取第一条数据
|
|
|
+// SyShippingDetailsVo zero = list1.get(0);
|
|
|
+// syDeclarationElements.setInventoryCode(zero.getInventoryCode());
|
|
|
+// syDeclarationElements.setAcSetNo(zero.getAccount());
|
|
|
+// syDeclarationElements.setItemNumber(zero.getItemNumber());
|
|
|
+// syDeclarationElements.setInventoryName(zero.getInventoryName());
|
|
|
+// syDeclarationElements.setOrderNumber(zero.getOrderNumber());//销售订单号
|
|
|
+// save(syDeclarationElements);
|
|
|
+//
|
|
|
+// //修改发运明细报关要素ID
|
|
|
+// syShippingDetailsService.writeBackElenmentId(uuid, itemIdsZeor, type, code);
|
|
|
+// //修改预装箱单报关要素ID
|
|
|
+// //syDeclarationElementsMapper.updateAssembledPacking(uuid,elementid);
|
|
|
+// syDeclarationElementsMapper.updateAssembledPackingByShippingDetailItemId(uuid, Arrays.asList(ids.split(",")));
|
|
|
+// //修改装箱成衣单报关要素ID
|
|
|
+// syDeclarationElementsMapper.updateTailoring(uuid, elementid);
|
|
|
+// //修改装箱单面料报关要素ID
|
|
|
+// syDeclarationElementsMapper.updateFabric(uuid, elementid, type, code);
|
|
|
+// //修改托书子表报关要素ID
|
|
|
+// syDeclarationElementsMapper.updatesyShippingOrderItem(uuid, elementid, type, code);
|
|
|
|
|
|
+// }
|
|
|
+//
|
|
|
}
|
|
|
return syDeclarationElements;
|
|
|
}
|