|
@@ -28,7 +28,9 @@ import org.jeecg.common.system.util.JwtUtil;
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
|
+import org.jeecg.modules.documents.shippingDetails.entity.SyShippingDetailsItem;
|
|
|
import org.jeecg.modules.documents.shippingDetails.entity.VO.SyShippingDetailsVo;
|
|
|
+import org.jeecg.modules.documents.shippingDetails.mapper.SyShippingDetailsItemMapper;
|
|
|
import org.jeecg.modules.openApi.entity.DxpDataPlan;
|
|
|
import org.jeecg.modules.openApi.service.IDxpDataPlanService;
|
|
|
import org.jeecg.modules.spapl.entity.SyPreAssembledPackingList;
|
|
@@ -583,60 +585,46 @@ public class SyPackingListFabricController {
|
|
|
str=JSON.parse(str).toString();
|
|
|
JSONArray json=JSONObject.parseArray(str);
|
|
|
Result result=new Result();
|
|
|
- try {
|
|
|
- if(json!=null&&json.size()>0) {
|
|
|
- //账套1
|
|
|
- List<Map<String, Object>> mapListOne = new ArrayList<>();
|
|
|
- for (int i = 0; i < json.size(); i++) {
|
|
|
- //获取对象
|
|
|
- JSONObject jsonObject = json.getJSONObject(i);
|
|
|
- //获取json名
|
|
|
- String spapl = jsonObject.get("splfi").toString();
|
|
|
- //转list
|
|
|
- List<SyPackingListFabric> packingListFabrics=JSONObject.parseArray(spapl,SyPackingListFabric.class);
|
|
|
- if(packingListFabrics==null){
|
|
|
- result.setSuccess(false);
|
|
|
- result.success("未接收到数据");
|
|
|
- return result;
|
|
|
- }
|
|
|
- for(SyPackingListFabric syPackingListFabric : packingListFabrics){
|
|
|
- if( syPackingListFabric.getSyDeclarationElementsId()==null){
|
|
|
- result.setSuccess(false);
|
|
|
- result.success("未获取到发运明细的id");
|
|
|
- return result;
|
|
|
- }
|
|
|
- if(syPackingListFabric.getPreparedDate()==null){
|
|
|
- result.setSuccess(false);
|
|
|
- result.success("未获取到制单日期");
|
|
|
- return result;
|
|
|
- }
|
|
|
- if(syPackingListFabric.getPreparedBy()==null){
|
|
|
- result.setSuccess(false);
|
|
|
- result.success("未获取到制单人");
|
|
|
- return result;
|
|
|
- }
|
|
|
- if(syPackingListFabric.getSyPackingListFabricItem()!=null){
|
|
|
- for (SyPackingListFabricItem item : syPackingListFabric.getSyPackingListFabricItem()){
|
|
|
- if(item.getSyShippingDetailsItemId()==null){
|
|
|
- result.setSuccess(false);
|
|
|
- result.success("未获取到出运明细子表id");
|
|
|
- return result;
|
|
|
- }
|
|
|
+ if(json!=null&&json.size()>0) {
|
|
|
+ //账套1
|
|
|
+ List<Map<String, Object>> mapListOne = new ArrayList<>();
|
|
|
+ for (int i = 0; i < json.size(); i++) {
|
|
|
+ //获取对象
|
|
|
+ JSONObject jsonObject = json.getJSONObject(i);
|
|
|
+ //获取json名
|
|
|
+ String spapl = jsonObject.get("splfi").toString();
|
|
|
+ //转list
|
|
|
+ List<SyPackingListFabric> packingListFabrics=JSONObject.parseArray(spapl,SyPackingListFabric.class);
|
|
|
+ if(packingListFabrics==null){
|
|
|
+ return Result.error("未接收到数据");
|
|
|
+ }
|
|
|
+ for(SyPackingListFabric syPackingListFabric : packingListFabrics){
|
|
|
+ if( syPackingListFabric.getSyDeclarationElementsId()==null){
|
|
|
+ return Result.error("未获取到发运明细的id");
|
|
|
+ }
|
|
|
+ if(syPackingListFabric.getPreparedDate()==null){
|
|
|
+ return Result.error("未获取到制单日期");
|
|
|
+ }
|
|
|
+ if(syPackingListFabric.getCreateBy()!=null){
|
|
|
+ syPackingListFabric.setPreparedBy(syPackingListFabric.getCreateBy());
|
|
|
+ }
|
|
|
+ /*if(syPackingListFabric.getPreparedBy()==null){
|
|
|
+ return Result.error("未获取到制单人");
|
|
|
+ }*/
|
|
|
+ if(syPackingListFabric.getSyPackingListFabricItem()!=null){
|
|
|
+ for (SyPackingListFabricItem item : syPackingListFabric.getSyPackingListFabricItem()){
|
|
|
+ if(item.getSyShippingDetailsItemId()==null){
|
|
|
+ return Result.error("未获取到出运明细子表id");
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- //生成数据
|
|
|
- syPackingListFabricService.saveList(packingListFabrics);
|
|
|
+ }
|
|
|
}
|
|
|
- result.setSuccess(true);
|
|
|
- result.success("操作成功");
|
|
|
+ //生成数据
|
|
|
+ syPackingListFabricService.saveList(packingListFabrics);
|
|
|
}
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- result.setSuccess(false);
|
|
|
- result.error500("操作失败:"+e.getMessage());
|
|
|
+ return Result.ok("操作成功");
|
|
|
}
|
|
|
- return result;
|
|
|
+ return Result.error("未接收到数据");
|
|
|
}
|
|
|
|
|
|
|
|
@@ -765,6 +753,7 @@ public class SyPackingListFabricController {
|
|
|
queryWrapper.eq("del_flag","0");
|
|
|
List<SyPackingListFabricItem> items=syPackingListFabricItemService.list(queryWrapper);
|
|
|
String message="";//获取报错消息
|
|
|
+ String account="";//当前账套
|
|
|
if(items!=null){
|
|
|
main.setSyPackingListFabricItem(items);
|
|
|
map.put("account",items.get(0).getOmpoAccount());//委外采购账套号
|
|
@@ -777,21 +766,29 @@ public class SyPackingListFabricController {
|
|
|
for (int x=0;x<3;x++){//最多循环3次
|
|
|
try {
|
|
|
if (map.get("account").equals("903")){
|
|
|
- message+=syPackingListFabricService.three(main,map);
|
|
|
+ account="903";
|
|
|
+ message+=syPackingListFabricService.three(main,map)+";";
|
|
|
}else if(map.get("account").equals("902")){
|
|
|
- message+=syPackingListFabricService.two(main,map);
|
|
|
+ account="902";
|
|
|
+ message+=syPackingListFabricService.two(main,map)+";";
|
|
|
}else if(map.get("account").equals("901")){
|
|
|
- message+=syPackingListFabricService.one(main,map);
|
|
|
+ account="901";
|
|
|
+ message+=syPackingListFabricService.one(main,map)+";";
|
|
|
}else{
|
|
|
+ // 业务员,克重,包装方式,处理方式,是否手册纱,手册纱占比,尺码
|
|
|
break;
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
- e.printStackTrace();
|
|
|
+ e.printStackTrace();
|
|
|
message+=e.getMessage();
|
|
|
+ if(map.get("account").equals(account)){
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if(message!=null&&message.length()>0&&message.indexOf("接口")>-1){
|
|
|
+ //if(message!=null&&message.length()>0&&(message.indexOf("接口")>-1||message.indexOf("账套")>-1)){
|
|
|
+ if(message!=null&&message.length()>0){
|
|
|
main.setPushState("2");//推送失败!
|
|
|
result.setSuccess(false);
|
|
|
result.setMessage(message);
|
|
@@ -809,4 +806,30 @@ public class SyPackingListFabricController {
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SyShippingDetailsItemMapper syShippingDetailsItemMapper;
|
|
|
+
|
|
|
+ @AutoLog(value = "同步数据")
|
|
|
+ @ApiOperation(value="同步数据", notes="同步数据")
|
|
|
+ @GetMapping(value = "/updateSyItem")
|
|
|
+ public Result updateSyItem( ) {
|
|
|
+ List<SyPackingListFabricItem> items=syPackingListFabricItemService.list();
|
|
|
+ int num=0;
|
|
|
+ for (SyPackingListFabricItem item:items){
|
|
|
+ if(item.getSyShippingDetailsItemId()!=null){
|
|
|
+ SyShippingDetailsItem syItem=syShippingDetailsItemMapper.selectById(item.getSyShippingDetailsItemId());
|
|
|
+ if(syItem!=null){
|
|
|
+ item.setOmpoId(syItem.getOmpoId());
|
|
|
+ item.setOmpoIdItem(syItem.getOmpoIdItem());
|
|
|
+ item.setOmpoAccount(syItem.getOmpoAccount());
|
|
|
+ if(syItem.getPurOrSubOrder()!=null){
|
|
|
+ item.setPurOrSubOrder(syItem.getPurOrSubOrder());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return Result.ok("更新了多少条数据");
|
|
|
+ }
|
|
|
}
|